aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/main_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/main_common.c')
-rw-r--r--src/common/main_common.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/common/main_common.c b/src/common/main_common.c
index 32c1a78..acbca01 100644
--- a/src/common/main_common.c
+++ b/src/common/main_common.c
@@ -62,6 +62,7 @@ const char *write_rx_wave = NULL;
const char *write_tx_wave = NULL;
const char *read_rx_wave = NULL;
int use_sdr = 0;
+int sdr_channel = 0;
static const char *sdr_args = "";
static double sdr_bandwidth = 0.0;
#ifdef HAVE_SDR
@@ -140,6 +141,8 @@ void print_help_common(const char *arg0, const char *ext_usage)
printf(" --sdr-soapy\n");
printf(" Force SoapySDR driver\n");
#endif
+ printf(" --sdr-channel <channel #>\n");
+ printf(" Give channel number for multi channel SDR device (default = %d)\n", sdr_channel);
printf(" --sdr-args <args>\n");
printf(" Optional SDR device arguments, seperated by comma\n");
printf(" e.g. --sdr-args <key>=<value>[,<key>=<value>[,...]]\n");
@@ -182,14 +185,15 @@ void print_hotkeys_common(void)
#define OPT_SDR_UHD 1100
#define OPT_SDR_SOAPY 1101
-#define OPT_SDR_ARGS 1102
-#define OPT_SDR_RX_GAIN 1103
-#define OPT_SDR_TX_GAIN 1104
-#define OPT_SDR_BANDWIDTH 1105
-#define OPT_WRITE_IQ_RX_WAVE 1106
-#define OPT_WRITE_IQ_TX_WAVE 1107
-#define OPT_READ_IQ_RX_WAVE 1108
-#define OPT_READ_IQ_TX_WAVE 1109
+#define OPT_SDR_CHANNEL 1102
+#define OPT_SDR_ARGS 1103
+#define OPT_SDR_RX_GAIN 1104
+#define OPT_SDR_TX_GAIN 1105
+#define OPT_SDR_BANDWIDTH 1106
+#define OPT_WRITE_IQ_RX_WAVE 1107
+#define OPT_WRITE_IQ_TX_WAVE 1108
+#define OPT_READ_IQ_RX_WAVE 1109
+#define OPT_READ_IQ_TX_WAVE 1110
static struct option long_options_common[] = {
{"help", 0, 0, 'h'},
@@ -214,6 +218,7 @@ static struct option long_options_common[] = {
{"read-rx-wave", 1, 0, OPT_READ_RX_WAVE},
{"sdr-uhd", 0, 0, OPT_SDR_UHD},
{"sdr-soapy", 0, 0, OPT_SDR_SOAPY},
+ {"sdr-channel", 1, 0, OPT_SDR_CHANNEL},
{"sdr-args", 1, 0, OPT_SDR_ARGS},
{"sdr-bandwidth", 1, 0, OPT_SDR_BANDWIDTH},
{"sdr-rx-gain", 1, 0, OPT_SDR_RX_GAIN},
@@ -385,6 +390,10 @@ void opt_switch_common(int c, char *arg0, int *skip_args)
#endif
*skip_args += 1;
break;
+ case OPT_SDR_CHANNEL:
+ sdr_channel = atoi(optarg);
+ *skip_args += 2;
+ break;
case OPT_SDR_ARGS:
sdr_args = strdup(optarg);
*skip_args += 2;
@@ -489,7 +498,7 @@ void main_common(int *quit, int latency, int interval, void (*myhandler)(void),
if (sdr_bandwidth == 0.0)
sdr_bandwidth = samplerate;
- rc = sdr_init(sdr_uhd, sdr_soapy, sdr_args, sdr_rx_gain, sdr_tx_gain, sdr_bandwidth, write_iq_rx_wave, write_iq_tx_wave, read_iq_rx_wave, read_iq_tx_wave);
+ rc = sdr_init(sdr_uhd, sdr_soapy, sdr_channel, sdr_args, sdr_rx_gain, sdr_tx_gain, sdr_bandwidth, write_iq_rx_wave, write_iq_tx_wave, read_iq_rx_wave, read_iq_tx_wave);
if (rc < 0)
return;
#endif