03_wireless 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2015 OpenWrt.org
  4. #
  5. [ ! -e /etc/config/wireless ] && exit 0
  6. . /lib/functions/system.sh
  7. . /lib/mvebu.sh
  8. board=$(mvebu_board_name)
  9. case "$board" in
  10. armada-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-shelby|armada-xp-linksys-mamba)
  11. SKU=$(strings /dev/mtd3|sed -ne 's/^cert_region=//p')
  12. WIFIMAC2G=$(macaddr_add $(cat /sys/class/net/eth0/address) +1)
  13. WIFIMAC5G=$(macaddr_add $WIFIMAC2G +1)
  14. case "$SKU" in
  15. AP)
  16. REGD=CN
  17. ;;
  18. AU)
  19. REGD=AU
  20. ;;
  21. CA)
  22. REGD=CA
  23. ;;
  24. EU)
  25. REGD=DE
  26. ;;
  27. US)
  28. REGD=US
  29. ;;
  30. esac
  31. case "$board" in
  32. armada-xp-linksys-mamba)
  33. WIFIMAC0=$WIFIMAC2G
  34. WIFIMAC1=$WIFIMAC5G
  35. ;;
  36. *)
  37. WIFIMAC0=$WIFIMAC5G
  38. WIFIMAC1=$WIFIMAC2G
  39. ;;
  40. esac
  41. uci get wireless.radio0.country || uci set wireless.radio0.country=$REGD
  42. uci get wireless.@wifi-iface[0].macaddr || uci set wireless.@wifi-iface[0].macaddr=$WIFIMAC0
  43. uci get wireless.radio1.country || uci set wireless.radio1.country=$REGD
  44. uci get wireless.@wifi-iface[1].macaddr || uci set wireless.@wifi-iface[1].macaddr=$WIFIMAC1
  45. ;;
  46. esac
  47. uci commit wireless
  48. exit 0