aboutsummaryrefslogtreecommitdiffstats
path: root/package/hostap-driver/files
diff options
context:
space:
mode:
authorTravis Kemen <thepeople@openwrt.org>2007-11-28 03:44:18 +0000
committerTravis Kemen <thepeople@openwrt.org>2007-11-28 03:44:18 +0000
commitbe9bf2bf4093555b5ea30a4e6c4f19b761deeab2 (patch)
tree98abe0ad456fee802c2317a7ef431283d6f649ca /package/hostap-driver/files
parentf30263eea0b36b97c97b8afb506fed52d7cfff3b (diff)
downloadupstream-be9bf2bf4093555b5ea30a4e6c4f19b761deeab2.tar.gz
upstream-be9bf2bf4093555b5ea30a4e6c4f19b761deeab2.tar.bz2
upstream-be9bf2bf4093555b5ea30a4e6c4f19b761deeab2.zip
add txpower patches and add uci configuration file From: Vasilis T. (aka Acinonyx)
SVN-Revision: 9610
Diffstat (limited to 'package/hostap-driver/files')
-rwxr-xr-xpackage/hostap-driver/files/lib/wifi/hostap.sh112
1 files changed, 112 insertions, 0 deletions
diff --git a/package/hostap-driver/files/lib/wifi/hostap.sh b/package/hostap-driver/files/lib/wifi/hostap.sh
new file mode 100755
index 0000000000..964a504180
--- /dev/null
+++ b/package/hostap-driver/files/lib/wifi/hostap.sh
@@ -0,0 +1,112 @@
+#!/bin/sh
+append DRIVERS "prism2"
+
+scan_prism2() {
+ local device="$1"
+
+ config_get mode "$device" mode
+ case "$mode" in
+ ad-hoc|managed|master)
+ ;;
+ *) echo "$device: Invalid mode, ignored."; continue;;
+ esac
+
+}
+
+disable_prism2() (
+ local device="$1"
+
+ set_wifi_down "$device"
+
+ include /lib/network
+ ifconfig "$device" down
+ unbridge "$device"
+ return 0
+)
+
+enable_prism2() {
+ local irqdevs
+
+ config_get prifw "$device" prifw
+ config_get stafw "$device" stafw
+ config_get mode "$device" mode
+ config_get rate "$device" rate
+ config_get channel "$device" channel
+ config_get txpower "$device" txpower
+ config_get ssid "$device" ssid
+ config_get maclist "$device" maclist
+ config_get macpolicy "$device" macpolicy
+ [ -x /usr/sbin/prism2_srec ] && {
+ irqdevs=$(cat /proc/interrupts | grep wifi${device##wlan} | cut -b 37- | tr -d ",")
+ for dev in "$irqdevs"; do
+ [ "$(config_get "$dev" type)" = "atheros" ] && wifi down "$dev"
+ done
+ [ -f "$prifw" ] && prism2_srec -g $device $prifw
+ [ -f "$stafw" ] && prism2_srec -r $device $stafw
+ for dev in "$irqdevs"; do
+ [ "$(config_get "$dev" type)" = "atheros" ] && wifi up "$dev"
+ done
+ }
+ [ -n "$mode" ] && iwconfig $device mode $mode
+ [ -n "$rate" ] && iwconfig $device rate $rate
+ [ -n "$channel" ] && iwconfig $device channel $channel
+ [ -n "$ssid" ] && iwconfig $device essid $ssid
+ [ -n "$txpower" ] && iwconfig $device txpower $txpower
+ [ -n "$maclist" ] && {
+ # flush MAC list
+ iwpriv $device maccmd 3
+ for mac in $maclist; do
+ iwpriv $device addmac $mac
+ done
+ }
+ case "$macpolicy" in
+ open)
+ iwpriv $device maccmd 0
+ ;;
+ allow)
+ iwpriv $device maccmd 1
+ ;;
+ deny)
+ iwpriv $device maccmd 2
+ ;;
+ *)
+ # default deny policy if mac list exists
+ [ -n "$maclist" ] && iwpriv $device maccmd 2
+ ;;
+ esac
+ # kick all stations if we have policy explicitly set
+ [ -n "$macpolicy" ] && iwpriv $device maccmd 4
+ local net_cfg bridge
+ net_cfg="$(find_net_config "$device")"
+ [ -z "$net_cfg" ] || {
+ bridge="$(bridge_interface "$net_cfg")"
+ config_set "$device" bridge "$bridge"
+ start_net "$device" "$net_cfg"
+ }
+ set_wifi_up "$vif" "$ifname"
+}
+
+
+detect_prism2() {
+ cd /proc/net/hostap
+ [ -d wlan0 ] || return
+ for dev in wlan*; do
+ config_get type "$dev" type
+ [ "$type" = prism2 ] && continue
+ cat <<EOF
+
+config wifi-device $dev
+ option type prism2
+# option rate 11M
+ option channel 5
+ option txpower 127
+ option mode managed
+ option ssid OpenWrt
+# option macpolicy deny
+# option maclist '12:34:56:78:90:12
+# 09:87:65:43:21:09'
+
+EOF
+ done
+}
+