[OpenWrt-Devel] [PATCH v2] mac80211: remove error from detect script
Stam, Michel [FINT]
M.Stam at fugro.nl
Wed Oct 8 09:57:43 EDT 2014
After looking at the ticket with the rejected patch, I reimplemented the
patch using the for loop Jow suggested.
I found another line in the same file doing the ls /sys/class/ieee80211
2>/dev/null which I had used, so I rewrote that one as well.
Kind regards,
Michel Stam
-----Original Message-----
From: Michel Stam [mailto:m.stam at fugro.nl]
Sent: Wednesday, October 08, 2014 15:54 PM
To: openwrt-devel at lists.openwrt.org
Cc: jow at openwrt.org; blogic at openwrt.org; Stam, Michel [FINT]
Subject: [PATCH v2] mac80211: remove error from detect script
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..a1ed6f6 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
+
+ phy="${_phy##*/}"
+ [ "$macaddr" = "$(cat
/sys/class/ieee80211/${phy}/macaddress)" ] || continue
return
done
}
@@ -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
--
1.7.12.1
_______________________________________________
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