While using rtl_sdr i noticed that there was no direct sampling support, 
despite the rtl-sdr library supporting it, so i wrote a patch:

diff --git a/src/rtl_sdr.c b/src/rtl_sdr.cindex 2c93b57..15a4212 100644
--- a/src/rtl_sdr.c
+++ b/src/rtl_sdr.c
@@ -55,6 +55,7 @@ void usage(void)
  "\t[-b output_block_size (default: 16 * 16384)]\n"
  "\t[-n number of samples to read (default: 0, infinite)]\n"
  "\t[-S force sync output (default: async)]\n"
+ "\t[-D direct sampling (default: 0, 1 for I branch, 2 for Q branch)]\n"
  "\tfilename (a '-' dumps samples to stdout)\n\n");
  exit(1);
 }
@@ -112,6 +113,7 @@ int main(int argc, char **argv)
  int n_read;
  int r, opt;
  int gain = 0;
+ int direct_sampling = 0;
  int ppm_error = 0;
  int sync_mode = 0;
  FILE *file;
@@ -121,8 +123,8 @@ int main(int argc, char **argv)
  uint32_t frequency = 100000000;
  uint32_t samp_rate = DEFAULT_SAMPLE_RATE;
  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:b:n:p:S:D:")) != -1) {
  switch (opt) {
  case 'd':
  dev_index = verbose_device_search(optarg);
@@ -149,6 +151,9 @@ int main(int argc, char **argv)
  case 'S':
  sync_mode = 1;
  break;
+ case 'D':
+ direct_sampling = atoi(optarg);
+ break;
  default:
  usage();
  break;
@@ -200,7 +205,8 @@ int main(int argc, char **argv)
 #endif
  /* Set the sample rate */
  verbose_set_sample_rate(dev, samp_rate);
-
+ /* Set direct sampling*/
+ verbose_direct_sampling(dev, direct_sampling);
  /* Set the frequency */
  verbose_set_frequency(dev, frequency);

Reply via email to