mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-19 05:38:00 +00:00
ramips: mt7621: add migration script for WLAN PCI paths
PCI paths of the WLAN devices have changed between kernel 5.10 and 5.15; migrate config so existing wifi-iface definitions don't break. This is implemented as a hotplug handler rather than a uci-defaults script as the migration script must run before the 10-wifi-detect hotplug handler. based onb452af23a8
migration was forgotten when device trees were adjusted in688697889c
c77913be5b
fixes #9374 affected devices: Netgear R6220 Netgear WAC104 Netgear WNDR3700 v5 Zbtlink ZBT-WE1326 Wiflyer WF3526-P Arcadyan WE420223-99 Beeline Smartbox Flash (Arcadyan WG443223) MTS WG430223 (Arcadyan WG430223) Tested-by: Maximilian Baumgartner <aufhaxer@googlemail.com> Tested-by: Mikhail Zhilkin <csharper2005@gmail.com> Signed-off-by: Felix Baumann <felix.bau@gmx.de>
This commit is contained in:
parent
936df715de
commit
cbf120c255
@ -0,0 +1,75 @@
|
||||
#!/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
|
||||
arcadyan,we420223-99|\
|
||||
beeline,smartbox-flash|\
|
||||
mts,wg430223)
|
||||
migrate_radio '1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0' '1e140000.pcie/pci0000:00/0000:00:01.0/0000:01:00.0'
|
||||
migrate_radio '1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0+1' '1e140000.pcie/pci0000:00/0000:00:01.0/0000:01:00.0+1'
|
||||
;;
|
||||
netgear,r6220|\
|
||||
netgear,wac104|\
|
||||
netgear,wndr3700-v5)
|
||||
migrate_radio '1e140000.pcie/pci0000:00/0000:00:01.0/0000:02:00.0' '1e140000.pcie/pci0000:00/0000:00:02.0/0000:02:00.0'
|
||||
;;
|
||||
zbtlink,zbt-we1326)
|
||||
migrate_radio '1e140000.pcie/pci0000:00/0000:00:01.0/0000:02:00.0' '1e140000.pcie/pci0000:00/0000:00:02.0/0000:02:00.0'
|
||||
migrate_radio '1e140000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0' '1e140000.pcie/pci0000:00/0000:00:01.0/0000:01:00.0'
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
$WIRELESS_CHANGED && uci commit wireless
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user