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

Jo-Philipp Wich jow at openwrt.org
Fri Oct 3 13:37:18 EDT 2014


Hi Michel, John.

>> -	for dev in $(ls /sys/class/ieee80211); do
>> +	for dev in $(ls /sys/class/ieee80211 2>/dev/null); do
> what error do you see ? if you see an error we should try to fix that
> rather than supressing it

I suppose the case when "wifi detect" is invoked but no phy exists on
the system (e.g. because the radio hardware is not installed - think USB).

In this case the entire /sys/class/ieee80211 is likely missing which
will cause "ls" to print a "No such file or directory" error.

Actually I do not really like that whole "for x in $(ls ...)" construct,
something like the following would save one fork and also not produce
errors:

for dev in /sys/class/ieee80211/*; do
    if [ -h "$dev" ]; then
         # do something with ${dev##*/}
    fi
done


~ Jow
_______________________________________________
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