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.
This commit is contained in:
Oliver Jowett 2020-08-11 12:49:01 +08:00
parent 9237086b38
commit 10b9bc6614
2 changed files with 10 additions and 1 deletions

View File

@ -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();}

2
sdr.c
View File

@ -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 */
};