|
|
@ -48,6 +48,7 @@ int fc0013_tune(void *dev, int freq) { |
|
|
|
//fc0013_GetBandwidthMode(dev, &bw); // FIXME: missing
|
|
|
|
//fc0013_GetBandwidthMode(dev, &bw); // FIXME: missing
|
|
|
|
return FC0013_SetFrequency(dev, freq/1000, bw & 0xff); |
|
|
|
return FC0013_SetFrequency(dev, freq/1000, bw & 0xff); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int fc0013_set_bw(void *dev, int bw) { |
|
|
|
int fc0013_set_bw(void *dev, int bw) { |
|
|
|
/* read frequency to reapply it */ |
|
|
|
/* read frequency to reapply it */ |
|
|
|
unsigned long freq = 0; |
|
|
|
unsigned long freq = 0; |
|
|
@ -82,11 +83,11 @@ struct rtlsdr_device { |
|
|
|
uint16_t vid; |
|
|
|
uint16_t vid; |
|
|
|
uint16_t pid; |
|
|
|
uint16_t pid; |
|
|
|
} devices[] = { |
|
|
|
} devices[] = { |
|
|
|
{ 0x0bda, 0x2832, /*RTLSDR_TUNER_E4000,*/ }, /* default RTL2832U vid/pid (eg. hama nano) */ |
|
|
|
{ 0x0bda, 0x2832 }, /* default RTL2832U vid/pid (eg. hama nano) */ |
|
|
|
{ 0x0bda, 0x2838, /*RTLSDR_TUNER_E4000,*/ }, /* ezcap USB 2.0 DVB-T/DAB/FM stick */ |
|
|
|
{ 0x0bda, 0x2838 }, /* ezcap USB 2.0 DVB-T/DAB/FM stick */ |
|
|
|
{ 0x0ccd, 0x00b3, /*RTLSDR_TUNER_FC0013,*/ }, /* Terratec NOXON DAB/DAB+ USB-Stick */ |
|
|
|
{ 0x0ccd, 0x00b3 }, /* Terratec NOXON DAB/DAB+ USB-Stick */ |
|
|
|
{ 0x1f4d, 0xb803, /*RTLSDR_TUNER_FC0012,*/ }, /* GTek T803 */ |
|
|
|
{ 0x1f4d, 0xb803 }, /* GTek T803 */ |
|
|
|
{ 0x1b80, 0xd3a4, /*RTLSDR_TUNER_FC0013,*/ }, /* Twintech UT-40 */ |
|
|
|
{ 0x1b80, 0xd3a4 }, /* Twintech UT-40 */ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
typedef struct { |
|
|
@ -311,15 +312,10 @@ int rtlsdr_set_center_freq(rtlsdr_dev_t *dev, uint32_t freq) |
|
|
|
|
|
|
|
|
|
|
|
if (dev->tuner) { |
|
|
|
if (dev->tuner) { |
|
|
|
dev->tuner->freq = freq; |
|
|
|
dev->tuner->freq = freq; |
|
|
|
|
|
|
|
|
|
|
|
double f = (double) freq; |
|
|
|
double f = (double) freq; |
|
|
|
|
|
|
|
|
|
|
|
f *= 1.0 + dev->tuner->corr / 1e6; |
|
|
|
f *= 1.0 + dev->tuner->corr / 1e6; |
|
|
|
|
|
|
|
|
|
|
|
dev->tuner->tune((void *)dev, (int) f); |
|
|
|
dev->tuner->tune((void *)dev, (int) f); |
|
|
|
|
|
|
|
|
|
|
|
printf("Tuned to %i Hz\n", freq); |
|
|
|
printf("Tuned to %i Hz\n", freq); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
rtlsdr_set_i2c_repeater(dev, 0); |
|
|
|
rtlsdr_set_i2c_repeater(dev, 0); |
|
|
@ -408,11 +404,10 @@ uint32_t rtlsdr_get_device_count(void) |
|
|
|
libusb_get_device_descriptor(list[i], &dd); |
|
|
|
libusb_get_device_descriptor(list[i], &dd); |
|
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < sizeof(devices)/sizeof(struct rtlsdr_device); j++ ) { |
|
|
|
for (j = 0; j < sizeof(devices)/sizeof(struct rtlsdr_device); j++ ) { |
|
|
|
if ( devices[j].vid == dd.idVendor && devices[j].pid == dd.idProduct ) { |
|
|
|
if (devices[j].vid == dd.idVendor && devices[j].pid == dd.idProduct) |
|
|
|
device_count++; |
|
|
|
device_count++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
libusb_free_device_list(list, 0); |
|
|
|
libusb_free_device_list(list, 0); |
|
|
|
|
|
|
|
|
|
|
@ -460,7 +455,6 @@ rtlsdr_dev_t *rtlsdr_open(int index) |
|
|
|
for (j = 0; j < sizeof(devices)/sizeof(struct rtlsdr_device); j++ ) { |
|
|
|
for (j = 0; j < sizeof(devices)/sizeof(struct rtlsdr_device); j++ ) { |
|
|
|
if ( devices[j].vid == dd.idVendor && devices[j].pid == dd.idProduct ) { |
|
|
|
if ( devices[j].vid == dd.idVendor && devices[j].pid == dd.idProduct ) { |
|
|
|
device_count++; |
|
|
|
device_count++; |
|
|
|
|
|
|
|
|
|
|
|
if (index == device_count - 1) |
|
|
|
if (index == device_count - 1) |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@ -486,13 +480,13 @@ rtlsdr_dev_t *rtlsdr_open(int index) |
|
|
|
|
|
|
|
|
|
|
|
unsigned char buffer[256]; |
|
|
|
unsigned char buffer[256]; |
|
|
|
|
|
|
|
|
|
|
|
libusb_get_string_descriptor_ascii(dev->devh, 0, buffer, sizeof(buffer) ); |
|
|
|
libusb_get_string_descriptor_ascii(dev->devh, 0, buffer, sizeof(buffer)); |
|
|
|
printf("sn#: %s\n", buffer); |
|
|
|
printf("sn#: %s\n", buffer); |
|
|
|
|
|
|
|
|
|
|
|
libusb_get_string_descriptor_ascii(dev->devh, 1, buffer, sizeof(buffer) ); |
|
|
|
libusb_get_string_descriptor_ascii(dev->devh, 1, buffer, sizeof(buffer)); |
|
|
|
printf("manufacturer: %s\n", buffer); |
|
|
|
printf("manufacturer: %s\n", buffer); |
|
|
|
|
|
|
|
|
|
|
|
libusb_get_string_descriptor_ascii(dev->devh, 2, buffer, sizeof(buffer) ); |
|
|
|
libusb_get_string_descriptor_ascii(dev->devh, 2, buffer, sizeof(buffer)); |
|
|
|
printf("product: %s\n", buffer); |
|
|
|
printf("product: %s\n", buffer); |
|
|
|
|
|
|
|
|
|
|
|
r = libusb_claim_interface(dev->devh, 0); |
|
|
|
r = libusb_claim_interface(dev->devh, 0); |
|
|
@ -514,9 +508,7 @@ err: |
|
|
|
int rtlsdr_close(rtlsdr_dev_t *dev) |
|
|
|
int rtlsdr_close(rtlsdr_dev_t *dev) |
|
|
|
{ |
|
|
|
{ |
|
|
|
libusb_release_interface(dev->devh, 0); |
|
|
|
libusb_release_interface(dev->devh, 0); |
|
|
|
|
|
|
|
|
|
|
|
libusb_close(dev->devh); |
|
|
|
libusb_close(dev->devh); |
|
|
|
|
|
|
|
|
|
|
|
free(dev); |
|
|
|
free(dev); |
|
|
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|