Skip to content

Commit

Permalink
Merge pull request #28 from sdr-enthusiasts/remove-auto-detection
Browse files Browse the repository at this point in the history
Remove auto detection
  • Loading branch information
fredclausen authored Dec 31, 2023
2 parents e8db521 + 972cc76 commit a547b2c
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 106 deletions.
50 changes: 50 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,28 @@ RUN set -x && \
KEPT_PACKAGES+=(libglib2.0-0) && \
TEMP_PACKAGES+=(libzmq3-dev) && \
KEPT_PACKAGES+=(libzmq5) && \
TEMP_PACKAGES+=(libusb-1.0-0-dev) && \
KEPT_PACKAGES+=(libusb-1.0-0) && \
# install packages
apt-get update && \
apt-get install -y --no-install-recommends \
"${KEPT_PACKAGES[@]}" \
"${TEMP_PACKAGES[@]}"\
&& \
# install sdrplay
curl --location --output /tmp/install_sdrplay.sh https://raw.githubusercontent.com/sdr-enthusiasts/install-libsdrplay/main/install_sdrplay.sh && \
chmod +x /tmp/install_sdrplay.sh && \
/tmp/install_sdrplay.sh && \
# deploy airspyone host
git clone https://github.com/airspy/airspyone_host.git /src/airspyone_host && \
pushd /src/airspyone_host && \
mkdir -p /src/airspyone_host/build && \
pushd /src/airspyone_host/build && \
cmake ../ -DINSTALL_UDEV_RULES=ON && \
make && \
make install && \
ldconfig && \
popd && popd && \
# Deploy SoapySDR
git clone https://github.com/pothosware/SoapySDR.git /src/SoapySDR && \
pushd /src/SoapySDR && \
Expand All @@ -60,6 +76,40 @@ RUN set -x && \
make install && \
popd && popd && \
ldconfig && \
# Deploy SoapyRTLSDR
git clone https://github.com/pothosware/SoapyRTLSDR.git /src/SoapyRTLSDR && \
pushd /src/SoapyRTLSDR && \
BRANCH_SOAPYRTLSDR=$(git tag --sort="creatordate" | tail -1) && \
git checkout "$BRANCH_SOAPYRTLSDR" && \
mkdir -p /src/SoapyRTLSDR/build && \
pushd /src/SoapyRTLSDR/build && \
cmake ../ -DCMAKE_BUILD_TYPE=Debug && \
make all && \
make install && \
popd && popd && \
ldconfig && \
# install sdrplay support for soapy
git clone https://github.com/pothosware/SoapySDRPlay.git /src/SoapySDRPlay && \
pushd /src/SoapySDRPlay && \
mkdir build && \
pushd build && \
cmake .. && \
make && \
make install && \
popd && \
popd && \
ldconfig && \
# Deploy Airspy
git clone https://github.com/pothosware/SoapyAirspy.git /src/SoapyAirspy && \
pushd /src/SoapyAirspy && \
mkdir build && \
pushd build && \
cmake .. && \
make && \
make install && \
popd && \
popd && \
ldconfig && \
# Install dumpvdl2
git clone https://github.com/szpajder/dumpvdl2.git /src/dumpvdl2 && \
mkdir -p /src/dumpvdl2/build && \
Expand Down
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Docker container for running [dumpvdl2](https://github.com/szpajder/dumpvdl2) and forwarding the received JSON messages to another system or docker container. Best used alongside [ACARS Hub](https://github.com/fredclausen/acarshub).

Builds and runs on `amd64`, `arm64`, `arm/v7`, `arm/v6` and `386` architectures.
Builds and runs on `amd64`, `arm64`, `arm/v7`.

## Note for Users running 32-bit Debian Buster-based OSes on ARM

Expand All @@ -22,6 +22,10 @@ A computer host on a suitable architecture and one USB RTL-SDR dongle connected

The default `SERVER` and `SERVER_PORT` values are suitable for automatically working with ACARS Hub, provided ACARS Hub is **on the same pi as the decoder**. If ACARS Hub is not on the same Pi, please provide the correct host name in the `SERVER` variable. Very likely you will not have to change the `SERVER_PORT`, but if you did change the port mapping on your ACARS Hub (and you will know if you did) please set the server port correctly as well.

## Deprecation Notice

`SERIAL` has been deprecated in favor of `SOAPYSDR`. Please update your configuration accordingly. If `SERIAL` is set the driver will be set to `rtlsdr` and the serial number will be set to the value of `SERIAL`.

## Up and running

```yaml
Expand All @@ -38,7 +42,7 @@ services:
ports:
environment:
- TZ="America/Denver"
- SERIAL=13305
- SOAPYSDR=driver=rtlsdr,serial=13305
- FEED_ID=VDLM
- FREQUENCIES=136725000;136975000;136875000
tmpfs:
Expand All @@ -51,20 +55,24 @@ services:
| Variable | Description | Required | Default |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------- |
| `TZ` | Your timezone | No | UTC |
| `SERIAL` | The serial number of your RTL-SDR dongle. Exactly one of `SERIAL` or `SOAPYSDR` should be set. | No | Blank |
| `SOAPYSDR` | The SoapySDR device string that identifies your dongle. Currently only the SoapyRTLTCP driver is included. Exactly one of `SERIAL` or `SOAPYSDR` should be set. | No | Blank |
| `SOAPYSDR` | The SoapySDR device string that identifies your dongle. See below for supported soapy sdr types. | No | Blank |
| `FEED_ID` | Used by the decoder to insert a unique ID in to the output message | Yes | Blank |
| `FREQUENCIES` | Colon-separated list of frequencies, but to a maximum of 8, for the decoder to list to. No decimal, and all frequencies should be nine digits long. | Yes | Blank |
| `PPM` | Parts per million correction of the decoder | No | 0 |
| `GAIN` | The gain applied to the RTL-SDR dongle. | No | `40` |
| `OVERSAMPLE` | Overrides the default oversampling rate used by dumpvdl2. | No | Blank |
| `SERVER` | The server where messages will be forwarded to. | No | Blank |
| `SERVER_PORT` | The port where the server will receive messages on. | No | `5555` |
| `VDLM_FILTER_ENABLE` | Filter out non-informational messages. Turning this off (set to a blank value) will cause increased message rate but the messages will be of little value. Will cause extra SD card read/writes. | No | `TRUE` |
| `QUIET_LOGS` | Mute log output to the bare minimum. Set to `false` to disable. | No | `TRUE` |
| `ZMQ_MODE` | Output to [zmq](https://zeromq.org) publisher socket. This sets the mode to `client` or `server`. | No | |
| `ZMQ_ENDPOINT` | Output to [zmq](https://zeromq.org) publisher socket. This sets the `endpoint`. Syntax is `tcp://address:port` | No | |

## `acars_router` Note
## SoapySDR device string

The SoapySDR device string is used to identify your RTL-SDR dongle. The default value is `driver=rtlsdr` which is suitable for most users. If you are using a different SDR, you will need to provide the correct device string. For example, if you are using an Airspy Mini, you would set `SOAPYSDR=driver=airspy`. Pass any additional options for the SDR in via this option as well.

Supported Soapy Drivers:

If you are running `acars_router` you will likely want to set `SERVER` to a blank value. If you do not, and `SERVER` is the default value or an IP/URL that is an acars_hub instance, you will receive duplicate messages!
- `rtlsdr`
- `rtltcp`
- `airspy`
- `sdrplay`
Empty file.
2 changes: 0 additions & 2 deletions rootfs/etc/s6-overlay/s6-rc.d/vdlm_feeder/run

This file was deleted.

1 change: 0 additions & 1 deletion rootfs/etc/s6-overlay/s6-rc.d/vdlm_feeder/type

This file was deleted.

Empty file.
Empty file.
35 changes: 0 additions & 35 deletions rootfs/etc/s6-overlay/scripts/01-dumpvdl2
Original file line number Diff line number Diff line change
Expand Up @@ -54,41 +54,6 @@ if [[ -n "$ZMQ_ENDPOINT" ]]; then
fi
fi

if [[ -n "${SERIAL}" ]]; then
mapfile -t RTL_TEST_OUTPUT < <(timeout 1s rtl_test -d 0 2>&1 | grep -P '^\s+\d+:\s.*?,.*?,\s+SN:\s+.*?$' | IFS=$'\n' sed -n 's/^\s*\([^:]*\):[^,]*,[^,]*,\s*SN:\s*\(.*\)$/\1,\2/; s/\s*$//p' || true)
for RTL_TEST_OUTPUT_LINE in "${RTL_TEST_OUTPUT[@]}"; do
if [[ "${RTL_TEST_OUTPUT_LINE##*,}" == "$SERIAL" ]]; then
OUTPUT_DEVICE_ID="${RTL_TEST_OUTPUT_LINE%%,*}"
fi
done

if [[ -z "${OUTPUT_DEVICE_ID}" ]]; then
echo "Could not find Device ID for serial '$SERIAL'"
fi

rm -rf /etc/s6-overlay/scripts/dumpvdl2 > /dev/null 2>&1
if [[ -n "${OUTPUT_DEVICE_ID}" ]]; then
cp /etc/templates/run /etc/s6-overlay/scripts/dumpvdl2
sed -i "s/DEVICE_ID=\"\"/DEVICE_ID=\"$OUTPUT_DEVICE_ID\"/g" /etc/s6-overlay/scripts/dumpvdl2
else
cp /etc/templates/bad /etc/s6-overlay/scripts/dumpvdl2
fi

#sed -i "s/DEVICE_ID=\"\"/DEVICE_ID=\"$OUTPUT_DEVICE_ID\"/g" /etc/s6-overlay/scripts/dumpvdl2
elif [[ -n "${SOAPYSDR}" ]]; then
if ! SoapySDRUtil --probe="${SOAPYSDR}"; then
echo "Could not find SoapySDR device for '$SOAPYSDR'"
cp /etc/templates/bad /etc/s6-overlay/scripts/dumpvdl2
else
cp /etc/templates/run /etc/s6-overlay/scripts/dumpvdl2
fi
else
echo "One of SERIAL or SOAPYSDR is not set, exiting"
exit 1
fi

s6-chmod 0755 /etc/s6-overlay/scripts/dumpvdl2

mkdir -p /run/acars
touch /run/acars/vdlm.past5min.json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,13 @@ VDLM_BIN="/usr/local/bin/dumpvdl2"
# shellcheck disable=SC2001
FREQ_STRING=""
VDLM_CMD=()
DEVICE_ID=""


# Specify device ID
if [ -n "${SOAPYSDR}" ]; then
VDLM_CMD+=("--soapysdr" "$SOAPYSDR")
elif [ -n "${SERIAL}" ]; then
mapfile -t RTL_TEST_OUTPUT < <(timeout 1s rtl_test -d 0 2>&1 | grep -P '^\s+\d+:\s.*?,.*?,\s+SN:\s+.*?$' | IFS=$'\n' sed -n 's/^\s*\([^:]*\):[^,]*,[^,]*,\s*SN:\s*\(.*\)$/\1,\2/; s/\s*$//p' || true)
for RTL_TEST_OUTPUT_LINE in "${RTL_TEST_OUTPUT[@]}"; do
if [[ "${RTL_TEST_OUTPUT_LINE##*,}" == "$SERIAL" ]]; then
OUTPUT_DEVICE_ID="${RTL_TEST_OUTPUT_LINE%%,*}"
fi
done

if [[ -z "${OUTPUT_DEVICE_ID}" ]]; then
echo "Could not find Device ID for serial '$SERIAL'"
exit 1
fi

rm -rf /etc/services.d/dumpvdl2/run > /dev/null 2>&1
if [[ -n "${OUTPUT_DEVICE_ID}" ]]; then
VDLM_CMD+=("--rtlsdr" "$OUTPUT_DEVICE_ID")
else
echo "Could not find Device ID for serial '$SERIAL'"
sleep 60
exit 1
fi
VDLM_CMD+=("--soapysdr" "driver=rtlsdr,serial=$SERIAL")
fi

if [ -n "$CENTER_FREQ" ]; then
Expand Down
26 changes: 0 additions & 26 deletions rootfs/etc/s6-overlay/scripts/vdlm_feeder

This file was deleted.

13 changes: 0 additions & 13 deletions rootfs/etc/templates/bad

This file was deleted.

0 comments on commit a547b2c

Please sign in to comment.