From 73bbab393733de621eae9382b41441daf5dccba3 Mon Sep 17 00:00:00 2001 From: Joseph <162703152+josephnef@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:52:24 +0300 Subject: [PATCH 1/2] examples/cellcaps: print the AdapterCaps that gate a cell node (USB or vfio PCIe) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- CMakeLists.txt | 6 ++++++ examples/cellcaps/main.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 examples/cellcaps/main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index dbd274b6..fccabf52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -684,6 +684,12 @@ if(DEVOURER_KESTREL) target_include_directories(kestrelprobe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/examples/common) endif() +# cellcaps — print the AdapterCaps that gate a cell node (USB or, with +# DEVOURER_PCIE, vfio PCIe). examples/common/radio_open.h selects the radio. +add_executable(cellcaps examples/cellcaps/main.cpp examples/common/env_config.cpp) +target_link_libraries(cellcaps PUBLIC devourer PRIVATE PkgConfig::libusb) +target_include_directories(cellcaps PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/examples/common) + # rtl8733bprobe — staged USB bring-up prober for the RTL8733B (HALMAC 87xx), # the pcieprobe/kestrelprobe sibling: identity -> power-on + EFUSE -> firmware # -> MAC/PHY -> TSSI audit stages, used alongside normal factory dispatch. It diff --git a/examples/cellcaps/main.cpp b/examples/cellcaps/main.cpp new file mode 100644 index 00000000..00a9e41f --- /dev/null +++ b/examples/cellcaps/main.cpp @@ -0,0 +1,27 @@ +/* cellcaps — open the radio named in the environment (USB via DEVOURER_VID/ + * PID, or PCIe via DEVOURER_PCIE_BDF) and print the AdapterCaps that decide + * whether it can run a cell node (examples/cell caps_ok), as JSON. Read-only + * beyond the normal bring-up the open path does; no beacon, no TX. */ +#include +#include + +#include "radio_open.h" + +int main() { + auto logger = std::make_shared(); + OpenedRadio radio = open_radio_from_env(logger, 0x0bda, 0); + if (!radio.dev) { + fprintf(stderr, "cellcaps: open failed\n"); + return 1; + } + const auto c = radio.dev->GetAdapterCaps(); + const bool cell_ok = c.tsf_write_ok && c.tbtt_follows_tsf && c.beacon_backoff_ctl && c.hw_beacon_txtsf; + printf("{\"ev\":\"cellcaps\",\"radio\":\"%s\",\"chip\":\"%s\",\"variant\":\"%s\",\"transport\":\"%s\"," + "\"tsf_write_ok\":%d,\"tbtt_follows_tsf\":%d,\"beacon_backoff_ctl\":%d,\"hw_beacon_txtsf\":%d," + "\"ack_responder_ok\":%d,\"hw_rx_timestamp\":%d,\"hw_injected_mgmt_txtsf\":%d," + "\"cell_node_ok\":%d}\n", + radio.label.c_str(), c.chip_name, c.variant, c.transport, c.tsf_write_ok, c.tbtt_follows_tsf, + c.beacon_backoff_ctl, c.hw_beacon_txtsf, c.ack_responder_ok, c.hw_rx_timestamp, + c.hw_injected_mgmt_txtsf, cell_ok ? 1 : 0); + return 0; +} From fc0c3ea202d9f248cda7b90fc63c93626727c826 Mon Sep 17 00:00:00 2001 From: Joseph <162703152+josephnef@users.noreply.github.com> Date: Sat, 14 Nov 2026 20:23:37 +0300 Subject: [PATCH 2/2] cellcaps (review): share the cell-gate predicate; guard the target POSIX-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 --- CMakeLists.txt | 11 +++++++---- examples/cell/main.cpp | 3 ++- examples/cellcaps/main.cpp | 3 ++- examples/common/cell_caps.h | 20 ++++++++++++++++++++ 4 files changed, 31 insertions(+), 6 deletions(-) create mode 100644 examples/common/cell_caps.h diff --git a/CMakeLists.txt b/CMakeLists.txt index fccabf52..2e351e39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -685,10 +685,13 @@ if(DEVOURER_KESTREL) endif() # cellcaps — print the AdapterCaps that gate a cell node (USB or, with -# DEVOURER_PCIE, vfio PCIe). examples/common/radio_open.h selects the radio. -add_executable(cellcaps examples/cellcaps/main.cpp examples/common/env_config.cpp) -target_link_libraries(cellcaps PUBLIC devourer PRIVATE PkgConfig::libusb) -target_include_directories(cellcaps PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/examples/common) +# DEVOURER_PCIE, vfio PCIe). examples/common/radio_open.h selects the radio; +# a POSIX bench tool (libusb + _exit), like the other radio_open probes. +if(NOT WIN32) + add_executable(cellcaps examples/cellcaps/main.cpp examples/common/env_config.cpp) + target_link_libraries(cellcaps PUBLIC devourer PRIVATE PkgConfig::libusb) + target_include_directories(cellcaps PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/examples/common) +endif() # rtl8733bprobe — staged USB bring-up prober for the RTL8733B (HALMAC 87xx), # the pcieprobe/kestrelprobe sibling: identity -> power-on + EFUSE -> firmware diff --git a/examples/cell/main.cpp b/examples/cell/main.cpp index 7a7ceb7e..bc3d53bb 100644 --- a/examples/cell/main.cpp +++ b/examples/cell/main.cpp @@ -273,6 +273,7 @@ #include "cell/LinkAdapt.h" #include "cell/SlotGrid.h" #include "logger.h" +#include "cell_caps.h" #include "radio_open.h" #include "cell/CellScheduler.h" #include "cell/ChannelSwitch.h" @@ -564,7 +565,7 @@ int64_t sleep_until_tsf(IRadio *dev, int64_t target) { bool caps_ok(IRadio *dev) { const auto c = dev->GetAdapterCaps(); - if (!c.tsf_write_ok || !c.tbtt_follows_tsf || !c.beacon_backoff_ctl || !c.hw_beacon_txtsf) { + if (!devourer::cell_node_caps_ok(c)) { fprintf(stderr, "this radio cannot run a cell node (tsf_write_ok=%d tbtt_follows_tsf=%d " "beacon_backoff_ctl=%d hw_beacon_txtsf=%d)\n", c.tsf_write_ok, c.tbtt_follows_tsf, c.beacon_backoff_ctl, c.hw_beacon_txtsf); diff --git a/examples/cellcaps/main.cpp b/examples/cellcaps/main.cpp index 00a9e41f..37c8e3b7 100644 --- a/examples/cellcaps/main.cpp +++ b/examples/cellcaps/main.cpp @@ -5,6 +5,7 @@ #include #include +#include "cell_caps.h" #include "radio_open.h" int main() { @@ -15,7 +16,7 @@ int main() { return 1; } const auto c = radio.dev->GetAdapterCaps(); - const bool cell_ok = c.tsf_write_ok && c.tbtt_follows_tsf && c.beacon_backoff_ctl && c.hw_beacon_txtsf; + const bool cell_ok = devourer::cell_node_caps_ok(c); printf("{\"ev\":\"cellcaps\",\"radio\":\"%s\",\"chip\":\"%s\",\"variant\":\"%s\",\"transport\":\"%s\"," "\"tsf_write_ok\":%d,\"tbtt_follows_tsf\":%d,\"beacon_backoff_ctl\":%d,\"hw_beacon_txtsf\":%d," "\"ack_responder_ok\":%d,\"hw_rx_timestamp\":%d,\"hw_injected_mgmt_txtsf\":%d," diff --git a/examples/common/cell_caps.h b/examples/common/cell_caps.h new file mode 100644 index 00000000..e85514ed --- /dev/null +++ b/examples/common/cell_caps.h @@ -0,0 +1,20 @@ +// cell_caps.h — the single source of truth for which AdapterCaps a radio +// needs to run an examples/cell node (a DU or a UE): write its TSF, have the +// beacon TBTT follow that TSF, control the beacon-queue backoff, and stamp the +// live TSF into the beacon at TX. Both examples/cell (caps_ok) and the +// examples/cellcaps probe use this, so the probe's verdict cannot drift from +// the gate the cell node actually applies. +#ifndef DEVOURER_EXAMPLES_CELL_CAPS_H +#define DEVOURER_EXAMPLES_CELL_CAPS_H + +#include "AdapterCaps.h" + +namespace devourer { + +inline bool cell_node_caps_ok(const AdapterCaps &c) { + return c.tsf_write_ok && c.tbtt_follows_tsf && c.beacon_backoff_ctl && c.hw_beacon_txtsf; +} + +} // namespace devourer + +#endif // DEVOURER_EXAMPLES_CELL_CAPS_H