-
Notifications
You must be signed in to change notification settings - Fork 403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hid_enumerate method issue on windows #325
Comments
Imagine yourself on my place here and read your own message: "It works on Linux, but doesn't work on Windows. Help." Do you think you've provided enough information for anyone to help you? |
@Youw sry bro, my bad, I just tried using libusb of windows version to open my device, it still can't be detected. here is the code I used for both libusb and hidapi:
both init are successful, but the pointer is still null here is my usb device info:
|
and I am a newbie of dealing with hid devices, like I am stuck in how to debug further, can you instruct what me I should do for debugging if you need more information?thanks I used the application in https://github.com/libusb/hidapi/files/6966661/hidapi_libusb2.zip, the device can be found, do I miss some dlls stuff? Now I am using the dll below and its imported lib for libusb on windows:
These two for hidapi:
|
|
So you have a working sample of the app that successfully enumerates your device. I can only suggest to compare the implementation or try using debugger and go by-step to figure out the step where it fails. |
@Youw I wrote a simple separated script using the link u provide, but why I am getting different list of output without un-plugging any of my device :
|
does this mean there is a conflict between that Synaptics touchpad driver and my HID device that HIDAPI can not resolve ? |
That is a possible reason. HIDAPI doesn't handle any drivers on Windows. It just uses WinAPI, and it is up to Windows runtime to provide the list of the devices and its capabilities. A fautly 3rdparty driver can affect devices it is not directly related to, and in such cases there is practically nothing a user application can do about it. |
@Youw ok I see . And I am wondering what is the back end of this https://github.com/libusb/hidapi/files/6966661/hidapi_libusb2.zip test .exe using ? is it possible I can use libusb as back-end instead of winAPI on Windows ? If so how can I specify it in CMAKE script , thanks. |
It is theoretically possible, but you'd have to replace a standard HID driver for you device with a WinUSB or UsbDk driver so the device will be available via libusb. |
@JunzheFan It is interesting that you can find your device with the hack libusb backend. Supposedly it will find less device (eg: no mouse and keyboard) than the current hidapi codes. |
@JunzheFan Can you post your Windows Device Manager screenshot about your device? And post the output of USBTreeView. Thanks. It is also good to use linux and post the output of "lsusb -vvv". And you can run the "hidtest.exe" from here (or you can build your own from latest git head source codes) and post the output? |
I have encountered issues with some applications using Windows HID API (Microchip PICKit 2 with the old PC Application using C#) since the application seems to have some conflict with Microsoft/Logitech mouse, but I have no issues with hidapi. |
BTW, USB Device Tree Viewer will tell you the driver used. |
#319 is a quick hack to have the HIDAPI libusb backend to work under Windows.
|
thanks for the clarification, the driver it used is Driver : C:\WINDOWS\System32\Drivers\FPGATEST.SYS |
In that case, it is for sure hidapi and libusb HID backend can not find your device. So it makes sense the following two pieces of codes will not be able to find your device. So this is not an HIDAPI problem.
In order for your device to be found by HIDAPI (normal Windows HID backend), then you need to have the device bound to the supported kernel HID drivers (hidusb.sys, hidcalss.sys, etc; or keyboard/mouse driver for keyboard/mouse) -- basically your device needs to be listed under Windows Device Manager --> "Human Interface Devices" or "keyboards" or "Mice and other pointing devices". Your device is probably not Mouse or keyboards so the latter two may not apply. In order for your device to be found by the libusb HID backend, your device needs to be under Windows Device Manager as "Human Interface Devices" --> "USB Input Device". Keyboard/mouse and bluetooth or I2C/SPI HID devices are not supported. But it is not recommended to use libusb HID backend because of all the limitations. So we recommend you to use HIDAPI instead. In order for your device to be found by the libusb WinUSB backend, you need to use Zadig to replace your device driver to WinUSB, then you can use hidapi_libusb2.zip with your device. But take note it is just a quick hack and not supported by HIDAPI project. |
However, I think your device is a USB Composite Device. FPGATest.sys seems to be the driver for the audio portion. Please post the output of "lsusb -vvv" for your device under Linux. And post the complete output of USB Device Tree Viewer of your device. |
Anyway, this is not an issue with hidapi then. As it is expected behavior. So I will close the issue. But you can continue to comment to see if there is a possibility to switch to hidusb.sys (if indeed it is compliant to HID specification) or you need to use WinUSB driver (take note HID libusb backend is not yet supported under Windows). |
Hi, I am not sure this hid_enumerate function can't find one of my HID devices somehow under Window platform, then I transferred the exact same code to my Linux machine using libusb backend, this device successfully got detected, any idea why?
The text was updated successfully, but these errors were encountered: