Import comms/dump1090, a simple ADS-B Mode-S decoder for RTLSDR devices.

ok benoit@

Dump 1090 is an ADS-B Mode-S decoder specifically designed for RTLSDR
devices.

The main features are:
* Robust decoding of weak messages.
* Network support: TCP30003 stream (MSG5...), Raw packets, HTTP.
* Embedded HTTP server that displays the currently detected aircrafts
  on Google Maps.
* Single bit errors correction using the 24 bit CRC.
* Ability to decode DF11, DF17 messages.
* Ability to decode DF formats like DF0, DF4, DF5, DF16, DF20 and DF21
  where the checksum is xored with the ICAO address by brute forcing
  the checksum field using recently seen ICAO addresses.
* Decode raw IQ samples from file (using --ifile command line switch).
* Interactive command-line-interfae mode where aircrafts currently
  detected are shown as a list refreshing as more data arrives.
* CPR coordinates decoding and track calculation from velocity.
* TCP server streaming and receiving raw data to/from connected clients
  (using --net).
This commit is contained in:
bcallah 2020-07-27 16:45:31 +00:00
parent 34be56d30c
commit 6ddd86ab7e
6 changed files with 138 additions and 0 deletions

39
comms/dump1090/Makefile Normal file
View File

@ -0,0 +1,39 @@
# $OpenBSD: Makefile,v 1.1.1.1 2020/07/27 16:45:31 bcallah Exp $
COMMENT = simple ADS-B Mode-S decoder for RTLSDR devices
DISTNAME = ${GH_PROJECT}-0.0.0.20200203
CATEGORIES = comms
# No releases...
GH_ACCOUNT = antirez
GH_PROJECT = dump1090
GH_COMMIT = de61bd564f1aa929bae414a70e421acd0b81789a
MAINTAINER = Brian Callahan <bcallah@openbsd.org>
# BSD
PERMIT_PACKAGE = Yes
WANTLIB += c m pthread rtlsdr usb-1.0
LIB_DEPENDS = comms/rtl-sdr
USE_GMAKE = Yes
MAKE_FLAGS = CC="${CC}"
NO_TEST = Yes
# Easier web page access in standalone mode
do-gen:
sed -i 's,gmap.html,${LOCALBASE}/share/dump1090/gmap.html,g' \
${WRKSRC}/dump1090.c
# No install routine
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/dump1090 ${PREFIX}/bin
${INSTALL_DATA_DIR} ${PREFIX}/share/dump1090/tools
${INSTALL_DATA} ${WRKSRC}/gmap.html ${PREFIX}/share/dump1090
${INSTALL_DATA} ${WRKSRC}/tools/debug.html \
${PREFIX}/share/dump1090/tools
.include <bsd.port.mk>

2
comms/dump1090/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (dump1090-0.0.0.20200203-de61bd56.tar.gz) = erOIhtyQF5nHpR5M+s1BPrJ8c5l5+quZ4AfHbmMWMck=
SIZE (dump1090-0.0.0.20200203-de61bd56.tar.gz) = 485482

View File

@ -0,0 +1,13 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2020/07/27 16:45:31 bcallah Exp $
Remove hardcoded optimizations.
Index: Makefile
--- Makefile.orig
+++ Makefile
@@ -1,4 +1,4 @@
-CFLAGS?=-O2 -g -Wall -W $(shell pkg-config --cflags librtlsdr)
+CFLAGS+=-Wall -W $(shell pkg-config --cflags librtlsdr)
LDLIBS+=$(shell pkg-config --libs librtlsdr) -lpthread -lm
CC?=gcc
PROGNAME=dump1090

View File

