ls_cmsis_dap.c 574 Bytes
Newer Older
1
2
3
4
5
6
7
8
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <hidapi/hidapi.h>

int main(int argc, char *argv[])
{
	int rc = 0;
Rahix's avatar
Rahix committed
9
	if ((rc = hid_init())) {
10
11
12
13
14
		fprintf(stderr, "hid_init: %d\n", rc);
		goto done;
	}

	struct hid_device_info *hid_devs = hid_enumerate(0x0d28, 0x0204);
Rahix's avatar
Rahix committed
15
	if (!hid_devs) {
16
		fprintf(stderr, "hid_enumerate: NULL\n");
Rahix's avatar
Rahix committed
17
18
		rc = 1;
		goto done;
19
20
	}

Rahix's avatar
Rahix committed
21
	for (struct hid_device_info *dev = hid_devs; dev; dev = dev->next) {
22
23
24
25
		fprintf(stdout, "%s\n", dev->path);
	}

done:
Rahix's avatar
Rahix committed
26
27
28
	if (hid_devs) {
		hid_free_enumeration(hid_devs);
	}
29
30
31
	hid_exit();
	return -1;
}