gradedcheese
June 18th, 2009, 11:25 PM
Hi. I'm trying to map wlan devices (ex: wlan0) to driver names (ex: ath5k, b43, zd1211rw, etc). For far I've had success with digging in sysfs:
#!/bin/bash
WLAN=`ls /sys/class/net/ | grep wlan`
for iface in $WLAN; do
DRIVER="`ls /sys/class/net/$iface/device/driver/module/drivers/ | cut -d ':' -f 2`"
echo "$iface uses $DRIVER"
done
(this will print out, for example "wlan0 uses ath5k")
...but it doesn't work for some drivers, namely the new ar9170usb driver, which doesn't have that directory. I couldn't find any other way to map ar9170usb to a wlanN device (or vice-versa) so I wonder if there's another way to do this that would be more solid. It doesn't have to be a shell script, but I'd prefer that. Any ideas?
#!/bin/bash
WLAN=`ls /sys/class/net/ | grep wlan`
for iface in $WLAN; do
DRIVER="`ls /sys/class/net/$iface/device/driver/module/drivers/ | cut -d ':' -f 2`"
echo "$iface uses $DRIVER"
done
(this will print out, for example "wlan0 uses ath5k")
...but it doesn't work for some drivers, namely the new ar9170usb driver, which doesn't have that directory. I couldn't find any other way to map ar9170usb to a wlanN device (or vice-versa) so I wonder if there's another way to do this that would be more solid. It doesn't have to be a shell script, but I'd prefer that. Any ideas?