00-wifi-migration 909 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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/ahb/ahb:apb/18100000.wmac"|\
  23. "platform/ar933x_wmac"|\
  24. "platform/ar934x_wmac"|\
  25. "platform/qca953x_wmac"|\
  26. "platform/qca955x_wmac"|\
  27. "platform/qca956x_wmac")
  28. path="platform/ahb/18100000.wmac"
  29. WIFI_PATH_CHANGED=1
  30. ;;
  31. *)
  32. return 0
  33. ;;
  34. esac
  35. uci set wireless.${section}.path=${path}
  36. }
  37. [ "${ACTION}" = "add" ] && {
  38. [ ! -e /etc/config/wireless ] && return 0
  39. config_load wireless
  40. config_foreach migrate_wifi_path wifi-device
  41. [ "${WIFI_PATH_CHANGED}" = "1" ] && uci commit wireless
  42. }