diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-10-21 20:15:31 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-11-29 14:52:01 +0100 |
commit | fbb4a83633fd935748dd3c26d4fc28821db71cdd (patch) | |
tree | 16e1630b408dac7214bf8ec871720a68f06d977c /examples/wireless/mac80211.sh | |
parent | 2eaffc0ed137595784d19edf17e517c320cbf264 (diff) |
add initial support for handling wireless devices via scripts
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'examples/wireless/mac80211.sh')
-rwxr-xr-x | examples/wireless/mac80211.sh | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/examples/wireless/mac80211.sh b/examples/wireless/mac80211.sh new file mode 100755 index 0000000..aa663bb --- /dev/null +++ b/examples/wireless/mac80211.sh @@ -0,0 +1,63 @@ +#!/bin/sh +NETIFD_MAIN_DIR=../../scripts +. $NETIFD_MAIN_DIR/netifd-wireless.sh + +init_wireless_driver "$@" + +drv_mac80211_init_device_config() { + # identifiers + config_add_string macaddr + config_add_string path + config_add_string phy + + # config + config_add_int channel + config_add_string hwmode + config_add_array ht_capab + + config_add_int chanbw +} + +drv_mac80211_init_iface_config() { + config_add_string macaddr + + config_add_boolean wds + config_add_int maxassoc + config_add_int dtim_period + + config_add_int max_listen_int + + config_add_boolean hidden + config_add_boolean wmm +} + +setup_vif() { + local name="$1" + + json_select config + json_get_var ssid ssid + json_select .. + + wireless_add_vif "$name" "dummy-$ssid" + /bin/sleep 10 & + wireless_add_process "$!" /bin/sleep 1 +} + + +drv_mac80211_setup() { + echo "mac80211 setup: $1" + json_dump + for_each_interface "sta ap adhoc" setup_vif + wireless_set_data phy=phy0 + wireless_set_up +} + +drv_mac80211_teardown() { + json_select data + json_get_var phy phy + json_select .. + echo "mac80211 teardown: $1 ($phy)" + json_dump +} + +add_driver mac80211 |