aboutsummaryrefslogtreecommitdiffstats
path: root/src/rtl_sdr.c
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2012-05-20 16:41:15 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2012-05-20 16:41:15 +0200
commit505f40d9a092ad44c7d3a77477a72e37c955b4ff (patch)
treed8131c2fea713f6c619673199acfd0552964c7dc /src/rtl_sdr.c
parentfdc7bc978bf423f2663b10bb8f6cbd69879d9c02 (diff)
introduce api function to read usb string descriptors
This API allows to read manufacturer and product names as well as the serial number advertized by the device on the bus.
Diffstat (limited to 'src/rtl_sdr.c')
-rw-r--r--src/rtl_sdr.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/rtl_sdr.c b/src/rtl_sdr.c
index 98d5fc5..45995c2 100644
--- a/src/rtl_sdr.c
+++ b/src/rtl_sdr.c
@@ -107,6 +107,7 @@ int main(int argc, char **argv)
uint32_t samp_rate = DEFAULT_SAMPLE_RATE;
uint32_t out_block_size = DEFAULT_BUF_LENGTH;
int device_count;
+ char vendor[256], product[256], serial[256];
#ifndef _WIN32
while ((opt = getopt(argc, argv, "d:f:g:s:b:S::")) != -1) {
switch (opt) {
@@ -168,13 +169,14 @@ int main(int argc, char **argv)
}
fprintf(stderr, "Found %d device(s):\n", device_count);
- for (i = 0; i < device_count; i++)
- fprintf(stderr, " %d: %s\n", i, rtlsdr_get_device_name(i));
+ for (i = 0; i < device_count; i++) {
+ rtlsdr_get_device_usb_strings(i, vendor, product, serial);
+ fprintf(stderr, " %d: %s, %s, SN: %s\n", i, vendor, product, serial);
+ }
fprintf(stderr, "\n");
fprintf(stderr, "Using device %d: %s\n",
- dev_index,
- rtlsdr_get_device_name(dev_index));
+ dev_index, rtlsdr_get_device_name(dev_index));
r = rtlsdr_open(&dev, dev_index);
if (r < 0) {