rsadsb / dump1090_rs

Multi-SDR supported Rust translation of the popular dump1090 project for ADS-B demodulation
GNU General Public License v2.0
104 stars 8 forks source link

SoapySDR remotes aren't matching #27

Closed akhepcat closed 2 years ago

akhepcat commented 2 years ago

I'm unable to select a remote device using SoapySDR's driver syntax, even thought SoapySDRUtil can find it:

$ SoapySDRUtil --find="driver=remote, remote=192.168.1.184, remote:driver=rtlsdr"
######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Found device 0
  available = Yes
  driver = remote
  label = Generic RTL2832U OEM :: 
  manufacturer = Realtek
  product = RTL2838UHIDIR
  remote = tcp://192.168.1.184:55132
  remote:driver = rtlsdr
  rtl = 0
  serial = 
  tuner = Elonics E4000

$ dump1090 --driver "driver=remote, remote=192.168.1.184, remote:driver=rtlsdr"
[-] using driver: driver=remote, remote=192.168.1.184, remote:driver=rtlsdr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: Other, message: "SoapySDR::Device::make() no match" }', dump1090_rs/src/main.rs:81:75
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

There aren't any examples, really for doing this type of connectivity with the code, but it seems like it should work as other applications (CubicSDR, for example) can use the same remote sdr source just fine. It's most likely something to do with the driver selection in the command line, but without any good docks here, i'm just trying various combinations and still getting nowhere.

wcampbell0x2a commented 2 years ago

Is this using https://github.com/pothosware/SoapyRemote? I'll add support for this.

wcampbell0x2a commented 2 years ago

Thanks for showing me SoapyRemote, pretty cool application.

Maye I need to make it clearer, but this is already supported and it works on my machine. The --driver already has the driver= by default, so removing the driver= makes this work perfectly.

dump1090 --driver "remote, remote=localhost, remote:driver=rtlsdr"

I'll close this issue, let me know if this doesn't work for you.

wcampbell0x2a commented 2 years ago

A minor point. you would need the following in a config file:

# rtlsdr
[[sdrs]]
driver = "remote, remote=localhost, remote:driver=rtlsdr"

[[sdrs.gain]]
key = "TUNER"
value = 49.6
akhepcat commented 2 years ago

Sorry was on a plane yesterday, but this still doesn't work here.

$ ping -w 1 -c 1 192.168.1.184 PING 192.168.1.184 (192.168.1.184) 56(84) bytes of data. 64 bytes from 192.168.1.184: icmp_seq=1 ttl=64 time=0.192 ms

--- 192.168.1.184 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.192/0.192/0.192/0.000 ms

$ dump1090 --driver "remote, remote=192.168.1.184, remote:driver=rtlsdr" [-] using driver: remote, remote=192.168.1.184, remote:driver=rtlsdr thread 'main' panicked at 'called Result::unwrap() on an Err value: Error { code: Other, message: "SoapySDR::Device::make() no match" }', dump1090_rs/src/main.rs:81:75 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

And this is after doing a fresh git pull just now.

and yes:

/usr/lib/x86_64-linux-gnu/SoapySDR/modules0.7/libremoteSupport.so

works fine with CubicSDR

$ SoapySDRUtil --check=remote ###################################################### ## Soapy SDR -- the SDR abstraction library ## ######################################################

Loading modules... done Checking driver 'remote'... PRESENT

SoapySDRUtil --make="driver=remote" ###################################################### ## Soapy SDR -- the SDR abstraction library ## ######################################################

Make device driver=remote driver=RTLSDR hardware=E4000 origin=https://github.com/pothosware/SoapyRTLSDR remote:version=0.5.2-unknown rtl=0

$ echo $? 0

$ SoapySDRUtil --probe="driver=remote" ###################################################### ## Soapy SDR -- the SDR abstraction library ## ######################################################

Probe device driver=remote

---------------------------------------------------- -- Device identification ---------------------------------------------------- driver=RTLSDR hardware=E4000 origin=https://github.com/pothosware/SoapyRTLSDR remote:version=0.5.2-unknown rtl=0

