From cfc1c205c71a52ec9d51e47dd97fa0febcf55fb0 Mon Sep 17 00:00:00 2001 From: Joseph <162703152+josephnef@users.noreply.github.com> Date: Wed, 10 Jun 2026 07:15:46 +0300 Subject: [PATCH] 8814: run PHY_SwitchWirelessBand8814A (not the 8812 path) at initial band-set HalModule::rtl8812au_hal_init called PHY_SwitchWirelessBand8812 unconditionally for the initial band-set, even for CHIP_8814A. The 8812 band-switch marks the band already-set via the CCK-check register, so phy_SwBand8812's later per-chip dispatch sees BandToSW == Band and SKIPS PHY_SwitchWirelessBand8814A entirely. The 8814 therefore never ran its proper 5G band-switch: the path-C/D RFE pinmux (0xCB0/0xEB0/0x18B4/0x1AB4 via phy_SetRFEReg8814A), the 8814 AGC-table register, and the CCK clock-gate cycle stayed at frozen ch6-replay values, so the 5G RX front-end was misrouted and the chip surfaced 0 frames at 5GHz (bulk-IN LIBUSB_ERROR_TIMEOUT). Dispatch on chip type at the initial band-set, mirroring phy_SwBand8812. PHY_SwitchWirelessBand8814A made public for the call. Found via a kernel(aircrack-ng/rtl8814au)-vs-devourer usbmon register diff: devourer's runtime 0xCB0 read 0x77337717 instead of the correct type-1 5G value 0x33173317. On real hardware (RTL8814AU 0bda:8813) 8814 RX at ch100 goes 0 -> 34500 frames; ch6 unaffected (8800 -> 11000, no regression). Addresses #51. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/HalModule.cpp | 16 +++++++++++++--- src/RadioManagementModule.h | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/HalModule.cpp b/src/HalModule.cpp index 9fca03d..a59f219 100644 --- a/src/HalModule.cpp +++ b/src/HalModule.cpp @@ -360,10 +360,20 @@ bool HalModule::rtl8812au_hal_init(uint8_t init_channel) { * deadlocked on libusb_control_transfer until SIGKILL. See kaeru * cite "8821AU ch100 wedge — confirmed second-channel-set is the * trigger, not band-switch 2026-06-02". */ - if (init_channel <= 14) { - _radioManagementModule->PHY_SwitchWirelessBand8812(BandType::BAND_ON_2_4G); + const BandType init_band = (init_channel <= 14) ? BandType::BAND_ON_2_4G + : BandType::BAND_ON_5G; + if (_eepromManager->version_id.ICType == CHIP_8814A) { + /* 8814 has a separate band-switch (path-C/D RFE pinmux via + * phy_SetRFEReg8814A, the 8814 AGC-table register, CCK clock-gate + * cycle). Running the 8812 version here marks the band already-set + * (CCK check 0x454) so phy_SwBand8812's later dispatch SKIPS the 8814A + * switch — leaving the 5G RFE pinmux (0xCB0/.../path-C-D) and RX config + * unprogrammed. Mirror the dispatch in phy_SwBand8812 so the initial + * band-set runs the correct per-chip sequence (issue #51, confirmed via + * kernel-vs-devourer usbmon register diff). */ + _radioManagementModule->PHY_SwitchWirelessBand8814A(init_band); } else { - _radioManagementModule->PHY_SwitchWirelessBand8812(BandType::BAND_ON_5G); + _radioManagementModule->PHY_SwitchWirelessBand8812(init_band); } _radioManagementModule->rtw_hal_set_chnl_bw( diff --git a/src/RadioManagementModule.h b/src/RadioManagementModule.h index 0b69de8..38859b9 100644 --- a/src/RadioManagementModule.h +++ b/src/RadioManagementModule.h @@ -192,6 +192,7 @@ class RadioManagementModule { void rtw_hal_set_chnl_bw(uint8_t channel, ChannelWidth_t Bandwidth, uint8_t Offset40, uint8_t Offset80); void PHY_SwitchWirelessBand8812(BandType Band); + void PHY_SwitchWirelessBand8814A(BandType Band); void SetTxPower(uint8_t p); private: @@ -211,7 +212,6 @@ class RadioManagementModule { void phy_SetRFEReg8812(BandType Band); void phy_SetRFEReg8821(BandType Band); void phy_SetRFEReg8814A(BandType Band); - void PHY_SwitchWirelessBand8814A(BandType Band); void phy_SetBwRegAdc_8814A(BandType Band, ChannelWidth_t bw); void phy_SetBwRegAgc_8814A(BandType Band, ChannelWidth_t bw); void phy_SetBBSwingByBand_8812A(BandType Band);