3535#include "convenience/convenience.h"
3636
3737#define DEFAULT_SAMPLE_RATE 2048000
38+ #define DEFAULT_BANDWIDTH 0 /* automatic bandwidth */
3839#define DEFAULT_BUF_LENGTH (16 * 16384)
3940#define MINIMAL_BUF_LENGTH 512
4041#define MAXIMAL_BUF_LENGTH (256 * 16384)
@@ -49,6 +50,7 @@ void usage(void)
4950 "rtl_sdr, an I/Q recorder for RTL2832 based DVB-T receivers\n\n"
5051 "Usage:\t -f frequency_to_tune_to [Hz]\n"
5152 "\t[-s samplerate (default: 2048000 Hz)]\n"
53+ "\t[-w tuner_bandwidth (default: automatic)]\n"
5254 "\t[-d device_index (default: 0)]\n"
5355 "\t[-g gain (default: 0 for auto)]\n"
5456 "\t[-p ppm_error (default: 0)]\n"
@@ -118,10 +120,11 @@ int main(int argc, char **argv)
118120 int dev_index = 0 ;
119121 int dev_given = 0 ;
120122 uint32_t frequency = 100000000 ;
123+ uint32_t bandwidth = DEFAULT_BANDWIDTH ;
121124 uint32_t samp_rate = DEFAULT_SAMPLE_RATE ;
122125 uint32_t out_block_size = DEFAULT_BUF_LENGTH ;
123126
124- while ((opt = getopt (argc , argv , "d:f:g:s:b:n:p:S" )) != -1 ) {
127+ while ((opt = getopt (argc , argv , "d:f:g:s:w: b:n:p:S" )) != -1 ) {
125128 switch (opt ) {
126129 case 'd' :
127130 dev_index = verbose_device_search (optarg );
@@ -136,6 +139,9 @@ int main(int argc, char **argv)
136139 case 's' :
137140 samp_rate = (uint32_t )atofs (optarg );
138141 break ;
142+ case 'w' :
143+ bandwidth = (uint32_t )atofs (optarg );
144+ break ;
139145 case 'p' :
140146 ppm_error = atoi (optarg );
141147 break ;
@@ -200,6 +206,9 @@ int main(int argc, char **argv)
200206 /* Set the sample rate */
201207 verbose_set_sample_rate (dev , samp_rate );
202208
209+ /* Set the tuner bandwidth */
210+ verbose_set_bandwidth (dev , bandwidth );
211+
203212 /* Set the frequency */
204213 verbose_set_frequency (dev , frequency );
205214
0 commit comments