[OpenWrt-Devel] [PATCH v3] mac80211: remove error from detect script

Stam, Michel [FINT] M.Stam at fugro.nl
Thu Oct 9 05:53:37 EDT 2014


Hello Bastian,

I saw the patch already went into GIT, so reworking it will be a tad
difficult.

Renaming from dev to phy might be tricky as phy is a non-local variable.
_phy / _dev could become local variables without problem, but to commit
a new patch just for that seems a bit unnecessary.

Kind regards,

Michel Stam

-----Original Message-----
From: Bastian Bittorf [mailto:bittorf at bluebottle.com] 
Sent: Thursday, October 09, 2014 11:26 AM
To: Stam, Michel [FINT]
Cc: openwrt-devel at openwrt.org
Subject: Re: [OpenWrt-Devel] [PATCH v3] mac80211: remove error from
detect script

* Michel Stam <m.stam at fugro.nl> [09.10.2014 11:16]:
> Signed-off-by: Michel Stam <m.stam at fugro.nl>
> ---
>  package/kernel/mac80211/files/lib/wifi/mac80211.sh | 15
+++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
> index a3b2199..0b662eb 100644
> --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
> +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
> @@ -19,9 +19,11 @@ lookup_phy() {
>  
>  	local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')"
>  	[ -n "$macaddr" ] && {
> -		for _phy in $(ls /sys/class/ieee80211 2>/dev/null); do
> -			[ "$macaddr" = "$(cat
/sys/class/ieee80211/${_phy}/macaddress)" ] || continue
> -			phy="$_phy"
> +		for _phy in /sys/class/ieee80211/*; do
> +			[ -e "$_phy" ] || continue
> +
> +			[ "$macaddr" = "$(cat ${_phy}/macaddress)" ] ||
continue
> +			phy="${_phy##*/}"
>  			return
>  		done
>  	}

looks good.

> @@ -65,7 +67,12 @@ detect_mac80211() {
>  		[ -n "$type" ] || break
>  		devidx=$(($devidx + 1))
>  	done
> -	for dev in $(ls /sys/class/ieee80211); do
> +
> +	for _dev in /sys/class/ieee80211/*; do
> +		[ -e "$_dev" ] || continue
> +
> +		dev="${_dev##*/}"
> +
>  		found=0
>  		config_foreach check_mac80211_device wifi-device
>  		[ "$found" -gt 0 ] && continue

while you are at it:
please rename 'dev' to 'phy' because this is what you are searching for.
also make the var 'local'.

bye, bastian
_______________________________________________
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