00-wifi-migration 1.0 KB

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