From 10b9bc6614bef69da9c645bdcb0cbff0e0ed4dfc Mon Sep 17 00:00:00 2001 From: Oliver Jowett Date: Tue, 11 Aug 2020 12:49:01 +0800 Subject: [PATCH] Handle builds with no SDR support better. Reorder --ifile pseudo-sdr after the "none" SDR so that a build with no real SDR support defaults to "none" not --ifile If the "none" SDR was selected and network mode is not enabled, tell the user about the problem rather than just failing to do anything useful. --- dump1090.c | 9 +++++++++ sdr.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/dump1090.c b/dump1090.c index d5c3111..7db63b4 100644 --- a/dump1090.c +++ b/dump1090.c @@ -603,6 +603,15 @@ int main(int argc, char **argv) { } } + if (Modes.sdr_type == SDR_NONE && !Modes.net) { + fprintf(stderr, + "No SDR available and network mode not enabled; nothing to do!\n" + "Select a SDR type (--device-type or --ifile), or enable network mode (--net)\n" + "Try %s --help for full option help.\n", + argv[0]); + exit(1); + } + #ifdef _WIN32 // Try to comply with the Copyright license conditions for binary distribution if (!Modes.quiet) {showCopyright();} diff --git a/sdr.c b/sdr.c index 2a5da96..41e3ef2 100644 --- a/sdr.c +++ b/sdr.c @@ -98,8 +98,8 @@ static sdr_handler sdr_handlers[] = { { "limesdr", SDR_LIMESDR, limesdrInitConfig, limesdrShowHelp, limesdrHandleOption, limesdrOpen, limesdrRun, limesdrClose }, #endif - { "ifile", SDR_IFILE, ifileInitConfig, ifileShowHelp, ifileHandleOption, ifileOpen, ifileRun, ifileClose }, { "none", SDR_NONE, noInitConfig, noShowHelp, noHandleOption, noOpen, noRun, noClose }, + { "ifile", SDR_IFILE, ifileInitConfig, ifileShowHelp, ifileHandleOption, ifileOpen, ifileRun, ifileClose }, { NULL, SDR_NONE, NULL, NULL, NULL, NULL, NULL, NULL } /* must come last */ };