[libhid-discuss] Windows support?

Xiaofan Chen xiaofanc at gmail.com
Fri Mar 28 00:03:08 UTC 2008


Long post.

On Thu, Mar 27, 2008 at 11:38 PM, Charles Lepple <clepple at ghz.cc> wrote:
> Xiaofan Chen wrote:
> > Wait a moment, I remember someone has ported libhid to Win32
> > in libusb-win32 mailing list. You may want to contact him (Rob Krakora).
> > http://permalink.gmane.org/gmane.comp.lib.libusb.devel.windows/1476
>
> Please post back to this list with your findings. I don't have a Windows
> machine to test with, and nobody has really given me any concrete
> suggestions on ways to patch libhid so that it will work with
> libusb-win32.

Ok, I got the source code and I an build it with the free Visual C++.Net
Express 2005.

I do not have a good HID device to test this port. Anyway, just running
the first example here. It seems to work.

G:\USB\libusb_winusb\libhidwin32\libhid-0.2.16\libhid\Debug>dir libhid.*
08/19/2007  03:36 PM           102,400 libhid.dll
08/19/2007  03:36 PM               403 libhid.dll.embed.manifest
08/19/2007  03:36 PM               468 libhid.dll.embed.manifest.res
08/19/2007  03:36 PM               385 libhid.dll.intermediate.manifest
08/19/2007  03:36 PM             3,613 libhid.exp
08/19/2007  03:36 PM           416,960 libhid.ilk
08/19/2007  03:36 PM             6,632 libhid.lib
08/19/2007  03:36 PM           478,208 libhid.pdb

G:\USB\libusb_winusb\libhidwin32\libhid-0.2.16\libhid\Debug>dir *.exe
08/06/2007  01:51 AM            40,960 test.exe
08/06/2007  01:51 AM            40,960 test2.exe

G:\USB\libusb_winusb\libhidwin32\libhid-0.2.16\libhid\Debug>test2
 NOTICE_PRINT: hid_init(): libhid 0.2.16.0.0 is being initialized.
  TRACE_PRINT: hid_init(): initialising USB subsystem...
  TRACE_PRINT: hid_init(): scanning for USB busses...
  TRACE_PRINT: hid_init(): scanning for USB devices...
 NOTICE_PRINT: hid_init(): successfully initialised HID library.
  TRACE_PRINT: hid_new_HIDInterface(): creating a new HIDInterface instance...
  TRACE_PRINT: hid_force_open(): forcefully opening a device interface according
 to matching criteria...
  TRACE_PRINT: hid_get_usb_handle(): acquiring handle for a USB device...
  TRACE_PRINT: hid_find_usb_device(): enumerating USB busses...
  TRACE_PRINT: hid_find_usb_device(): enumerating USB devices on bus bus-0...
  TRACE_PRINT: hid_find_usb_device(): inspecting USB device bus-0/\\.\libusb0-00
01--0x04d8-0...
  TRACE_PRINT: hid_compare_usb_device(): comparing match specifications to USB d
evice...
  TRACE_PRINT: hid_compare_usb_device(): inspecting vendor ID...
  TRACE_PRINT: hid_compare_usb_device(): no match on vendor ID.
  TRACE_PRINT: hid_compare_usb_device(): inspecting product ID...
  TRACE_PRINT: hid_compare_usb_device(): no match on product ID.
  TRACE_PRINT: hid_compare_usb_device(): no custom matching function supplied.
 NOTICE_PRINT: hid_find_usb_device(): vendor 0x04d8 of USB device bus-0/\\.\libu
sb0-0001--0x04d8-0 does not match 0x05ac.
WARNING_PRINT: hid_find_usb_device(): no matching USB device found.
hid_force_open failed with return code 7

G:\USB\libusb_winusb\libhidwin32\libhid-0.2.16\libhid\Debug>test
 NOTICE_PRINT: hid_init(): libhid 0.2.16.0.0 is being initialized.
  TRACE_PRINT: hid_init(): initialising USB subsystem...
  TRACE_PRINT: hid_init(): scanning for USB busses...
  TRACE_PRINT: hid_init(): scanning for USB devices...
 NOTICE_PRINT: hid_init(): successfully initialised HID library.
  TRACE_PRINT: hid_new_HIDInterface(): creating a new HIDInterface instance...
  TRACE_PRINT: hid_force_open(): forcefully opening a device interface according
 to matching criteria...
  TRACE_PRINT: hid_get_usb_handle(): acquiring handle for a USB device...
  TRACE_PRINT: hid_find_usb_device(): enumerating USB busses...
  TRACE_PRINT: hid_find_usb_device(): enumerating USB devices on bus bus-0...
  TRACE_PRINT: hid_find_usb_device(): inspecting USB device bus-0/\\.\libusb0-00
01--0x04d8-0...
  TRACE_PRINT: hid_compare_usb_device(): comparing match specifications to USB d
evice...
  TRACE_PRINT: hid_compare_usb_device(): inspecting vendor ID...
  TRACE_PRINT: hid_compare_usb_device(): match on vendor ID: 0x04d8.
  TRACE_PRINT: hid_compare_usb_device(): inspecting product ID...
  TRACE_PRINT: hid_compare_usb_device(): match on product ID: 0x0033.
  TRACE_PRINT: hid_compare_usb_device(): calling custom matching function...
  TRACE_PRINT: hid_compare_usb_device(): match on custom matching function.
 NOTICE_PRINT: hid_find_usb_device(): found a matching USB device bus-0/\\.\libu
