mirror of
https://github.com/shenmintao/aic8800d80.git
synced 2026-11-10 16:49:17 +00:00
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.
This commit is contained in:
1 parent
bbf6cb4015
commit
c8f4b69b76
2 files changed
+16
-4
No files matched your search
@@ -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,
|
static int aic_request_firmware(const struct firmware **fw, const char *name,
|
||||||
struct device *device)
|
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 aicwf_bus *bus = device ? dev_get_drvdata(device) : NULL;
|
||||||
struct aic_usb_dev *usbdev = bus ? bus->bus_priv.usb : NULL;
|
struct aic_usb_dev *usbdev = bus ? bus->bus_priv.usb : NULL;
|
||||||
const char *dir = NULL;
|
const char *dir = NULL;
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ int main(void) {
|
|||||||
for (unsigned int i = 0; i < sizeof(cases) / sizeof(cases[0]); i++) {
|
for (unsigned int i = 0; i < sizeof(cases) / sizeof(cases[0]); i++) {
|
||||||
char path[256];
|
char path[256];
|
||||||
snprintf(path, sizeof(path), "%s/fw.bin", cases[i].dir);
|
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);
|
setup(cases[i].chip, path);
|
||||||
#else
|
#else
|
||||||
setup(cases[i].chip, "fw.bin");
|
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"); hw.dev = expected_device = NULL; success();
|
||||||
setup(cases[0].chip, "fw.bin"); dev.data = NULL; success();
|
setup(cases[0].chip, "fw.bin"); dev.data = NULL; success();
|
||||||
setup(cases[0].chip, "fw.bin"); bus.bus_priv.usb = 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];
|
char path[256];
|
||||||
snprintf(path, sizeof(path), "%s/fw.bin", cases[0].dir);
|
snprintf(path, sizeof(path), "%s/fw.bin", cases[0].dir);
|
||||||
setup(cases[0].chip, path);
|
setup(cases[0].chip, path);
|
||||||
@@ -165,8 +165,20 @@ class RequestFirmwareTests(unittest.TestCase):
|
|||||||
for chip in chips:
|
for chip in chips:
|
||||||
code += '{PRODUCT_ID_' + chip + ', "' + directory + '"},\n'
|
code += '{PRODUCT_ID_' + chip + ', "' + directory + '"},\n'
|
||||||
code += "};\n" + CHECKS
|
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"],
|
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 self.subTest(module=module, defines=defines):
|
||||||
with tempfile.TemporaryDirectory(prefix="aic-fw-request-") as temp:
|
with tempfile.TemporaryDirectory(prefix="aic-fw-request-") as temp:
|
||||||
c_file, binary = Path(temp) / "test.c", Path(temp) / "test"
|
c_file, binary = Path(temp) / "test.c", Path(temp) / "test"
|
||||||
|
|||||||
Reference in new issue
Block a user