[OpenWrt-Devel] [PATCH v4] brcm-wl: fix bash comparison error
Nathan Hintz
nlhintz at hotmail.com
Sat Oct 18 16:51:41 EDT 2014
Hi Bastian:
> Date: Sat, 18 Oct 2014 22:37:59 +0200
> From: bittorf at bluebottle.com
> To: nlhintz at hotmail.com
> CC: noltari at gmail.com; openwrt-devel at lists.openwrt.org; hauke at hauke-m.de
> Subject: Re: [OpenWrt-Devel] [PATCH v4] brcm-wl: fix bash comparison error
>
> * Nathan Hintz <nlhintz at hotmail.com> [18.10.2014 22:24]:
> > 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
> > }
>
> what about:
>
> case "$leddc" in
> '0xffff'*)
> leddc='0x005a000a'
> ;;
> esac
>
> IMHO the approach from felix does not work:
> root at box:~ echo $((0xffff))
> 65535
> root at box:~ echo $((0xffff\n))
> -ash: arithmetic syntax error
>
> the real would be the fix the output of 'wlc'.
'wlc' is not broken, a simple test case demonstrates it works as expected:
root at e3000-1:~# wlc ifname wl0 leddc
0x005a000a
root at e3000-1:~# wlc ifname wl0 leddc 0xffff
root at e3000-1:~# wlc ifname wl0 leddc
0xffff
root at e3000-1:~# leddc=$(wlc ifname wl0 leddc)
root at e3000-1:~# [ "$leddc" = "0xffff" ] && echo yes
yes
root at e3000-1:~# wlc ifname wl0 leddc 0x005a000a
root at e3000-1:~# wlc ifname wl0 leddc
0x005a000a
root at e3000-1:~# leddc=$(wlc ifname wl0 leddc)
root at e3000-1:~# [ "$leddc" = "0xffff" ] && echo yes
root at e3000-1:~#
Nathan
>
> bye bastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20141018/bcfb6844/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