Upstream refresh for v1.5.0-rc1 : Upstream 19.07 : 4fb6b8c553f692eeb5bcb203e0f8ee8df0...
[librecmc/librecmc.git] / target / linux / ath79 / base-files / etc / hotplug.d / ieee80211 / 00-wifi-migration
1 #!/bin/sh
2
3 WIFI_PATH_CHANGED=0
4
5 . /lib/functions.sh
6
7 migrate_wifi_path() {
8         local section="$1"
9         local path
10
11         config_get path ${section} path
12         case ${path} in
13                 "pci0000:01/0000:01:00.0")
14                         board=$(board_name)
15
16                         case "$board" in
17                                 tplink,archer-c7-v1|\
18                                 tplink,archer-c7-v2)
19                                         path="pci0000:00/0000:00:00.0"
20                                         WIFI_PATH_CHANGED=1
21                                 ;;
22                                 *)
23                                         return 0
24                                 ;;
25                         esac
26                 ;;
27                 "platform/qca955x_wmac")
28                         path="platform/ahb/ahb:apb/18100000.wmac"
29                         WIFI_PATH_CHANGED=1
30                 ;;
31                 "platform/ar933x_wmac")
32                         path="platform/ahb/18100000.wmac"
33                         WIFI_PATH_CHANGED=1
34                 ;;
35                 *)
36                         return 0
37                 ;;
38         esac
39
40         uci set wireless.${section}.path=${path}
41 }
42
43 [ "${ACTION}" = "add" ] && {
44         [ ! -e /etc/config/wireless ] && return 0
45
46         config_load wireless
47         config_foreach migrate_wifi_path wifi-device
48
49         [ "${WIFI_PATH_CHANGED}" = "1" ] && uci commit wireless
50 }