Add option (global flag) to disable use of SDR

This is required for channels that do not belog to actual radio transceivers.
This commit is contained in:
Andreas Eversberg 2020-06-13 09:08:03 +02:00
parent 2c82b83993
commit 79e11d54a6
2 changed files with 13 additions and 5 deletions

View File

@ -53,6 +53,7 @@ int num_kanal = 0;
const char *kanal[MAX_SENDER]; const char *kanal[MAX_SENDER];
int num_audiodev = 0; int num_audiodev = 0;
const char *audiodev[MAX_SENDER] = { "hw:0,0" }; const char *audiodev[MAX_SENDER] = { "hw:0,0" };
int allow_sdr = 1;
int use_sdr = 0; int use_sdr = 0;
static const char *call_audiodev = ""; static const char *call_audiodev = "";
int samplerate = 48000; int samplerate = 48000;
@ -158,11 +159,13 @@ void main_mobile_print_help(const char *arg0, const char *ext_usage)
printf(" --read-tx-wave <file>\n"); printf(" --read-tx-wave <file>\n");
printf(" Replace transmitted audio by given wave file.\n"); printf(" Replace transmitted audio by given wave file.\n");
#ifdef HAVE_SDR #ifdef HAVE_SDR
if (allow_sdr) {
printf(" --limesdr\n"); printf(" --limesdr\n");
printf(" Auto-select several required options for LimeSDR\n"); printf(" Auto-select several required options for LimeSDR\n");
printf(" --limesdr-mini\n"); printf(" --limesdr-mini\n");
printf(" Auto-select several required options for LimeSDR Mini\n"); printf(" Auto-select several required options for LimeSDR Mini\n");
sdr_config_print_help(); sdr_config_print_help();
}
#endif #endif
printf("\nNetwork specific options:\n"); printf("\nNetwork specific options:\n");
} }
@ -176,7 +179,9 @@ void main_mobile_print_hotkeys(void)
printf("Press 'c' key to toggle display of channel status.\n"); printf("Press 'c' key to toggle display of channel status.\n");
printf("Press 'm' key to toggle display of measurement value.\n"); printf("Press 'm' key to toggle display of measurement value.\n");
#ifdef HAVE_SDR #ifdef HAVE_SDR
if (allow_sdr) {
sdr_config_print_hotkeys(); sdr_config_print_hotkeys();
}
#endif #endif
} }
@ -332,7 +337,7 @@ int main_mobile_handle_options(int short_option, int argi, char **argv)
break; break;
#ifdef HAVE_SDR #ifdef HAVE_SDR
case OPT_LIMESDR: case OPT_LIMESDR:
{ if (allow_sdr) {
char *argv_lime[] = { argv[0], char *argv_lime[] = { argv[0],
"--sdr-soapy", "--sdr-soapy",
"--sdr-rx-antenna", "LNAL", "--sdr-rx-antenna", "LNAL",
@ -345,8 +350,9 @@ int main_mobile_handle_options(int short_option, int argi, char **argv)
int argc_lime = sizeof(argv_lime) / sizeof (*argv_lime); int argc_lime = sizeof(argv_lime) / sizeof (*argv_lime);
return options_command_line(argc_lime, argv_lime, main_mobile_handle_options); return options_command_line(argc_lime, argv_lime, main_mobile_handle_options);
} }
break;
case OPT_LIMESDR_MINI: case OPT_LIMESDR_MINI:
{ if (allow_sdr) {
char *argv_lime[] = { argv[0], char *argv_lime[] = { argv[0],
"--sdr-soapy", "--sdr-soapy",
"--sdr-rx-antenna", "LNAW", "--sdr-rx-antenna", "LNAW",
@ -360,13 +366,14 @@ int main_mobile_handle_options(int short_option, int argi, char **argv)
int argc_lime = sizeof(argv_lime) / sizeof (*argv_lime); int argc_lime = sizeof(argv_lime) / sizeof (*argv_lime);
return options_command_line(argc_lime, argv_lime, main_mobile_handle_options); return options_command_line(argc_lime, argv_lime, main_mobile_handle_options);
} }
break;
#endif #endif
default: default:
#ifdef HAVE_SDR #ifdef HAVE_SDR
return sdr_config_handle_options(short_option, argi, argv); if (allow_sdr)
#else return sdr_config_handle_options(short_option, argi, argv);
return -EINVAL;
#endif #endif
return -EINVAL;
} }
return 1; return 1;

View File

@ -4,6 +4,7 @@ extern const char *kanal[];
extern int swap_links; extern int swap_links;
extern int num_audiodev; extern int num_audiodev;
extern const char *audiodev[]; extern const char *audiodev[];
extern int allow_sdr;
extern int use_sdr; extern int use_sdr;
extern int samplerate; extern int samplerate;
extern int interval; extern int interval;