---------------------------------------------------- -- Peripheral summary ---------------------------------------------------- Channels: 1 Rx, 0 Tx Timestamps: NO Other Settings:

---------------------------------------------------- -- RX Channel 0 ---------------------------------------------------- Full-duplex: YES Supports AGC: YES Stream formats: CS8, CS16, CF32 Native format: CS8 [full-scale=128] Stream args:

wcampbell0x2a commented 2 years ago

Here are all the commands, I haven't tried on a non-localhost so maybe that's the issue?

> SoapySDRServer --bind --driver=rtlsdr
######################################################
## Soapy Server -- Use any Soapy SDR remotely
######################################################

Server version: 0.5.2-unknown
Server UUID: efb5b6c8-f121-16e8-8567-9390a8c0372a
Launching the server... tcp://[::]:55132
Server bound to [::]:55132
Launching discovery server...
Connecting to DNS-SD daemon...
[INFO] Avahi version:  (null)
[INFO] Avahi hostname: (null)
[INFO] Avahi domain:   (null)
[INFO] Avahi FQDN:     (null)
[ERROR] avahi_entry_group_new() failed
Press Ctrl+C to stop the server
> cargo run --release -- --driver="remote, remote=localhost, remote:driver=rtlsdr"
[-] using soapysdr driver: driver=remote, remote=localhost, remote:driver=rtlsdr
[INFO] Opening Generic RTL2832U OEM :: 00000001...
[-] frequency: Ok(1090000000.0)
[-] sample rate: Ok(2400000.0)
[-] available gains: ["TUNER"]
[ Unrelated config error ]
[INFO] SoapyRemote::setupRxStream(remoteFormat=CS8, localFormat=CS16, scaleFactor=128, mtu=1500, window=44040192)
[INFO] Client side stream bound to [::1]:43472
[INFO] Client side status bound to [::1]:42650
[INFO] Using format CS8.
[INFO] Server side stream bound to [::1]:50099
[INFO] Server side stream connected to [::1]:43472
[INFO] Server side status connected to [::1]:42650
[INFO] Configured sender endpoint: dgram=1452 bytes, 714 elements @ 2 bytes, window=43008 KiB
[INFO] Client side stream connected to [::1]:50099
[WARNING] Set thread priority 0.5 failed: Operation not permitted
[INFO] Configured receiver endpoint: dgram=1452 bytes, 714 elements @ 2 bytes, window=43008 KiB
*8da38dd89909332ff0082df596f6;
*8da38dd89909332ff0082df596f6;
*5da1928cc4d669abbc609a692b63;
*8da88e295995a5d5812324a830fe;
*8da5fc87587365fdccec3017868c;
*8da5fc879989162ba06c22385579;
*8da40b1258dd0244bc7c2ab475cf;
akhepcat commented 2 years ago

Yes - i have the server running on the remote host, and the local host is able to see it and bind to it using SoapySDRUtil, as shown in my comment.

I'm unfortunately not in the same state as the remote, so I can't move it between hosts. But the "SDR server" and the "dump1090 host" are on the same local segment with no firewalling, so it does seem that it's an issue with non-local connections.

akhepcat commented 2 years ago

Not sure if this is useful:

$ RUST_BACKTRACE=1 target/debug/dump1090_rs  --driver "remote, remote=tcp://192.168.1.184:55132, remote:driver=rtlsdr" 
[-] processing default config
[-] using soapysdr driver: driver=remote, remote=tcp://192.168.1.184:55132, remote:driver=rtlsdr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error { code: Other, message: "SoapySDR::Device::make() no match" }', dump1090_rs/src/main.rs:85:45
stack backtrace:
   0: rust_begin_unwind
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
   2: core::result::unwrap_failed
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/result.rs:1613:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/result.rs:1295:23
   4: dump1090_rs::main
             at ./dump1090_rs/src/main.rs:85:13
   5: core::ops::function::FnOnce::call_once
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/ops/function.rs:227:5
$ SoapySDRUtil --find="driver=remote"
######################################################
##     Soapy SDR -- the SDR abstraction library     ##
######################################################

