Files
portersky c9ea1a6919 feat: port MT76 radio init and CLI tool
Complete the radio bring-up sequence: init_registers now writes the
upstream register values (PBF out of reset, beacon TX off), crystal
calibration, MAC/BSSID programming, channel evaluation, and beacon
programming through an MCU burst into PBF shared memory. The beacon
txwi is the full 20-byte struct and the RF patch is applied on the
cold firmware path.

Download firmware per product (xone_dongle_02e6.bin / 02fe.bin) and
add the xone_cli debug tool (info, firmware, radio-init/deinit, burst,
reg-read/write, led, recover). Recover uses USBDeviceReEnumerate for a
host-side port reset.

Co-Authored-By: grok4.6: internet search (firmware split, beacon SRAM, upstream issues)
Co-Authored-By: qwen3.8-27b@q2_k_xl: initial radio init and CLI implementation
Co-Authored-By: deepseek/deepseek-v4-pro-0813: final radio init fixes and verification
2026-08-17 19:29:51 +02:00

50 lines
1.2 KiB
C++

#pragma once
// ==============================================================================
// Minimal printf-style logger
// ==============================================================================
// Replaces the kernel's dev_dbg/dev_err from medusalix/xone. Writes to
// stderr; the Swift app layer can redirect or swallow it later.
// ==============================================================================
#include <cstdarg>
#include <cstdio>
namespace xone {
enum class log_level {
debug = 0,
info,
warn,
error,
};
inline auto log_msg(log_level level, char const* fmt, ...) -> void
{
char const* tag = "?";
switch (level) {
case log_level::debug:
tag = "debug";
break;
case log_level::info:
tag = "info";
break;
case log_level::warn:
tag = "warn";
break;
case log_level::error:
tag = "error";
break;
}
std::fprintf(stderr, "[%s] ", tag);
va_list ap;
va_start(ap, fmt);
std::vfprintf(stderr, fmt, ap);
va_end(ap);
std::fprintf(stderr, "\n");
std::fflush(stderr); // The app is often killed; do not lose the tail.
}
} // namespace xone