Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying additional options in --driver-argument results in panic #102

Closed
feuerrot opened this issue Jan 24, 2024 · 3 comments · Fixed by #108
Closed

Specifying additional options in --driver-argument results in panic #102

feuerrot opened this issue Jan 24, 2024 · 3 comments · Fixed by #108
Labels
enhancement New feature or request

Comments

@feuerrot
Copy link

Hi,

I'm trying to run dump1090_rs on a nuc which has multiple rtlsdr connected. AFAICT it should be possible (after using rtl_eeprom to program a different serial number per rtlsdr) to tell SoapySDR which one should be used by appending ,serial=XXXXXXXX to the driver argument.

SoapySDR seems to open the correct device, but dump1090_rs crashes, probably because it tries to lookup some additional options using the full name instead of only rtlsdr?

root@tv ~/src/dump1090_rs (git)-[master] # RUST_BACKTRACE=full cargo run -- --driver 'rtlsdr,serial=00001000'
    Finished dev [unoptimized + debuginfo] target(s) in 0.04s
     Running `target/debug/dump1090_rs --driver rtlsdr,serial=00001000`
[-] using soapysdr driver: driver=rtlsdr,serial=00001000
Found Rafael Micro R820T tuner
Detached kernel driver
Found Rafael Micro R820T tuner
Reattached kernel driver
[INFO] Opening Generic RTL2832U OEM :: 00001000...
Detached kernel driver
Found Rafael Micro R820T tuner
thread 'main' panicked at dump1090_rs/src/main.rs:119:9:
[-] selected --driver gain values not found in custom or default config
[backtrace removed]

I'd guess changing this line to split the options.driver on , before comparing could solve this. I don't know rust but this change seems to work for me:

    let checkdriver = options.driver.split(",").next().unwrap();

    // check if --driver exists in config, with selected driver
    let channel = if let Some(sdr) = config.sdrs.iter().find(|a| a.driver == checkdriver) {
@wcampbell0x2a
Copy link
Member

I might rather split that into --driver-extra, as yes, the --driver is used as the key into to default config.toml.

cargo run -- --driver rtlsdr --driver-extra serial=00001000 --driver-extra other=value. Then these would just be used into soapy.

Thanks for finding this!

@wcampbell0x2a wcampbell0x2a added the enhancement New feature or request label Jan 27, 2024
wcampbell0x2a added a commit that referenced this issue Feb 3, 2024
Add --driver-extra to support SoapySDR Arg options

Closes #102
@wcampbell0x2a
Copy link
Member

@feuerrot I pushed #108 which should fix your issue!

@feuerrot
Copy link
Author

feuerrot commented Feb 5, 2024

@wcampbell0x2a thanks! It works for me:

root@tv ~/src/dump1090_rs (git)-[102-add-driver-extra] # target/release/dump1090_rs --host :: --driver-extra 'serial=00001000'
[-] using soapysdr driver_args: driver=rtlsdr,serial=00001000
usb_claim_interface error -6
Found Rafael Micro R820T tuner
[INFO] Opening Generic RTL2832U OEM :: 00001000...
Found Rafael Micro R820T tuner
[-] using config: Sdr {
    channel: 0,
    driver: "rtlsdr",
    setting: None,
    gain: [
        Gain {
            key: "TUNER",
            value: 49.6,
        },
    ],
    antenna: None,
}
[-] Writing gain: TUNER = 49.6
[-] frequency: Ok(1090000000.0)
[-] sample rate: Ok(2400000.0)
[INFO] Using format CS16.
Allocating 15 zero-copy buffers
*8d04008df82100020049b8146635;
*8d04008d5895b55e5d4ddb4577a5;
*8d04008d99098a24f0ac0cc565d2;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants