meshwizard: cleanup references to madwifi
[project/luci.git] / contrib / package / meshwizard / files / usr / bin / meshwizard / helpers / supports_vap.sh
1 #!/bin/sh
2 # checks if a given device can be used for a VAP interface (1 adhoc + 1 ap)
3 dev="$1"
4 type="$2"
5
6
7 if [ -z "$dev" -o -z "$type" ]; then
8         exit 1
9 fi
10
11 if [ "$type" = "mac80211" ]; then
12         # not hostapd[-mini], no VAP
13         if [ ! -x /usr/sbin/hostapd ]; then
14                 echo "WARNING: hostapd[-mini] is required to be able to use VAP with mac80211."
15                 exit 1
16         fi
17         # get driver in use
18         netindex="$(echo $dev |sed 's/[a-zA-z]*//')"
19         if [ -d /sys/class/net/wlan${netindex}/device/driver/module ]; then
20                 driver="$(basename $(ls -l /sys/class/net/wlan${netindex}/device/driver/module | sed -ne 's/.* -> //p'))"
21                 if [ "$driver" = "ath9k" -o  "$driver" = "ath5k" ]; then
22                         exit 0
23                 else
24                         exit 1
25                 fi
26         else
27                 exit 1
28         fi
29 else
30         exit 1
31 fi
32