ath79: qca955x: add wmac migration hotplug event
[openwrt/.git] / target / linux / ath79 / base-files / etc / hotplug.d / ieee80211 / 00-wmac-migration
1 #!/bin/sh
2
3 WMAC_PATH_CHANGED=0
4
5 . /lib/functions.sh
6
7 migrate_wmac_path() {
8         local section="$1"
9         local path
10
11         config_get path ${section} path
12         case ${path} in
13                 "platform/qca955x_wmac")
14                         path="platform/ahb/ahb:apb/18100000.wmac"
15                         WMAC_PATH_CHANGED=1
16                 ;;
17                 *)
18                         return 0
19                 ;;
20         esac
21
22         uci set wireless.${section}.path=${path}
23 }
24
25 [ "${ACTION}" = "add" ] && {
26         [ ! -e /etc/config/wireless ] && return 0
27
28         config_load wireless
29         config_foreach migrate_wmac_path wifi-device
30
31         [ "${WMAC_PATH_CHANGED}" = "1" ] && uci commit wireless
32 }