From e22253ce6ebc40e865b5bc26844901026f04ec4e Mon Sep 17 00:00:00 2001 From: Christina Ying Wang Date: Fri, 16 Feb 2024 18:12:33 -0800 Subject: [PATCH] Patch config.txt backend to return array configs correctly Previously, getBootConfig() of the config.txt backend was omitting array configurations such as gpio settings, thus resulting in the SV mistakenly assuming that boot config had not been applied, since gpio would not be in current config.txt config but would be in target config. This resulted in SV entering an infinite loop of attempting to apply the gpio config when it wasn't necessary. Change-type: patch Signed-off-by: Christina Ying Wang --- src/config/backends/config-txt.ts | 3 +++ test/integration/config/config-txt.spec.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/config/backends/config-txt.ts b/src/config/backends/config-txt.ts index 09539f91..1e5cf767 100644 --- a/src/config/backends/config-txt.ts +++ b/src/config/backends/config-txt.ts @@ -157,6 +157,9 @@ export class ConfigTxt extends ConfigBackend { // Otherwise push the new value to the array const arrayConf = conf[key] == null ? [] : conf[key]!; arrayConf.push(value); + if (conf[key] == null) { + conf[key] = arrayConf; + } } } continue; diff --git a/test/integration/config/config-txt.spec.ts b/test/integration/config/config-txt.spec.ts index 5640f6a5..c7a3da30 100644 --- a/test/integration/config/config-txt.spec.ts +++ b/test/integration/config/config-txt.spec.ts @@ -17,6 +17,8 @@ describe('config/config-txt', () => { dtoverlay=ads7846 enable_uart=1 avoid_warnings=1 + gpio=8=pd + gpio=17=op,dh gpu_mem=16 hdmi_force_hotplug:1=1 dtoverlay=lirc-rpi,gpio_out_pin=17,gpio_in_pin=13 @@ -34,6 +36,7 @@ describe('config/config-txt', () => { ], enable_uart: '1', avoid_warnings: '1', + gpio: ['8=pd', '17=op,dh'], gpu_mem: '16', initramfs: 'initramf.gz 0x00800000', 'hdmi_force_hotplug:1': '1',