Skip to content

examples/cellcaps: print the AdapterCaps that gate a cell node - #580

Merged
josephnef merged 2 commits into
masterfrom
tool/cellcaps-probe
Nov 14, 2026
Merged

josephnef merged 2 commits into
masterfrom
tool/cellcaps-probe

Conversation

@josephnef

Copy link
Copy Markdown
Collaborator

A small read-only diagnostic that answers "can this radio run a cell node?" for any USB or PCIe radio, the probe used to characterise the Kestrel caps in #579.

What

examples/cellcaps opens the radio named in the environment and prints, as one JSON line, the caps that examples/cell caps_ok checks — plus the ACK-responder and timestamp caps and a cell_node_ok verdict:

DEVOURER_VID=0x0bda DEVOURER_PID=0xc85a build/cellcaps      # USB
DEVOURER_PCIE_BDF=0000:85:00.0        build/cellcaps        # vfio PCIe (-DDEVOURER_PCIE=ON)
{"ev":"cellcaps","radio":"usb 0bda:c85a","chip":"RTL8852C","variant":"C8852C","transport":"usb",
 "tsf_write_ok":0,"tbtt_follows_tsf":0,"beacon_backoff_ctl":1,"hw_beacon_txtsf":1,
 "ack_responder_ok":1,"hw_rx_timestamp":1,"hw_injected_mgmt_txtsf":1,"cell_node_ok":0}

It reuses examples/common/radio_open.h, so the one binary serves both transports, and does nothing beyond the normal open path — no beacon, no TX.

Why

caps_ok only prints its four gate caps on failure, and only from inside the cell node. When qualifying a new radio or bus for a cell role (e.g. the USB-Kestrel question in #579, or the moving-UE node in #563) it's useful to read the full cell-gate verdict directly, without standing up a DU/UE. This is the probe that produced the hardware readout in #579.

Notes

  • Guarded like the other radio_open probes; the PCIe path compiles only under -DDEVOURER_PCIE=ON (via DEVOURER_HAVE_PCIE).
  • No behaviour change to any shipping path; new target only.

Refs #579.

🤖 Generated with Claude Code

…r vfio PCIe)

A small read-only probe: opens the radio named in the environment
(DEVOURER_VID/PID or DEVOURER_PCIE_BDF) and prints, as JSON, the caps
examples/cell caps_ok checks (tsf_write_ok, tbtt_follows_tsf,
beacon_backoff_ctl, hw_beacon_txtsf) plus ack_responder_ok and the
timestamp caps, with a cell_node_ok verdict. Used to confirm on hardware
that a USB 8852CU reports cell_node_ok=0 (TSF-write/TBTT refused over
USB) while the same die over PCIe passes — see #579.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Add a USB and PCIe cell-capability probe

✨ Enhancement 🕐 Less than 10 minutes

Grey Divider

AI Description

• Add a read-only probe for checking whether an opened radio meets the cell-node capability gates.
• Print radio identity, relevant capabilities, and a cell-node verdict as one JSON line.
• Build the probe for USB and, when enabled, vfio PCIe without changing existing radio paths.
Diagram

graph TD
  Env["Radio environment"] --> Open["Shared radio open"] --> Caps["Adapter caps"] --> Gate{"Cell gates pass?"} -->|yes| Output["JSON verdict"]
  Gate -->|no| Output
Loading
High-Level Assessment

A standalone probe is appropriate: it reuses the existing cross-transport open helper and exposes the cell-specific verdict without coupling the diagnostic to the cell executable. Reusing the broader adapter-capability event was considered, but it does not provide this verdict or the focused output.

Files changed (2) +33 / -0

Enhancement (1) +27 / -0
main.cppReport cell-node capability gates as JSON +27/-0

Report cell-node capability gates as JSON

• Opens the environment-selected radio and reports its identity, four cell-node gate capabilities, ACK-responder and timestamp capabilities, and a derived cell_node_ok verdict. Returns an error if opening the radio fails; it does not beacon or transmit.

examples/cellcaps/main.cpp

Other (1) +6 / -0
CMakeLists.txtBuild the cellcaps diagnostic executable +6/-0

Build the cellcaps diagnostic executable

• Adds a cellcaps target with the shared environment configuration, devourer and libusb links, and access to the common radio-opening header. PCIe support follows the existing build configuration.

CMakeLists.txt

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Informational

1. Probe builds on Windows despite POSIX-only convention ✓ Resolved
Description
The cellcaps add_executable is declared unconditionally in CMakeLists.txt, while every other
radio_open.h-based probe sits under if(NOT WIN32) (the m0probe loop and the 1687/1711 blocks), and
the file's own comment there says these bench tools are POSIX-only. On a Windows configure the new
target is therefore built anyway, which can fail the build or ship a tool that the surrounding
convention says should not exist there.

2. Probe's cell verdict can drift from caps_ok ✓ Resolved
Description
cell_ok in the probe re-implements the four-cap conjunction from caps_ok in
examples/cell/main.cpp instead of sharing it, so the JSON cell_node_ok verdict is a copy. If the
gate in examples/cell changes (a fifth cap, or a transport-specific rule), the probe will keep
reporting the old verdict and the hardware readouts used in #579 will silently stop matching what
the cell node enforces.

Grey Divider

Tip of the day
💡 Did you know, you can ask Qodo to dismiss a finding you disagree with, with your reason on record

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

…SIX-only

- examples/common/cell_caps.h holds cell_node_caps_ok(AdapterCaps): the
  single source of truth for the caps a cell node needs. Both examples/cell
  caps_ok and the cellcaps probe call it, so the probe's cell_node_ok
  verdict cannot drift from the gate the cell node applies.
- The cellcaps target is guarded if(NOT WIN32), like the other radio_open
  bench probes (libusb + POSIX _exit).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@josephnef

Copy link
Copy Markdown
Collaborator Author

Both fixed in fc0c3ea2:

  1. POSIX-only. The cellcaps target is now wrapped in if(NOT WIN32), like the other radio_open bench probes (libusb + _exit).
  2. Verdict drift. Factored the cell-gate predicate into examples/common/cell_caps.h (cell_node_caps_ok(const AdapterCaps&)). Both examples/cell caps_ok and the cellcaps probe call it now, so the probe's cell_node_ok can't drift from the gate the cell node actually applies. ctest 95/95.

@josephnef josephnef added skip-qodo-gate Bypass the Qodo review gate (outage / maintainer decision) and removed skip-qodo-gate Bypass the Qodo review gate (outage / maintainer decision) labels Nov 14, 2026
@josephnef
josephnef merged commit 3855c89 into master Nov 14, 2026
31 of 33 checks passed
@josephnef
josephnef deleted the tool/cellcaps-probe branch November 14, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-qodo-gate Bypass the Qodo review gate (outage / maintainer decision)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant