|
|
@ -82,9 +82,10 @@ void usage(void) |
|
|
|
"[samplerate in kHz] [frequency in Hz] [device index]\n"); |
|
|
|
"[samplerate in kHz] [frequency in Hz] [device index]\n"); |
|
|
|
#else |
|
|
|
#else |
|
|
|
printf("rtl-sdr, an I/Q recorder for RTL2832 based USB-sticks\n\n" |
|
|
|
printf("rtl-sdr, an I/Q recorder for RTL2832 based USB-sticks\n\n" |
|
|
|
"Usage:\t -a listen address\n" |
|
|
|
"Usage:\t[-a listen address]\n" |
|
|
|
"\t[-p listen port (default: 1234)\n" |
|
|
|
"\t[-p listen port (default: 1234)]\n" |
|
|
|
"\t -f frequency to tune to [Hz]\n" |
|
|
|
"\t[-f frequency to tune to [Hz]]\n" |
|
|
|
|
|
|
|
"\t[-g tuner_gain (default: -1dB)]\n" |
|
|
|
"\t[-s samplerate in Hz (default: 2048000 Hz)]\n" |
|
|
|
"\t[-s samplerate in Hz (default: 2048000 Hz)]\n" |
|
|
|
"\t[-d device index (default: 0)]\n"); |
|
|
|
"\t[-d device index (default: 0)]\n"); |
|
|
|
#endif |
|
|
|
#endif |
|
|
@ -307,10 +308,11 @@ int main(int argc, char **argv) |
|
|
|
int r, opt, i; |
|
|
|
int r, opt, i; |
|
|
|
char* addr = "127.0.0.1"; |
|
|
|
char* addr = "127.0.0.1"; |
|
|
|
int port = 1234; |
|
|
|
int port = 1234; |
|
|
|
uint32_t frequency = 0, samp_rate = 2048000; |
|
|
|
uint32_t frequency = 100000000, samp_rate = 2048000; |
|
|
|
struct sockaddr_in local, remote; |
|
|
|
struct sockaddr_in local, remote; |
|
|
|
int device_count; |
|
|
|
int device_count; |
|
|
|
uint32_t dev_index = 0, gain = -10; |
|
|
|
uint32_t dev_index = 0; |
|
|
|
|
|
|
|
int gain = -10; // tenths of a dB
|
|
|
|
struct llist *curelem,*prev; |
|
|
|
struct llist *curelem,*prev; |
|
|
|
pthread_attr_t attr; |
|
|
|
pthread_attr_t attr; |
|
|
|
void *status; |
|
|
|
void *status; |
|
|
@ -325,7 +327,7 @@ int main(int argc, char **argv) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
#ifndef _WIN32 |
|
|
|
#ifndef _WIN32 |
|
|
|
struct sigaction sigact; |
|
|
|
struct sigaction sigact; |
|
|
|
while ((opt = getopt(argc, argv, "a:p:f:s:d:")) != -1) { |
|
|
|
while ((opt = getopt(argc, argv, "a:p:f:g:s:d:")) != -1) { |
|
|
|
switch (opt) { |
|
|
|
switch (opt) { |
|
|
|
case 'd': |
|
|
|
case 'd': |
|
|
|
dev_index = atoi(optarg); |
|
|
|
dev_index = atoi(optarg); |
|
|
@ -333,6 +335,9 @@ int main(int argc, char **argv) |
|
|
|
case 'f': |
|
|
|
case 'f': |
|
|
|
frequency = (uint32_t)atof(optarg); |
|
|
|
frequency = (uint32_t)atof(optarg); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
case 'g': |
|
|
|
|
|
|
|
gain = (int)(atof(optarg) * 10); |
|
|
|
|
|
|
|
break; |
|
|
|
case 's': |
|
|
|
case 's': |
|
|
|
samp_rate = (uint32_t)atof(optarg); |
|
|
|
samp_rate = (uint32_t)atof(optarg); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -403,7 +408,7 @@ int main(int argc, char **argv) |
|
|
|
if (r < 0) |
|
|
|
if (r < 0) |
|
|
|
fprintf(stderr, "WARNING: Failed to set tuner gain.\n"); |
|
|
|
fprintf(stderr, "WARNING: Failed to set tuner gain.\n"); |
|
|
|
else |
|
|
|
else |
|
|
|
fprintf(stderr, "Tuner gain set to %i dB.\n", gain); |
|
|
|
fprintf(stderr, "Tuner gain set to %f dB.\n", gain/10.0); |
|
|
|
|
|
|
|
|
|
|
|
/* Reset endpoint before we start reading from it (mandatory) */ |
|
|
|
/* Reset endpoint before we start reading from it (mandatory) */ |
|
|
|
r = rtlsdr_reset_buffer(dev); |
|
|
|
r = rtlsdr_reset_buffer(dev); |
|
|
|