Repository navigation
soapy: fix SDRplay RSP1B gain (stream fails to start; gain runs backwards) - #331
CharlesBaud wants to merge 1 commit into
Conversation
…ards) SoapySDRPlay3 exposes IFGR (IF gain reduction, 20..59 dB) and RFGR (LNA state, higher = more attenuation) as gain elements. Both are reductions, so SoapySDR's generic total gain runs backwards: dump1090's default (maximum) gain is the least gain, and adaptive gain steps the wrong way. The module also reports RFGR 0..9 for the RSP1B, but at 1090 MHz (L-band) it has 9 LNA states, 0..8; LNA state 9 makes sdrplay_api_Init() fail, so dump1090 did not start with its default gain. For the SDRplay models in sdrplay_models[] (only the RSP1B, the one tested), dump1090 now maps its own total gain onto the two elements: the gain below the maximum comes off IFGR first, then off the LNA, never above the highest L-band LNA state. Default gain is now IFGR 20, RFGR 0. The RSP1A, RSPduo and RSPdx are listed commented out, with their L-band LNA state counts from the SDRplay API 3.15 headers. Other devices are unchanged. Tested on an RSP1B (Raspberry Pi 5, SDRplay API 3.15): the stream starts with the default gain, the noise floor rises with --gain, and adaptive gain steps upwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I see you filled the generative AI part of the checklist in the PR summary but left it commented out, is that part completed / can be uncommented? |
|
Yes sorry |
|
Hm, both of these seem to be bugs in the sdrplay driver; can we try to get them fixed in the driver, rather than baking lots of hardware-specific knowledge into dump1090? e.g. I would expect the same problem to appear in dump978, and we don't really want to fix it in N different places. specifically I think it's reasonable for a soapysdr client to assume that:
.. mostly because soapysdr is an abstraction layer and the client can't be expected to know the quirks of every device in detail. Currently it sounds like the sdrplay driver does none of these. the bare minimum would be to support (1) (and by analogy, the per-element settings for attenuator stages should probably deal in terms of negative gain..) |
|
Yes its really whether you can get that change - trouble is will then break their compatibility and their documented API. So I think they will resist that. The only nasty bug in their driver it if you do send an illegal gain the driver does not work again. That's why it seemed better to go with the quirk method. The gain in their driver goes the wrong way both for RF and IF its attenuation so it positive feedback rather than negative. I leave this one I just bring to your attention. |
PR checklist
dev(notmaster)Tools and affected parts. The change to
sdr_soapy.c(the wholecommit) was written with Claude Code (Anthropic, Claude Opus models) to my
specification: the diagnosis, the IFGR/RFGR gain mapping, the
sdrplay_models[]table and the commit message. I chose the approach (only the RSP1B enabled,
the other models listed but commented out until someone can test them) and
reviewed and tested every line. The commit carries a
Co-Authored-By: Claudetrailer.
DCO. I wrote the specification, reviewed the code, tested it on my
own hardware and submit it under the project's licence. I have the right to
submit it and certify the DCO for it as my contribution (
Signed-off-byon thecommit).
Reproduction (before this change). SDRplay RSP1B, SoapySDR with
SoapySDRPlay3, SDRplay API 3.15, Raspberry Pi 5:
dump1090 --device-type soapy --device driver=sdrplayRSP1B has 9 L-band states (0..8),
sdrplay_api_Init()fails and thestream doesn't start.
--gain, it starts, but IFGR and RFGR are reductions, so thetotal gain runs backwards: a higher
--gaingives less gain, and adaptivegain steps the wrong way.
Testing. After the change, on the same setup (15 s run, stock decoder):
The noise floor rises with
--gain, and adaptive gain steps upwards. Theexisting 5 MHz SDRplay bandwidth default was confirmed live: 5, 7 and 8 MHz
decoded within 1% of each other and 6 MHz within noise; 1.536 MHz decoded
about 40% as many messages. Builds with no warnings with every SDR driver
enabled.