Skip to main content

Dongles on the Host

I know, I know, never touch the PM host, BUT I have been having all sorts of problems getting RTL_anything to work well in containers, let alone a VM for some damn reason. That said, I opted to just let the sticks live on the host, and TCP them for the containers to use.

What I did was get a powered USB hub and slap the sticks on there. Blacklisted the RTL stuff on the host (modprobe) and rebooted everything. 

With that, I installed rtl_sdr on the host, and it showed my sticks just fine - I was able to eeprom them to ID them easier, so the manufacturer and product name now are SDR-0X and the serial is the number of the stick, like 11111111 and 22222222, etc.

I opted to set up a systemd serivce to have it run on boot, and allow me to start stop the sticks as needed. 

/etc/systemd/system/[email protected]

# /etc/systemd/system/[email protected]
[Unit]
Description=rtl_tcp instance on port %i
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
EnvironmentFile=-/etc/default/rtl_tcp
ExecStart=/usr/bin/rtl_tcp -a 0.0.0.0 -p %i -s 2400000 -g 36 -d ${SERIAL_%i}
Restart=always
RestartSec=2

[Install]
WantedBy=multi-user.target

/etc/default/rtl_tcp

SERIAL_2222=22222222
SERIAL_6666=66666666
SERIAL_7777=77777777
SERIAL_8888=88888888

After getting those files created, reload with systemctl daemon-reload and then enable what you want (as needed)

systemctl daemon-reload

Enable, Start and Stop

You can enable them all at once, or one by one, up to you

systemctl enable rtl_tcp@2222 rtl_tcp@6666 rtl_tcp@7777 rtl_tcp@8888

Once enabled, start them all or one by one

systemctl start  rtl_tcp@2222 rtl_tcp@6666 rtl_tcp@7777 rtl_tcp@8888

Check it out

ss -lntp | grep rtl_tcp

Run a smoke check from any container/VM or even the host itself (just change the IP to the host, if you are checking from another container). You should see something like listening on [::]:7777

rtl_tcp -a 127.0.0.1 -p 7777

Services

Now that the host is serving the sticks, in your services (containers, VMs, whatever), you can now connect to the enabled sticks by pointing it at the host's IP and port for the individual stick you want to use

dsd-neo

This is an example launch command for dsd-neo in another container:

/opt/dsd-neo/app/usr/bin/dsd-neo \
  -v 4 \
  -i rtltcp:<HOST_IP>:2222:461.725M \
  -G /opt/dsd-neo/config/sn-groups.csv \
  -K /opt/dsd-neo/config/keys.csv \
  --auto-ppm --auto-ppm-snr 3 \
  -7 /opt/dsd-neo/logs/sn_calls \
  -P -N -Z -agc -o null