From fbb4a83633fd935748dd3c26d4fc28821db71cdd Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 21 Oct 2013 20:15:31 +0200 Subject: add initial support for handling wireless devices via scripts Signed-off-by: Felix Fietkau --- examples/wireless/mac80211.sh | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 examples/wireless/mac80211.sh (limited to 'examples/wireless/mac80211.sh') 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 -- cgit v1.2.3