Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions demo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@
#include "WiFiDriver.h"

#define USB_VENDOR_ID 0x0bda
#define USB_PRODUCT_ID 0x8812

/* Known USB product IDs for RTL8812AU (2T2R) and RTL8811AU (1T1R, 1x1 cut of
* the same Jaguar silicon). Both are driven by this library. */
static constexpr uint16_t kRealtekProductIds[] = {
0x8812, /* RTL8812AU (also seen on some 8811AU boards) */
0x0811, /* RTL8811AU */
0xa811, /* RTL8811AU */
0xb811, /* RTL8811AU/8821AU variants */
};

static void packetProcessor(const Packet &packet) {}

Expand All @@ -25,11 +33,17 @@ int main() {

libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_DEBUG);

libusb_device_handle *dev_handle =
libusb_open_device_with_vid_pid(ctx, USB_VENDOR_ID, USB_PRODUCT_ID);
libusb_device_handle *dev_handle = nullptr;
for (uint16_t pid : kRealtekProductIds) {
dev_handle = libusb_open_device_with_vid_pid(ctx, USB_VENDOR_ID, pid);
if (dev_handle != NULL) {
logger->info("Opened Realtek device {:04x}:{:04x}", USB_VENDOR_ID, pid);
break;
}
}
if (dev_handle == NULL) {
logger->error("Cannot find device {:04x}:{:04x}", USB_VENDOR_ID,
USB_PRODUCT_ID);
logger->error("Cannot find any supported Realtek device under VID {:04x}",
USB_VENDOR_ID);
libusb_exit(ctx);
return 1;
}
Expand Down
8 changes: 6 additions & 2 deletions src/EepromManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,15 @@ void EepromManager::read_chip_version_8812a(RtlUsbAdapter device) {
.ICType = CHIP_8812,
.ChipType = (value32 & RTL_ID) ? TEST_CHIP : NORMAL_CHIP,
.VendorType = (value32 & VENDOR_ID) ? CHIP_VENDOR_UMC : CHIP_VENDOR_TSMC,
.RFType = RF_TYPE_2T2R, /* RF_2T2R; */
/* SYS_CFG bit 27 (RF_TYPE_ID): set on 1T1R cuts (RTL8811AU),
* clear on 2T2R cuts (RTL8812AU). */
.RFType = (value32 & RF_TYPE_ID) ? RF_TYPE_1T1R : RF_TYPE_2T2R,
};

/* Manual override: force 1T1R even when SYS_CFG reports 2T2R
* (useful if EFUSE/strap is mis-burnt on a 1T1R board). */
if (registry_priv::special_rf_path == 1) {
version_id.RFType = RF_TYPE_1T1R; /* RF_1T1R; */
version_id.RFType = RF_TYPE_1T1R;
}

version_id.CUTVersion = (HAL_CUT_VERSION_E)(((value32 & CHIP_VER_RTL_MASK) >>
Expand Down
Loading