00-wifi-migration 857 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. WIFI_PATH_CHANGED=0
  3. . /lib/functions.sh
  4. migrate_wifi_path() {
  5. local section="$1"
  6. local path
  7. config_get path ${section} path
  8. case ${path} in
  9. "pci0000:01/0000:01:00.0")
  10. board=$(board_name)
  11. case "$board" in
  12. tplink,archer-c7-v1|\
  13. tplink,archer-c7-v2)
  14. path="pci0000:00/0000:00:00.0"
  15. WIFI_PATH_CHANGED=1
  16. ;;
  17. *)
  18. return 0
  19. ;;
  20. esac
  21. ;;
  22. "platform/qca955x_wmac")
  23. path="platform/ahb/ahb:apb/18100000.wmac"
  24. WIFI_PATH_CHANGED=1
  25. ;;
  26. "platform/ar933x_wmac")
  27. path="platform/ahb/18100000.wmac"
  28. WIFI_PATH_CHANGED=1
  29. ;;
  30. *)
  31. return 0
  32. ;;
  33. esac
  34. uci set wireless.${section}.path=${path}
  35. }
  36. [ "${ACTION}" = "add" ] && {
  37. [ ! -e /etc/config/wireless ] && return 0
  38. config_load wireless
  39. config_foreach migrate_wifi_path wifi-device
  40. [ "${WIFI_PATH_CHANGED}" = "1" ] && uci commit wireless
  41. }