2019-03-13 16:44:22 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2019-06-04 20:06:17 +00:00
|
|
|
WIFI_PATH_CHANGED=0
|
2019-03-13 16:44:22 +00:00
|
|
|
|
|
|
|
. /lib/functions.sh
|
|
|
|
|
2019-06-04 20:06:17 +00:00
|
|
|
migrate_wifi_path() {
|
2019-03-13 16:44:22 +00:00
|
|
|
local section="$1"
|
|
|
|
local path
|
|
|
|
|
|
|
|
config_get path ${section} path
|
|
|
|
case ${path} in
|
2019-06-04 20:06:17 +00:00
|
|
|
"pci0000:01/0000:01:00.0")
|
|
|
|
board=$(board_name)
|
|
|
|
|
|
|
|
case "$board" in
|
|
|
|
tplink,archer-c7-v1|\
|
|
|
|
tplink,archer-c7-v2)
|
|
|
|
path="pci0000:00/0000:00:00.0"
|
|
|
|
WIFI_PATH_CHANGED=1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2019-03-13 16:44:22 +00:00
|
|
|
"platform/qca955x_wmac")
|
|
|
|
path="platform/ahb/ahb:apb/18100000.wmac"
|
2019-06-04 20:06:17 +00:00
|
|
|
WIFI_PATH_CHANGED=1
|
2019-03-13 16:44:22 +00:00
|
|
|
;;
|
2018-12-16 01:22:45 +00:00
|
|
|
"platform/ar933x_wmac")
|
|
|
|
path="platform/ahb/18100000.wmac"
|
2019-06-04 20:06:17 +00:00
|
|
|
WIFI_PATH_CHANGED=1
|
2018-12-16 01:22:45 +00:00
|
|
|
;;
|
2019-03-13 16:44:22 +00:00
|
|
|
*)
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
uci set wireless.${section}.path=${path}
|
|
|
|
}
|
|
|
|
|
|
|
|
[ "${ACTION}" = "add" ] && {
|
|
|
|
[ ! -e /etc/config/wireless ] && return 0
|
|
|
|
|
|
|
|
config_load wireless
|
2019-06-04 20:06:17 +00:00
|
|
|
config_foreach migrate_wifi_path wifi-device
|
2019-03-13 16:44:22 +00:00
|
|
|
|
2019-06-04 20:06:17 +00:00
|
|
|
[ "${WIFI_PATH_CHANGED}" = "1" ] && uci commit wireless
|
2019-03-13 16:44:22 +00:00
|
|
|
}
|