summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens2024-12-08 15:18:52 +0000
committerHauke Mehrtens2024-12-09 23:02:27 +0000
commitf8b93e2d12ef01fc565178c71c39470da798155a (patch)
treeaf829d0f10a66583b17adf24bf0353c6f866d308
parenta498a84393a80de9f828b8465906761896ca4940 (diff)
downloadopenwrt-f8b93e2d12ef01fc565178c71c39470da798155a.tar.gz
mediatek: filogic: Migrate wifi configuration device paths
The device path to the devices changed. Migrate the wifi configurations from the old path to the new one. This is needed to migrate Wireless configurations from OpenWrt 23.05 to OpenWrt 24.10. This script is based on these two files: target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate target/linux/qualcommax/ipq807x/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate Fixes: 0ef927472148 ("mediatek: filogic: move mt7981 on-SoC blocks to "soc" node in DT") Fixes: https://github.com/openwrt/openwrt/issues/17174 Link: https://github.com/openwrt/openwrt/pull/17210 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate63
1 files changed, 63 insertions, 0 deletions
diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate
new file mode 100644
index 0000000000..ae3bc643cd
--- /dev/null
+++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/05-wifi-migrate
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+# This must run before 10-wifi-detect
+
+
+[ "${ACTION}" = "add" ] || return
+
+
+. /lib/functions.sh
+
+
+check_radio()
+{
+ local cfg="$1" to="$2"
+
+ config_get path "$cfg" path
+
+ [ "$path" = "$to" ] && PATH_EXISTS=true
+}
+
+do_migrate_radio()
+{
+ local cfg="$1" from="$2" to="$3"
+
+ config_get path "$cfg" path
+
+ [ "$path" = "$from" ] || return
+
+ uci set "wireless.${cfg}.path=${to}"
+ WIRELESS_CHANGED=true
+
+ logger -t wifi-migrate "Updated path of wireless.${cfg} from '${from}' to '${to}'"
+}
+
+migrate_radio()
+{
+ local from="$1" to="$2"
+
+ config_load wireless
+
+ # Check if there is already a section with the target path: In this case, the system
+ # was already upgraded to a version without this migration script before; better bail out,
+ # as we can't be sure we don't break more than we fix.
+ PATH_EXISTS=false
+ config_foreach check_radio wifi-device "$to"
+ $PATH_EXISTS && return
+
+ config_foreach do_migrate_radio wifi-device "$from" "$to"
+}
+
+
+WIRELESS_CHANGED=false
+
+case "$(board_name)" in
+*)
+ migrate_radio 'platform/18000000.wifi' 'platform/soc/18000000.wifi'
+ migrate_radio 'platform/18000000.wifi+1' 'platform/soc/18000000.wifi+1'
+ ;;
+esac
+
+$WIRELESS_CHANGED && uci commit wireless
+
+exit 0