mirror of
https://github.com/smittix/intercept.git
synced 2026-07-19 06:48:11 -07:00
Add device reservation to DMR mode and improve USB busy error message
DMR was missing checkDeviceAvailability/reserveDevice/releaseDevice calls that other modes (SSTV, listening post) use, so the device dropdown showed device 0 as available even when another process held it. Also detect USB claim errors from rtl_fm and surface a clear message telling the user to pick a different device. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
+7
-4
@@ -334,11 +334,14 @@ def start_dmr() -> Response:
|
||||
if dmr_active_device is not None:
|
||||
app_module.release_sdr_device(dmr_active_device)
|
||||
dmr_active_device = None
|
||||
# Surface the most relevant error to the user
|
||||
# Surface a clear error to the user
|
||||
detail = rtl_err.strip() or dsd_err.strip()
|
||||
msg = 'Failed to start DSD pipeline'
|
||||
if detail:
|
||||
msg += f': {detail}'
|
||||
if 'usb_claim_interface' in rtl_err or 'Failed to open' in rtl_err:
|
||||
msg = f'SDR device {device} is busy — it may be in use by another mode or process. Try a different device.'
|
||||
elif detail:
|
||||
msg = f'Failed to start DSD pipeline: {detail}'
|
||||
else:
|
||||
msg = 'Failed to start DSD pipeline'
|
||||
return jsonify({'status': 'error', 'message': msg}), 500
|
||||
|
||||
# Drain rtl_fm stderr in background to prevent pipe blocking
|
||||
|
||||
Reference in New Issue
Block a user