mac80211.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  2. NETIFD_MAIN_DIR=../../scripts
  3. . $NETIFD_MAIN_DIR/netifd-wireless.sh
  4. init_wireless_driver "$@"
  5. drv_mac80211_init_device_config() {
  6. # identifiers
  7. config_add_string macaddr
  8. config_add_string path
  9. config_add_string phy
  10. # config
  11. config_add_int channel
  12. config_add_string hwmode
  13. config_add_array ht_capab
  14. config_add_int chanbw
  15. }
  16. drv_mac80211_init_iface_config() {
  17. config_add_string macaddr
  18. config_add_boolean wds
  19. config_add_int maxassoc
  20. config_add_int dtim_period
  21. config_add_int max_listen_int
  22. config_add_boolean hidden
  23. config_add_boolean wmm
  24. }
  25. setup_vif() {
  26. local name="$1"
  27. json_select config
  28. json_get_var ssid ssid
  29. json_select ..
  30. wireless_add_vif "$name" "${radio}v$vifidx"
  31. /bin/sleep 10 &
  32. wireless_add_process "$!" /bin/sleep 1
  33. vifidx=$((vifidx + 1))
  34. }
  35. drv_mac80211_cleanup() {
  36. echo "mac80211 cleanup"
  37. }
  38. drv_mac80211_setup() {
  39. echo "mac80211 setup: $1"
  40. radio=$1
  41. vifidx=0
  42. json_dump
  43. for_each_interface "sta ap adhoc" setup_vif
  44. wireless_set_data phy=phy0
  45. wireless_set_up
  46. }
  47. drv_mac80211_teardown() {
  48. json_select data
  49. json_get_var phy phy
  50. json_select ..
  51. echo "mac80211 teardown: $1 ($phy)"
  52. json_dump
  53. }
  54. add_driver mac80211