From 1c831ae9a48ce40a5a80ac11446cb7979b34b8ac Mon Sep 17 00:00:00 2001 From: Karl Lehenbauer Date: Wed, 27 Aug 2014 15:41:52 -0500 Subject: [PATCH] New switch allows dump1090 to work with/without dongle * With --net-only switch dump1090 wouldn't look for an RTLSDR device * Without --net-only switch dump1090 would abort if it couldn't find an RTLSDR device. * Now with --net --no-rtlsdr-ok dump1090 will try to find an RTLSDR device but go ahead and start either way. --- dump1090.c | 7 +++++++ dump1090.h | 1 + 2 files changed, 8 insertions(+) diff --git a/dump1090.c b/dump1090.c index cd53413..c78a54e 100644 --- a/dump1090.c +++ b/dump1090.c @@ -78,6 +78,7 @@ void modesInitConfig(void) { Modes.net_input_beast_port = MODES_NET_INPUT_BEAST_PORT; Modes.net_http_port = MODES_NET_HTTP_PORT; Modes.net_fatsv_port = MODES_NET_OUTPUT_FA_TSV_PORT; + Modes.no_rtlsdr_ok = 0; Modes.interactive_rows = getTermRows(); Modes.interactive_delete_ttl = MODES_INTERACTIVE_DELETE_TTL; Modes.interactive_display_ttl = MODES_INTERACTIVE_DISPLAY_TTL; @@ -200,6 +201,9 @@ void modesInitRTLSDR(void) { device_count = rtlsdr_get_device_count(); if (!device_count) { fprintf(stderr, "No supported RTLSDR devices found.\n"); + if (Modes.no_rtlsdr_ok) { + return; + } exit(1); } @@ -410,6 +414,7 @@ void showHelp(void) { "--modeac Enable decoding of SSR Modes 3/A & 3/C\n" "--net-beast TCP raw output in Beast binary format\n" "--net-only Enable just networking, no RTL device or file used\n" +"--no-rtlsdr-ok Keep going even if no RTLSDR device is found\n" "--net-fatsv-port FlightAware TSV output port (default: 10001)\n" "--net-http-port HTTP server port (default: 8080)\n" "--net-ri-port TCP raw input listen port (default: 30001)\n" @@ -610,6 +615,8 @@ int main(int argc, char **argv) { } else if (!strcmp(argv[j],"--net-only")) { Modes.net = 1; Modes.net_only = 1; + } else if (!strcmp(argv[j],"--no-rtlsdr-ok")) { + Modes.no_rtlsdr_ok = 1; } else if (!strcmp(argv[j],"--net-heartbeat") && more) { Modes.net_heartbeat_rate = atoi(argv[++j]) * 15; } else if (!strcmp(argv[j],"--net-ro-size") && more) { diff --git a/dump1090.h b/dump1090.h index af28c47..8b9d564 100644 --- a/dump1090.h +++ b/dump1090.h @@ -315,6 +315,7 @@ struct { // Internal state int net_input_beast_port; // Beast input TCP port int net_http_port; // HTTP port int net_fatsv_port; // FlightAware TSV port + int no_rtlsdr_ok; // keep going if no RTLSDR dev found int net_sndbuf_size; // TCP output buffer size (64Kb * 2^n) int quiet; // Suppress stdout int interactive; // Interactive mode