sb0-0001--0x04d8-0.
  TRACE_PRINT: hid_force_open(): claiming USB device bus-0/\\.\libusb0-0001--0x0
4d8-0.
WARNING_PRINT: hid_os_force_claim(): code not tested on the Darwin platform!
  TRACE_PRINT: hid_os_force_claim(): claiming USB device bus-0/\\.\libusb0-0001-
-0x04d8-0...
WARNING_PRINT: hid_os_force_claim(): failed to claim USB device bus-0/\\.\libusb
0-0001--0x04d8-0...
 NOTICE_PRINT: hid_force_open(): successfully claimed USB device bus-0/\\.\libus
b0-0001--0x04d8-0.
  TRACE_PRINT: hid_init_parser(): initialising the HID parser for USB Device bus
-0/\\.\libusb0-0001--0x04d8-0...
  TRACE_PRINT: hid_init_parser(): allocating space for HIDData structure...
  TRACE_PRINT: hid_init_parser(): successfully allocated memory for HIDData strc
ture.
  TRACE_PRINT: hid_init_parser(): allocating space for HIDParser structure...
  TRACE_PRINT: hid_init_parser(): successfully allocated memory for HIDParser st
rcture.
 NOTICE_PRINT: hid_init_parser(): successfully initialised the HID parser for US
B Device bus-0/\\.\libusb0-0001--0x04d8-0??
  TRACE_PRINT: hid_prepare_hid_descriptor(): initialising the HID descriptor for
 USB device bus-0/\\.\libusb0-0001--0x04d8-0??..
  TRACE_PRINT: hid_prepare_hid_descriptor(): retrieving HID descriptor for USB d
evice bus-0/\\.\libusb0-0001--0x04d8-0??..
 NOTICE_PRINT: hid_prepare_hid_descriptor(): successfully initialised HID descri
ptor for USB device bus-0/\\.\libusb0-0001--0x04d8-0??(12928 bytes).
  TRACE_PRINT: hid_prepare_report_descriptor(): initialising the report descript
or for USB device bus-0/\\.\libusb0-0001--0x04d8-0??..
  ERROR: hid_prepare_report_descriptor(): report descriptor size for USB device
bus-0/\\.\libusb0-0001--0x04d8-0??exceeds maximum size: 12928 > 6144.

  TRACE_PRINT: hid_close(): closing USB device bus-0/\\.\libusb0-0001--0x04d8-0?
?..
  TRACE_PRINT: hid_close(): releasing USB device bus-0/\\.\libusb0-0001--0x04d8-
0??..
WARNING_PRINT: hid_close(): failed to release USB device bus-0/\\.\libusb0-0001-
-0x04d8-0??
  TRACE_PRINT: hid_close(): closing handle of USB device bus-0/\\.\libusb0-0001-
-0x04d8-0??..
 NOTICE_PRINT: hid_close(): successfully closed USB device bus-0/\\.\libusb0-000
1--0x04d8-0??
  TRACE_PRINT: hid_reset_parser(): resetting the HID parser for USB device bus-0
/\\.\libusb0-0001--0x04d8-0??..
  TRACE_PRINT: hid_close(): freeing memory allocated for HID parser...
  TRACE_PRINT: hid_close(): resetting HIDInterface...
************************************************************************
  ERROR: hid_write_identification(): cannot write identification of unopened HID
interface.
WARNING_PRINT: hid_close(): attempt to close unopened USB device .
  TRACE_PRINT: hid_close(): freeing memory allocated for HID parser...
  TRACE_PRINT: hid_close(): resetting HIDInterface...
  TRACE_PRINT: hid_force_open(): forcefully opening a device interface according
 to matching criteria...
  TRACE_PRINT: hid_get_usb_handle(): acquiring handle for a USB device...
  TRACE_PRINT: hid_find_usb_device(): enumerating USB busses...
  TRACE_PRINT: hid_find_usb_device(): enumerating USB devices on bus bus-0...
  TRACE_PRINT: hid_find_usb_device(): inspecting USB device bus-0/\\.\libusb0-00
01--0x04d8-0...
  TRACE_PRINT: hid_compare_usb_device(): comparing match specifications to USB d
evice...
  TRACE_PRINT: hid_compare_usb_device(): inspecting vendor ID...
  TRACE_PRINT: hid_compare_usb_device(): match on vendor ID: 0x04d8.
  TRACE_PRINT: hid_compare_usb_device(): inspecting product ID...
  TRACE_PRINT: hid_compare_usb_device(): match on product ID: 0x0033.
  TRACE_PRINT: hid_compare_usb_device(): calling custom matching function...
  TRACE_PRINT: hid_compare_usb_device(): no match on custom matching function.
 NOTICE_PRINT: hid_find_usb_device(): custom matching function returned false on
 bus-0/\\.\libusb0-0001--0x04d8-0.
WARNING_PRINT: hid_find_usb_device(): no matching USB device found.
 NOTICE_PRINT: hid_cleanup(): successfully deinitialised HID library.

The HID device is PICkit 2 (http://www.microchip.com/pickit2). I am
using the libusb-win32 device driver.

Xiaofan











Xiaofan



More information about the libhid-discuss mailing list