From 2e305e8b1f4e66a5b85a31827cc92e5d2e5cf291 Mon Sep 17 00:00:00 2001 From: nomdetom Date: Wed, 21 Oct 2026 20:16:51 +0100 Subject: [PATCH 1/4] fix(cfg80211): the wiphy may be moved into another network namespace Without WIPHY_FLAG_NETNS_OK, 'iw phy set netns' is refused, so the interface can't be used from a namespace (as test rigs do to pair two radios in one box). The driver keeps nothing per namespace: its only uses of init_net are its own netlink control socket and an optional bridge lookup. --- drivers/aic8800/aic8800_fdrv/rwnx_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_main.c b/drivers/aic8800/aic8800_fdrv/rwnx_main.c index fca3237..4812550 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_main.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_main.c @@ -9281,7 +9281,8 @@ if((g_rwnx_plat->usbdev->chipid == PRODUCT_ID_AIC8801) || WIPHY_FLAG_HAS_CHANNEL_SWITCH | #endif WIPHY_FLAG_4ADDR_STATION | - WIPHY_FLAG_4ADDR_AP; + WIPHY_FLAG_4ADDR_AP | + WIPHY_FLAG_NETNS_OK; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) wiphy->max_num_csa_counters = BCN_MAX_CSA_CPT; From da47f2093f90f3641258961a61e8d12e51dd805c Mon Sep 17 00:00:00 2001 From: nomdetom Date: Sun, 11 Oct 2026 03:07:34 +0100 Subject: [PATCH 2/4] fix(usb): a scan whose command failed is forgotten, so a late answer cannot finish a freed request rwnx_cfg80211_scan() stores the request in rwnx_hw->scan_request before sending SCANU_START_REQ. When the send fails, the error goes back to cfg80211, which frees the request, but scan_request still points at it. A late SCANU_START_CFM (or the next scan's completion) then calls cfg80211_scan_done() on freed memory. Seen on an AIC8800DC with a command timeout injected during a scan: the kernel panicked in cfg80211_scan_done(), caught twice on the serial console. --- drivers/aic8800/aic8800_fdrv/rwnx_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_main.c b/drivers/aic8800/aic8800_fdrv/rwnx_main.c index fca3237..5d03bd5 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_main.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_main.c @@ -2947,8 +2947,10 @@ static int rwnx_cfg80211_scan(struct wiphy *wiphy, } rwnx_hw->scan_request = request; - if ((error = rwnx_send_scanu_req(rwnx_hw, rwnx_vif, request))) + if ((error = rwnx_send_scanu_req(rwnx_hw, rwnx_vif, request))) { + rwnx_hw->scan_request = NULL; return error; + } return 0; } From 57515a5e3dfb58e8e07d0c48a7e473754f5ed8c0 Mon Sep 17 00:00:00 2001 From: Shen Mintao Date: Fri, 23 Oct 2026 15:54:55 +0800 Subject: [PATCH 3/4] fix: align USB logging defaults and device ID with Radxa --- README.md | 55 +++++++++++++++++++ drivers/aic8800/aic8800_fdrv/aicwf_usb.h | 1 + drivers/aic8800/aic8800_fdrv/rwnx_main.c | 2 +- .../aic8800/aic_load_fw/aic_bluetooth_main.c | 2 +- 4 files changed, 58 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4124302..c5e3546 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,9 @@ This driver is for the AIC8800D80 chipset, supported by devices such as the Tend > kernel's standard `btusb` driver. After switching branches, rerun > `sudo ./install.sh` and reboot; switching the Git branch alone does not > replace the firmware already installed under `/lib/firmware`. +> +> If `chip_mcu_id` is missing from the log, enable +> [diagnostic logging](#diagnostic-logging) and repeat device initialization. Added support for devices with Vendor ID 368B (tested). @@ -180,6 +183,58 @@ If the device is still not active, check the kernel logs for any errors related sudo dmesg ``` +### Diagnostic Logging + +Both `aic8800_fdrv` and `aic_load_fw` default to `aicwf_dbg_level=1` +(`LOGERROR`), matching +[Radxa's logging default](https://github.com/radxa-pkg/aic8800/blob/fce88024ed40279def034e203128e0892fdbcac3/debian/patches/fix-Lower-the-debugging-log-level.patch). +This changes the driver's log mask; it does not remove the detailed log +statements or suppress direct `printk()` / `dev_err()` output. + +Some chip-revision, firmware-version and initialization messages use +`LOGINFO`. Enable detailed logging before reproducing a startup failure or +checking `chip_mcu_id` for branch selection. Messages suppressed earlier +cannot be recovered by changing the mask afterward. + +For modules that are already loaded, enable detailed logs without rebuilding: + +```bash +echo 527 | sudo tee /sys/module/aic8800_fdrv/parameters/aicwf_dbg_level +echo 15 | sudo tee /sys/module/aic_load_fw/parameters/aicwf_dbg_level +sudo dmesg -w +``` + +The Wi-Fi mask `527` (`0x20f`) enables ERROR, INFO, TRACE, DEBUG and FW; +the loader mask `15` (`0x0f`) enables ERROR, INFO, TRACE and DEBUG. +Reproduce the problem, then save the kernel log with +`sudo journalctl -k -b --no-pager` or `sudo dmesg`. + +To capture messages from module initialization, set the options before the +modules are loaded: + +```bash +sudo tee /etc/modprobe.d/aic8800-debug.conf >/dev/null <<'EOF' +options aic8800_fdrv aicwf_dbg_level=527 +options aic_load_fw aicwf_dbg_level=15 +EOF +``` + +Reload both modules or reboot, then reproduce the device initialization. +If the modules load from an initramfs, regenerate that initramfs using your +distribution's procedure so it includes these options. + +After collecting the logs, remove the temporary +`/etc/modprobe.d/aic8800-debug.conf` file and restore the running modules' +default masks: + +```bash +echo 1 | sudo tee /sys/module/aic8800_fdrv/parameters/aicwf_dbg_level +echo 1 | sudo tee /sys/module/aic_load_fw/parameters/aicwf_dbg_level +``` + +If the options were included in an initramfs, regenerate it after removing +the configuration as well. + ### Bluetooth on Combo Adapters Bluetooth support does not require a separate AIC transport module. After diff --git a/drivers/aic8800/aic8800_fdrv/aicwf_usb.h b/drivers/aic8800/aic8800_fdrv/aicwf_usb.h index 0ed15f0..46e678d 100644 --- a/drivers/aic8800/aic8800_fdrv/aicwf_usb.h +++ b/drivers/aic8800/aic8800_fdrv/aicwf_usb.h @@ -32,6 +32,7 @@ #define USB_PRODUCT_ID_AIC8801 0x8801 #define USB_PRODUCT_ID_AIC8800DC 0x88dc #define USB_PRODUCT_ID_AIC8800DW 0x88dd +#define USB_PRODUCT_ID_AIC8800DE 0x88de #define USB_PRODUCT_ID_AIC8800D81 0x8d81 #define USB_PRODUCT_ID_AIC8800D81X2 0x8d91 #define USB_PRODUCT_ID_AIC8800D89X2 0x8d99 diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_main.c b/drivers/aic8800/aic8800_fdrv/rwnx_main.c index fca3237..104684b 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_main.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_main.c @@ -548,7 +548,7 @@ static const int rwnx_hwq2uapsd[NL80211_NUM_ACS] = { struct semaphore aicwf_deinit_sem; atomic_t aicwf_deinit_atomic; -int aicwf_dbg_level = LOGERROR|LOGINFO|LOGFW; +int aicwf_dbg_level = LOGERROR; module_param(aicwf_dbg_level, int, 0660); #ifdef CONFIG_DYNAMIC_PWR int dynamic_pwr = 1; diff --git a/drivers/aic8800/aic_load_fw/aic_bluetooth_main.c b/drivers/aic8800/aic_load_fw/aic_bluetooth_main.c index c590fb1..8c5e553 100644 --- a/drivers/aic8800/aic_load_fw/aic_bluetooth_main.c +++ b/drivers/aic8800/aic_load_fw/aic_bluetooth_main.c @@ -20,7 +20,7 @@ int adap_test = 0; char paringid[100]; int n_para = 1; int ble_scan_wakeup_reboot_time = 1000; -int aicwf_dbg_level = LOGERROR|LOGINFO|LOGDEBUG|LOGTRACE; +int aicwf_dbg_level = LOGERROR; int flash_erase_len = 0x400000; uint32_t ad_data_filter_mask = 0; uint32_t gpio_num = 2;//default select gpiob2 for fw_wakeup_host From 051b62368bf5a4eebfd8c74c7593fa3a3029bcde Mon Sep 17 00:00:00 2001 From: Shen Mintao Date: Fri, 23 Oct 2026 17:09:17 +0800 Subject: [PATCH 4/4] fix(cfg80211): gate netns moves for optional init_net users Enable WIPHY_FLAG_NETNS_OK only when both CONFIG_BR_SUPPORT and CONFIG_BAND_STEERING are disabled. Their existing init_net paths do not provide the namespace behavior validated by the default build. Validated all three modules against Linux 6.17 headers and checked the preprocessed capability assignment for all four bridge/steering configuration combinations. --- drivers/aic8800/aic8800_fdrv/rwnx_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_main.c b/drivers/aic8800/aic8800_fdrv/rwnx_main.c index 4812550..82c63f4 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_main.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_main.c @@ -9281,8 +9281,12 @@ if((g_rwnx_plat->usbdev->chipid == PRODUCT_ID_AIC8801) || WIPHY_FLAG_HAS_CHANNEL_SWITCH | #endif WIPHY_FLAG_4ADDR_STATION | - WIPHY_FLAG_4ADDR_AP | - WIPHY_FLAG_NETNS_OK; + WIPHY_FLAG_4ADDR_AP; + +#if !defined(CONFIG_BR_SUPPORT) && !defined(CONFIG_BAND_STEERING) + /* The optional bridge and steering paths still use init_net. */ + wiphy->flags |= WIPHY_FLAG_NETNS_OK; +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) wiphy->max_num_csa_counters = BCN_MAX_CSA_CPT;