Verified Commit c913b7f4 authored by Wolfgang Draxinger's avatar Wolfgang Draxinger Committed by Rahix
Browse files

Added tool to enumerate CMSIS-DAP debugging boards

parent 7726c734
.PHONY: all clean
all: ls_cmsis_dap-hidraw ls_cmsis_dap-libusb
-rm *.o ls_cmsis_dap-hidraw ls_cmsis_dap-libusb
ls_cmsis_dap.o: ls_cmsis_dap.c
ls_cmsis_dap-hidraw: LDFLAGS=-lhidapi-hidraw
ls_cmsis_dap-hidraw: ls_cmsis_dap.o
$(CC) $(LDFLAGS) -o $@ $<
ls_cmsis_dap-libusb: LDFLAGS=-lhidapi-libusb
ls_cmsis_dap-libusb: ls_cmsis_dap.o
$(CC) $(LDFLAGS) -o $@ $<
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <hidapi/hidapi.h>
int main(int argc, char *argv[])
int rc = 0;
if( (rc = hid_init()) ){
fprintf(stderr, "hid_init: %d\n", rc);
goto done;
struct hid_device_info *hid_devs = hid_enumerate(0x0d28, 0x0204);
if( !hid_devs ){
fprintf(stderr, "hid_enumerate: NULL\n");
rc = 1; goto done;
for( struct hid_device_info *dev = hid_devs; dev ; dev = dev->next ){
fprintf(stdout, "%s\n", dev->path);
if( hid_devs ){ hid_free_enumeration(hid_devs); }
return -1;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment