diff options
| author | Dimitri Stolnikov <horiz0n@gmx.net> | 2012-04-01 01:36:49 +0200 |
|---|---|---|
| committer | Dimitri Stolnikov <horiz0n@gmx.net> | 2012-04-01 01:36:49 +0200 |
| commit | 4ad93906a48039109b9eadb2921b128b66cde7bf (patch) | |
| tree | c52db274f7459325acd2638947f04f1057399f58 /src/main.c | |
| parent | 2f20f6fe9e074b4b996954cfec24ba28b0d41423 (diff) | |
add skeleton routines for setting tuner gain
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -35,6 +35,8 @@ void usage(void) printf("rtl-sdr, an I/Q recorder for RTL2832 based DVB-T receivers\n\n" "Usage:\t -f frequency to tune to [Hz]\n" "\t[-s samplerate (default: 2048000 Hz)]\n" + "\t[-d device index (default: 0)]\n" + "\t[-g tuner gain (default: 0 dB)]\n" "\toutput filename\n"); exit(1); } @@ -54,9 +56,9 @@ int main(int argc, char **argv) uint32_t n_read; FILE *file; rtlsdr_dev_t *dev = NULL; - uint32_t dev_index = 0; + uint32_t dev_index = 0, gain = 0; - while ((opt = getopt(argc, argv, "d:f:s:")) != -1) { + while ((opt = getopt(argc, argv, "d:f:g:s:")) != -1) { switch (opt) { case 'd': dev_index = atoi(optarg); @@ -64,6 +66,9 @@ int main(int argc, char **argv) case 'f': frequency = atoi(optarg); break; + case 'g': + gain = atoi(optarg); + break; case 's': samp_rate = atoi(optarg); break; @@ -116,6 +121,12 @@ int main(int argc, char **argv) else fprintf(stderr, "Tuned to %i Hz.\n", frequency); + r = rtlsdr_set_tuner_gain(dev, gain); + if (r < 0) + fprintf(stderr, "WARNING: Failed to set tuner gain.\n"); + else + fprintf(stderr, "Tuner gain set to %i dB.\n", gain); + file = fopen(filename, "wb"); if (!file) { |
