From 1a3f65eaab18130be66a711735df86717ff45d38 Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Mon, 29 Jun 2015 12:41:55 +0100 Subject: [PATCH] Add --no-interactive, --show-only options to view1090 This turns it into a handy debug tool for looking at raw messages from an existing running dump1090 without having to mess around with a separate copy of dump1090 and netcat tunnels etc. --- view1090.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/view1090.c b/view1090.c index 573f751..63d6bca 100644 --- a/view1090.c +++ b/view1090.c @@ -121,7 +121,7 @@ void showHelp(void) { "-----------------------------------------------------------------------------\n" "| view1090 ModeS Viewer %45s |\n" "-----------------------------------------------------------------------------\n" - "--interactive Interactive mode refreshing data on screen\n" + "--no-interactive Disable interactive mode, print messages to stdout\n" "--interactive-rows Max number of rows in interactive mode (default: 15)\n" "--interactive-ttl Remove from list if idle for (default: 60)\n" "--interactive-rtl1090 Display flight table in RTL1090 format\n" @@ -135,6 +135,7 @@ void showHelp(void) { "--fix Enable single-bits error correction using CRC\n" "--aggressive More CPU for more messages (two bits fixes, ...)\n" "--metric Use metric units (meters, km/h, ...)\n" + "--show-only Show only messages from the given ICAO on stdout\n" "--help Show this help\n", MODES_DUMP1090_VARIANT " " MODES_DUMP1090_VERSION ); @@ -167,8 +168,11 @@ int main(int argc, char **argv) { Modes.mode_ac = 1; } else if (!strcmp(argv[j],"--interactive-rows") && more) { Modes.interactive_rows = atoi(argv[++j]); - } else if (!strcmp(argv[j],"--interactive")) { - Modes.interactive = 1; + } else if (!strcmp(argv[j],"--no-interactive")) { + Modes.interactive = 0; + } else if (!strcmp(argv[j],"--show-only") && more) { + Modes.show_only = (uint32_t) strtoul(argv[++j], NULL, 16); + Modes.interactive = 0; } else if (!strcmp(argv[j],"--interactive-ttl") && more) { Modes.interactive_display_ttl = (uint64_t)(1000 * atof(argv[++j])); } else if (!strcmp(argv[j],"--interactive-rtl1090")) { @@ -226,7 +230,9 @@ int main(int argc, char **argv) { icaoFilterExpire(); trackPeriodicUpdate(); modesNetPeriodicWork(); - interactiveShowData(); + + if (Modes.interactive) + interactiveShowData(); if (s->connections == 0) { // lost input connection, try to reconnect