Added option '-w' to rtl_sdr that allows setting the tuner bandwidth.

master
muttoni 2016-09-24 23:44:17 -03:00 committed by Lucas Teske
parent 484469dcb2
commit 90afc43af7
No known key found for this signature in database
GPG Key ID: 6C39C1C16A9DA7BE
1 changed files with 10 additions and 1 deletions

View File

@ -35,6 +35,7 @@
#include "convenience/convenience.h" #include "convenience/convenience.h"
#define DEFAULT_SAMPLE_RATE 2048000 #define DEFAULT_SAMPLE_RATE 2048000
#define DEFAULT_BANDWIDTH 0 /* automatic bandwidth */
#define DEFAULT_BUF_LENGTH (16 * 16384) #define DEFAULT_BUF_LENGTH (16 * 16384)
#define MINIMAL_BUF_LENGTH 512 #define MINIMAL_BUF_LENGTH 512
#define MAXIMAL_BUF_LENGTH (256 * 16384) #define MAXIMAL_BUF_LENGTH (256 * 16384)
@ -49,6 +50,7 @@ void usage(void)
"rtl_sdr, an I/Q recorder for RTL2832 based DVB-T receivers\n\n" "rtl_sdr, an I/Q recorder for RTL2832 based DVB-T receivers\n\n"
"Usage:\t -f frequency_to_tune_to [Hz]\n" "Usage:\t -f frequency_to_tune_to [Hz]\n"
"\t[-s samplerate (default: 2048000 Hz)]\n" "\t[-s samplerate (default: 2048000 Hz)]\n"
"\t[-w tuner_bandwidth (default: automatic)]\n"
"\t[-d device_index (default: 0)]\n" "\t[-d device_index (default: 0)]\n"
"\t[-g gain (default: 0 for auto)]\n" "\t[-g gain (default: 0 for auto)]\n"
"\t[-p ppm_error (default: 0)]\n" "\t[-p ppm_error (default: 0)]\n"
@ -118,10 +120,11 @@ int main(int argc, char **argv)
int dev_index = 0; int dev_index = 0;
int dev_given = 0; int dev_given = 0;
uint32_t frequency = 100000000; uint32_t frequency = 100000000;
uint32_t bandwidth = DEFAULT_BANDWIDTH;
uint32_t samp_rate = DEFAULT_SAMPLE_RATE; uint32_t samp_rate = DEFAULT_SAMPLE_RATE;
uint32_t out_block_size = DEFAULT_BUF_LENGTH; uint32_t out_block_size = DEFAULT_BUF_LENGTH;
while ((opt = getopt(argc, argv, "d:f:g:s:b:n:p:S")) != -1) { while ((opt = getopt(argc, argv, "d:f:g:s:w:b:n:p:S")) != -1) {
switch (opt) { switch (opt) {
case 'd': case 'd':
dev_index = verbose_device_search(optarg); dev_index = verbose_device_search(optarg);
@ -136,6 +139,9 @@ int main(int argc, char **argv)
case 's': case 's':
samp_rate = (uint32_t)atofs(optarg); samp_rate = (uint32_t)atofs(optarg);
break; break;
case 'w':
bandwidth = (uint32_t)atofs(optarg);
break;
case 'p': case 'p':
ppm_error = atoi(optarg); ppm_error = atoi(optarg);
break; break;
@ -200,6 +206,9 @@ int main(int argc, char **argv)
/* Set the sample rate */ /* Set the sample rate */
verbose_set_sample_rate(dev, samp_rate); verbose_set_sample_rate(dev, samp_rate);
/* Set the tuner bandwidth */
verbose_set_bandwidth(dev, bandwidth);
/* Set the frequency */ /* Set the frequency */
verbose_set_frequency(dev, frequency); verbose_set_frequency(dev, frequency);