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