@ -0,0 +1,59 @@
$OpenBSD: patch-dump1090_c,v 1.1.1.1 2020/07/27 16:45:31 bcallah Exp $
Clang says this abs should be llabs.
Cherry pick quiet mode from PR #17.
Index: dump1090.c
--- dump1090.c.orig
+++ dump1090.c
@@ -162,6 +162,7 @@ struct {
int debug; /* Debugging mode. */
int net; /* Enable networking. */
int net_only; /* Enable just networking. */
+ int quiet; /* Suppress stdout. */
int interactive; /* Interactive mode */
int interactive_rows; /* Interactive mode: max number of rows. */
int interactive_ttl; /* Interactive mode: TTL before deletion. */
@@ -273,6 +274,7 @@ void modesInitConfig(void) {
Modes.interactive = 0;
Modes.interactive_rows = MODES_INTERACTIVE_ROWS;
Modes.interactive_ttl = MODES_INTERACTIVE_TTL;
+ Modes.quiet = 0;
Modes.aggressive = 0;
Modes.interactive_rows = getTermRows();
Modes.loop = 0;
@@ -1568,7 +1570,7 @@ void useModesMessage(struct modesMessage *mm) {
if (a && Modes.stat_sbs_connections > 0) modesSendSBSOutput(mm, a); /* Feed SBS output clients. */
}
/* In non-interactive way, display messages on standard output. */
- if (!Modes.interactive) {
+ if (!Modes.interactive && !Modes.quiet) {
displayModesMessage(mm);
if (!Modes.raw && !Modes.onlyaddr) printf("\n");
}
@@ -1801,7 +1803,7 @@ struct aircraft *interactiveReceiveData(struct modesMe
}
/* If the two data is less than 10 seconds apart, compute
* the position. */
- if (abs(a->even_cprtime - a->odd_cprtime) <= 10000) {
+ if (llabs(a->even_cprtime - a->odd_cprtime) <= 10000) {
decodeCPR(a);
}
} else if (mm->metype == 19) {
@@ -2462,6 +2464,7 @@ void showHelp(void) {
"--metric Use metric units (meters, km/h, ...).\n"
"--snip <level> Strip IQ file removing samples < level.\n"
"--debug <flags> Debug mode (verbose), see README for details.\n"
+"--quiet Disable output to stdout. Use for daemon applications.\n"
"--help Show this help.\n"
"\n"
"Debug mode flags: d = Log frames decoded with errors\n"
@@ -2568,6 +2571,8 @@ int main(int argc, char **argv) {
}
} else if (!strcmp(argv[j],"--stats")) {
Modes.stats = 1;
+ } else if (!strcmp(argv[j],"--quiet")) {
+ Modes.quiet = 1;
} else if (!strcmp(argv[j],"--snip") && more) {
snipMode(atoi(argv[++j]));
exit(0);

19
comms/dump1090/pkg/DESCR Normal file
View File

@ -0,0 +1,19 @@
Dump 1090 is an ADS-B Mode-S decoder specifically designed for RTLSDR
devices.
The main features are:
* Robust decoding of weak messages.
* Network support: TCP30003 stream (MSG5...), Raw packets, HTTP.
* Embedded HTTP server that displays the currently detected aircrafts
on Google Maps.
* Single bit errors correction using the 24 bit CRC.
* Ability to decode DF11, DF17 messages.
* Ability to decode DF formats like DF0, DF4, DF5, DF16, DF20 and DF21
where the checksum is xored with the ICAO address by brute forcing
the checksum field using recently seen ICAO addresses.
* Decode raw IQ samples from file (using --ifile command line switch).
* Interactive command-line-interfae mode where aircrafts currently
detected are shown as a list refreshing as more data arrives.
* CPR coordinates decoding and track calculation from velocity.
* TCP server streaming and receiving raw data to/from connected clients
(using --net).

6
comms/dump1090/pkg/PLIST Normal file
View File

@ -0,0 +1,6 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2020/07/27 16:45:31 bcallah Exp $
@bin bin/dump1090
share/dump1090/
share/dump1090/gmap.html
share/dump1090/tools/
share/dump1090/tools/debug.html