Specifying additional options in `--driver`-argument results in panic
enhancement
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](https://github.com/rsadsb/dump1090_rs/blob/master/dump1090_rs/src/main.rs#L85) 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) {
```
关闭于 2024-02-10 3 条评论