From d20afc8d2254c64f5638757c535ee8cf8f1f5da7 Mon Sep 17 00:00:00 2001 From: thepeople Date: Wed, 28 Nov 2007 03:44:18 +0000 Subject: add txpower patches and add uci configuration file From: Vasilis T. (aka Acinonyx) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@9610 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/hostap-driver/files/lib/wifi/hostap.sh | 112 +++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100755 package/hostap-driver/files/lib/wifi/hostap.sh (limited to 'package/hostap-driver/files/lib/wifi') 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 000000000..964a50418 --- /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 <