Developing embedded projects with USB requires host side software support.
Most of my projects use the USB HID (Human Interface Device) class driver. To be able to comunicate with the device in my C/C++ programs I use the hidapi developed by signal11.
You can find all of the files you need here: Github: hidapi
After you download the software, you can read the various instructions on how to build the shared libraries as necessary. However, if you don’t mind linking directly into your program (Making it larger) then the process is much simpler.
You only need the two files below!
hidapi.h
hidapi.c (Windows version)
And add ‘setupapi’ to the linker settings.
After adding hidapi.h and hidapi.c to your project, your view should look similar to this:
The next thing to do is add setupapi library to your projects linker settings making sure to add the setting to both debug and release, as shown below:
And finally, add #include “hidapi.h” to you source code where necessary.
Job done!