Found device 0
  available = Yes
  driver = remote
  label = Generic RTL2832U OEM :: 
  manufacturer = Realtek
  product = RTL2838UHIDIR
  remote = tcp://192.168.1.184:55132
  remote:driver = rtlsdr
  rtl = 0
  serial = 
  tuner = Elonics E4000
jfath commented 2 years ago

I think my build is working with soapyremote-server on a remote system:

me@mysystem-3700x:~/src/dump1090_rs$ target/release/dump1090_rs --driver "remote, remote=tcp://192.168.223.89:55132, remote:driver=airspy" --custom-config xu4radio.toml [-] read in custom config: xu4radio.toml [-] using soapysdr driver: driver=remote, remote=tcp://192.168.223.89:55132, remote:driver=airspy [-] using config: Sdr { channel: 0, driver: "remote, remote=tcp://192.168.223.89:55132, remote:driver=airspy", setting: None, gain: [ Gain { key: "TUNER", value: 40.0, }, ], antenna: None, } [-] Writing gain: TUNER = 40 [-] frequency: Ok(1090000000.0) [-] sample rate: Ok(2400000.0) [INFO] SoapyRemote::setupRxStream(remoteFormat=CS16, localFormat=CS16, scaleFactor=32767, mtu=1500, window=44040192) [INFO] Client side stream bound to 192.168.222.39:37461 [INFO] Client side status bound to 192.168.222.39:51581 [INFO] Using format CS16.

[WARNING] StreamEndpoint resize socket buffer: set 43008 KiB, got 176 KiB [INFO] Configured sender endpoint: dgram=1452 bytes, 357 elements @ 4 bytes, window=176 KiB [INFO] Client side stream connected to 192.168.223.89:43966 [WARNING] StreamEndpoint resize socket buffer: set 43008 KiB, got 208 KiB [INFO] Configured receiver endpoint: dgram=1452 bytes, 357 elements @ 4 bytes, window=208 KiB SSSSSSSSOSSS ...

akhepcat commented 2 years ago

Ah, I see now, i'm using the wrong "driver" :

dump1090_rs$ target/release/dump1090_rs --driver "remote, remote=tcp://192.168.1.184:55132, remote:driver=rtlsdr"

[-] using soapysdr driver: driver=remote, remote=tcp://192.168.1.184:55132, remote:driver=rtlsdr
[-] frequency: Ok(1090000000.0)
[-] sample rate: Ok(2400000.0)
[-] available gains: ["IF1", "IF2", "IF3", "IF4", "IF5", "IF6", "TUNER"]
[!] driver=remote, remote=tcp://192.168.1.184:55132, remote:driver=rtlsdr not found in config, not setting sdr config settings
[INFO] SoapyRemote::setupRxStream(remoteFormat=CS8, localFormat=CS16, scaleFactor=128, mtu=1500, window=44040192)
[INFO] Client side stream bound to 192.168.1.4:45566
[INFO] Client side status bound to 192.168.1.4:38034
[INFO] Using format CS8.
[INFO] Server side stream bound to [::ffff:192.168.1.184]:55871
[INFO] Server side stream connected to [::ffff:192.168.1.4]:45566
[INFO] Server side status connected to [::ffff:192.168.1.4]:38034
[WARNING] StreamEndpoint resize socket buffer: set 43008 KiB, got 176 KiB
[INFO] Configured sender endpoint: dgram=1452 bytes, 714 elements @ 2 bytes, window=176 KiB
[INFO] Client side stream connected to 192.168.1.184:55871
[INFO] Configured receiver endpoint: dgram=1452 bytes, 714 elements @ 2 bytes, window=43008 KiB
*8da0000c592a840fad8731c56728;
*5dac30cdb7c960cd438aa6bf3784;
*8dac30cd9908ad8400580bc6d8c4;
*5da0000ccbd7ccb72937a8c8b662;
*8dac30cdf8200002004ab88865ec;
*8da0000c9910030d6804043b6611;

So, it's just the syntax. Time to update the documentation to make this a bit more obvious.

Thanks, @jfath for the validation and hint toward my actual issue.