mcu: support OpenWiFi with uCentral

On device running OpenWiFi with uCentral, additional copy of the initial
UCI configuration will be generated in '/etc/config-shadow/'. As part of
the MCU configuration is done during runtime, after the 'config-shadow'
is created, we should update it as well to keep everything in sync.

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
This commit is contained in:
Piotr Dymacz
2023-02-17 00:07:18 +01:00
committed by John Crispin
parent 9aff26b7fb
commit e4ed881dd7
2 changed files with 22 additions and 0 deletions

View File

@@ -92,6 +92,18 @@ mcu_hotplug_setup() {
sect="${sn:0:8}_usb"
mcu_logi "no matching MCU config found, adding new (disabled): '$sect'"
[ -d /etc/config-shadow ] && {
uci -c /etc/config-shadow -q batch <<-EOF
set mcu.${sect}=mcu
set mcu.${sect}.interface=usb
set mcu.${sect}.bootloader=mcuboot
set mcu.${sect}.sn=$sn
set mcu.${sect}.disabled=1
EOF
uci -c /etc/config-shadow -q commit mcu
}
uci -q batch <<-EOF
set mcu.${sect}=mcu
set mcu.${sect}.interface=usb

View File

@@ -351,6 +351,11 @@ mcu_sn_check_and_update() {
[ -n "$sn_dev" ] && {
if [ -z "$sn" ]; then
[ -d /etc/config-shadow ] && {
uci -c /etc/config-shadow -q set mcu.${SECT}.sn="$sn_dev"
uci -c /etc/config-shadow -q commit mcu
}
uci -q set mcu.${SECT}.sn="$sn_dev"
uci -q commit mcu
else
@@ -424,6 +429,11 @@ mcu_fw_check_and_update() {
[ "$active_slot" = "1" ] && firmware="$slot1_fw"
[ -n "$firmware" ] && {
[ -d /etc/config-shadow ] && {
uci -c /etc/config-shadow -q set mcu.${SECT}.firmware="$firmware"
uci -c /etc/config-shadow -q commit mcu
}
uci -q set mcu.${SECT}.firmware="$firmware"
uci -q commit mcu