Skip to content

MT7612U integration: wire src/mt7612u in behind IRadio #419

Description

@josephnef

Tracks the integration of the MediaTek MT7612U subtree (src/mt7612u/, landed unwired in #412 and hardened in #414) behind the vendor-neutral radio contract from #415. Until this lands the subtree builds only through its own Makefile and no devourer binary can open an MT7612U.

Scope

  • CMake: DEVOURER_MT7612U option (default OFF), following the DEVOURER_HAVE_* pattern; the subtree's pthread/nanosleep/clock_gettime swap to <thread>/<chrono> so MSVC and mingw build it (Windows is first-class here).
  • Factory: a vendor-neutral VID:PID gate in WiFiDriver::CreateRadio ahead of the Realtek SYS_CFG2 read, the way Kestrel gates PID-first — on MediaTek silicon that read is the wrong protocol, not merely ambiguous. An unrecognised non-Realtek VID must refuse rather than fall through to Jaguar1. ChipGeneration entry for MediaTek.
  • Transport: MediaTek gets its own transport behind the same factory, not a shim over ITransport (32-bit registers plus in-band MCU over EP8/EP5 do not fit the Realtek shape). The C library is the transport; adopt the handle WiFiDriver already opened, reset and claimed via mt7612u_open_handle().
  • IRadio implementation over the C library: Init/InitWrite/StartRxLoop/SetMonitorChannel/send_packet(+send_packets)/GetSelectedChannel/SetCcaMode (implement or refuse loudly), caps, ACK responder, TSF, link quality. Unsupported optional members keep the not-ported defaults; unavailable measurements report invalid, never fabricated IGI/NHM values.
  • The 1 Hz PHY tick lives inside the backend, on a backend-owned worker thread (the Jaguar3 phydm-thread shape), not as an IRadio method. Stop/join it before teardown; serialize whole channel-change / power operations against it (the recursive io_lock protects nested transactions, not a full channel change); never run calibration from an RX completion callback.
  • RX-loop stop semantics: StopRxLoop() must not map onto mt7612u_rx_stop() — that cancels both rings without disabling MAC RX first. Preserve disable-RX-before-removing-the-drain and shared ring ownership so RX is restartable.
  • FCS contract: Packet::Data promises a trailing FCS; the MT7612U MAC strips it and the 4–7 trailing bytes are the FCE info trailer, not a CRC. Add explicit FCS-presence metadata to the RX type and make it reach every consumer that trims four bytes before the factory dispatches to MediaTek.
  • RSSI units: devourer carries RSSI as an unsigned byte biased by 110; the C library reports signed dBm. Convert at the boundary (a raw cast reported −63 dBm as +83).
  • Firmware: the library loads mt7662.bin / mt7662_rom_patch.bin from a directory at runtime; every Realtek backend embeds its blob. Decide embed-vs-runtime-path and plumb the choice through DeviceConfig (no environment reads in the library). MT7612U_DEV selection likewise moves to a config field / open-with-selector.
  • Logging: route the subtree's stderr diagnostics through devourer's Logger (a sink hook on the C library); JSONL events for adapter.caps and the RX/TX planes as the demos expect.
  • Validation: regress.py cell against the MediaTek vendor driver under reference/; ctest cells; mt7612uprobe beside kestrelprobe/rtl8733bprobe; on-air TX and RX figures on the same bench as the Realtek table in the README, with the adversarial counterpart stated in the same breath.

Follow-ups that fall out of it (separate issues if they grow)

Known limits of the part, so nobody expects them

No fast retune (≈50 ms fast / ≈530 ms full — FHSS and per-packet hopping are out of reach), no 5/10 MHz narrowband (no encoding in MT_RATE_BW), no HE, no 160 MHz, no beacons/TBTT, unicast injection is a 40× cliff (address one-way links to broadcast/multicast). Measured record: docs/mt7612u.md.

Refs: #412, #414, #415.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions