Page 1 of 1
HID_data example has a number of errors in windows
Posted: Sat Oct 25, 2008 2:22 am
by epsilon_da
Hi. I will just enumerate some errors that i had trying to compile it with mingw:
I am using Codeblocks IDE which comes with mingw.
--- cannot find -lusb
libusb.a doesnt exists (at least not in my instalation) but seams like the problem is solved by removing -lusb
--- bzero is not defined (which should be in string.h)
From here :
http://www.opengroup.org/onlinepubs/000 ... bzero.html
The solution is to define this macro.
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
Hope it helps someone.
Posted: Sat Oct 25, 2008 3:18 am
by epsilon_da
After having compiled command-line tool in windows, it doesnt works.
It just doesnt find the device and i dont know where else to try:
checking HID path "\\?\hid#vid_16c0&pid_05df#6&357e0f0f&0&0000#4d1e55b2-f16f-11
cf-88cb-001111000030}"
opening failed: 5
error finding DataStore: The specified device was not found
But i tryed with libusb-win32 and it does works.
This requires to only install the file libusb-win32-filter-.....exe
And i edited the file hiddata.c replacing
#if defined(WIN32)
with this:
#define LIBUSB
#if !defined(LIBUSB) && defined(WIN32)
This will let me choose if i want or not compile with libusb or the windows API.
Just to learn more, i would like to know what can the problem be with the windows API.
I am using WinXP with the free DDK provided by mingw.
Posted: Tue Oct 28, 2008 12:58 am
by bearing
Are you sure your hardware is working?
I tried hidtool on Linux first. It worked after some general debugging, like moving the physical connector between USB-ports.
After reading your first post I could compile it on Windows. hidtool.exe worked with my hardware right away.
Posted: Tue Oct 28, 2008 1:34 am
by epsilon_da
Yes it works great with libusb under both OSes.
Im glad that it worked for you, then it is not a code problem. It could be that i have windows xp inside a virtual machine, but all other usb devices and libusb-win32 on the same OS works fine.
Anyway, using libusb was much easier than the instructions listed on his webpage. I have only installed the filter driver and compiled with libusb (commented the windows api part) and it worked perfectly.
Also i dont know if everybody thinks equal, but i find the windows api a total mess. I try to aboid it as much as i can.
Posted: Tue Nov 04, 2008 12:06 pm
by christian
Regarding bzero: Seems to be a problem of header versions. My MinGW installation has it...
Regarding -lusb: You need to install libusb-win32. This is a separate install not included with MinGW. The example demonstrates how to use direct (libusb based) access to HID devices.