00-wifi-migration 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. zyxel,emg2926-q10a|\
  15. zyxel,nbg6716)
  16. path="pci0000:00/0000:00:00.0"
  17. WIFI_PATH_CHANGED=1
  18. ;;
  19. *)
  20. return 0
  21. ;;
  22. esac
  23. ;;
  24. "platform/ahb/ahb:apb/18100000.wmac"|\
  25. "platform/ar933x_wmac"|\
  26. "platform/ar934x_wmac"|\
  27. "platform/qca953x_wmac"|\
  28. "platform/qca955x_wmac"|\
  29. "platform/qca956x_wmac")
  30. path="platform/ahb/18100000.wmac"
  31. WIFI_PATH_CHANGED=1
  32. ;;
  33. "platform/ath9k")
  34. path="platform/ahb/180c0000.wmac"
  35. WIFI_PATH_CHANGED=1
  36. ;;
  37. *)
  38. return 0
  39. ;;
  40. esac
  41. uci set wireless.${section}.path=${path}
  42. }
  43. [ "${ACTION}" = "add" ] && {
  44. [ ! -e /etc/config/wireless ] && return 0
  45. config_load wireless
  46. config_foreach migrate_wifi_path wifi-device
  47. [ "${WIFI_PATH_CHANGED}" = "1" ] && uci commit wireless
  48. }