Release an idle device so a forgotten connect can't hold the shared radio

A client that calls bladerf_connect and never disconnects kept the USB
claim until the server exited, blocking every other tool on the shared
bladeRF. A watchdog thread now releases the device after
MCBLADERF_IDLE_TIMEOUT seconds without a tool call (default 600, 0
disables). Middleware counts tool calls in flight, so a release never
lands mid-call, and it also skips while a capture runs. The RX/TX
settings are saved first; the next device call reconnects and restores
them, sample rate included, since the radio resets that to 4 MHz on
open. bladerf_status reports auto_released in between.

Version 2026.11.15.
This commit is contained in:
2026-11-15 09:36:58 -07:00
parent 382db7f44e
commit 28446c570d
7 changed files with 281 additions and 9 deletions
+1 -1
View File
@@ -122,7 +122,7 @@ Write captures to disk, not `/tmp`. On many Linux systems `/tmp` is a tmpfs held
Gains you leave out keep whatever the device last had, including values set by another process. The radio is often shared, so set all three RX gains explicitly.
While connected, the server holds the USB device and nothing else can open it. The bladeRF-cli backed tools (probe, calibrate, FPGA load, firmware flash, hardware info) release it for the duration and restore the RX/TX settings afterwards. Call `bladerf_disconnect` when you are done so other tools can use the radio.
While connected, the server holds the USB device and nothing else can open it. The bladeRF-cli backed tools (probe, calibrate, FPGA load, firmware flash, hardware info) release it for the duration and restore the RX/TX settings afterwards. Call `bladerf_disconnect` when you are done so other tools can use the radio. If a client forgets, the server releases an idle connection by itself after `MCBLADERF_IDLE_TIMEOUT` seconds with no tool calls (default 600; `0` disables), never during a call or a capture. `bladerf_status` then reports `auto_released`, and the next device call reconnects and restores the RX/TX settings, sample rate included.
## Troubleshooting