summaryrefslogtreecommitdiff
path: root/test/get_device_list.c
blob: 867929a3e97ecc034e5e2fa1a2bf053bc95f12c8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

//rtlsdr
#include <hw/hw.h>   

int main(  )
{
	int i;
	uint32_t dev_num;

	dev_num = rtlsdr_get_device_count();
	printf("Found %d device(s)\n", dev_num );

	printf("List device names:\n");
	for (i=0; i<dev_num; i++)
	{
		char manuf[256], product[256], serial[256];
		const char *dn = rtlsdr_get_device_name( i );
		printf(" %02d. Device Name: %s\n", i, dn );
		rtlsdr_get_device_usb_strings( i, manuf, product, serial );
		printf("\\
     Manufact:%s\n\\
     Product:%s\n\\
     Serial:%s\n", manuf, product, serial );
	}

	return 0;
}