[OpenWrt-Devel] [PATCH v4] brcm-wl: fix bash comparison error

Nathan Hintz nlhintz at hotmail.com
Sat Oct 18 15:35:02 EDT 2014




Hi Alvaro:

> Date: Sat, 18 Oct 2014 13:55:39 +0200
> From: noltari at gmail.com
> To: openwrt-devel at lists.openwrt.org; hauke at hauke-m.de; blogic at openwrt.org; nbd at openwrt.org
> Subject: [OpenWrt-Devel] [PATCH v4] brcm-wl: fix bash comparison error
> 
> wlc returns a string number ending with "\n", making it impossible to compare this value to a number.
> 
> Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
> ---
> v4: remove bashishm as suggested by Bastian Bittorf.
> v3: avoid using an extra variable.
> v2: use string comparison
> 
> diff --git a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
> index 69e3132..5994e26 100644
> --- a/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
> +++ b/package/kernel/broadcom-wl/files/lib/wifi/broadcom.sh
> @@ -209,7 +209,7 @@ enable_broadcom() {
>  	}
>  
>  	local leddc=$(wlc ifname "$device" leddc)
> -	[ "$leddc" -eq 0xffff ] || {
> +	[ "$leddc" = '0xffff\n' ] || {
>  		leddc=0x005a000a;
>  	}
Using the "\n" is not correct.  I think the real problem is that the logic is reversed (should be && instead of ||); although it might
be better to eliminate the conditional entirely since leddc is always commanded to "0xffff" when the interface is taken down.

local leddc=$(wlc ifname "$device" leddc)
[ "$leddc" = "0xffff" ] && {
 		    leddc=0x005a000a
}

Nathan

>  
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20141018/cc95726f/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list