From c8f4b69b764f09325937c842038889b5aa78586e Mon Sep 17 00:00:00 2001 From: kalpak <307643502+kalpakprod@users.noreply.github.com> Date: Mon, 2 Nov 2026 18:07:27 +0400 Subject: [PATCH] fix(legacy-mcu1): resolve fdrv firmware dirs without CONFIG_PLATFORM_UBUNTU The chip directory lookup in aic8800_fdrv's aic_request_firmware() is guarded by CONFIG_PLATFORM_UBUNTU, but the fdrv Makefile never passes -DCONFIG_PLATFORM_UBUNTU (only aic_load_fw's Makefile does). With CONFIG_USE_FW_REQUEST=y the Wi-Fi driver therefore requests bare names such as aic_userconfig_8800d80.txt, which are not found, so the user config (TX power tables and the rest) is silently skipped. Guard the lookup with AICWF_USB_SUPPORT only, and make the firmware test compile each module with the macros its own Makefile defines. --- drivers/aic8800/aic8800_fdrv/rwnx_platform.c | 2 +- tests/firmware/test_request_firmware.py | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_platform.c b/drivers/aic8800/aic8800_fdrv/rwnx_platform.c index 7de244b..90e0c8d 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_platform.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_platform.c @@ -613,7 +613,7 @@ static int rwnx_plat_bin_fw_upload(struct rwnx_plat *rwnx_plat, u8* fw_addr, static int aic_request_firmware(const struct firmware **fw, const char *name, struct device *device) { -#if defined(CONFIG_PLATFORM_UBUNTU) && defined(AICWF_USB_SUPPORT) +#if defined(AICWF_USB_SUPPORT) struct aicwf_bus *bus = device ? dev_get_drvdata(device) : NULL; struct aic_usb_dev *usbdev = bus ? bus->bus_priv.usb : NULL; const char *dir = NULL; diff --git a/tests/firmware/test_request_firmware.py b/tests/firmware/test_request_firmware.py index e47f686..3a3bce7 100644 --- a/tests/firmware/test_request_firmware.py +++ b/tests/firmware/test_request_firmware.py @@ -86,7 +86,7 @@ int main(void) { for (unsigned int i = 0; i < sizeof(cases) / sizeof(cases[0]); i++) { char path[256]; snprintf(path, sizeof(path), "%s/fw.bin", cases[i].dir); -#if defined(CONFIG_PLATFORM_UBUNTU) && defined(AICWF_USB_SUPPORT) +#ifdef EXPECT_CHIPDIR setup(cases[i].chip, path); #else setup(cases[i].chip, "fw.bin"); @@ -97,7 +97,7 @@ int main(void) { setup(cases[0].chip, "fw.bin"); hw.dev = expected_device = NULL; success(); setup(cases[0].chip, "fw.bin"); dev.data = NULL; success(); setup(cases[0].chip, "fw.bin"); bus.bus_priv.usb = NULL; success(); -#if defined(CONFIG_PLATFORM_UBUNTU) && defined(AICWF_USB_SUPPORT) +#ifdef EXPECT_CHIPDIR char path[256]; snprintf(path, sizeof(path), "%s/fw.bin", cases[0].dir); setup(cases[0].chip, path); @@ -165,8 +165,20 @@ class RequestFirmwareTests(unittest.TestCase): for chip in chips: code += '{PRODUCT_ID_' + chip + ', "' + directory + '"},\n' code += "};\n" + CHECKS + # The flags the module's own Makefile passes must select the chip + # directories: aic_load_fw defines both macros, aic8800_fdrv only + # AICWF_USB_SUPPORT. + makefile = (folder / "Makefile").read_text() + build = sorted(set(re.findall( + r"^ccflags-\S+\s*\+=\s*-D(CONFIG_PLATFORM_UBUNTU|AICWF_USB_SUPPORT)\b", + makefile, re.M))) + chipdir = (lambda d: "AICWF_USB_SUPPORT" in d) if module == "aic8800_fdrv" else \ + (lambda d: "AICWF_USB_SUPPORT" in d and "CONFIG_PLATFORM_UBUNTU" in d) + self.assertTrue(chipdir(build), (module, build)) for defines in ([], ["CONFIG_PLATFORM_UBUNTU", "AICWF_USB_SUPPORT"], - ["CONFIG_PLATFORM_UBUNTU"]): + ["CONFIG_PLATFORM_UBUNTU"], ["AICWF_USB_SUPPORT"], build): + if chipdir(defines): + defines = defines + ["EXPECT_CHIPDIR"] with self.subTest(module=module, defines=defines): with tempfile.TemporaryDirectory(prefix="aic-fw-request-") as temp: c_file, binary = Path(temp) / "test.c", Path(temp) / "test"