mcuee / libusb-win32

libusb-win32 project official github repo
179 stars 49 forks source link

usb_find_devices() return 0 #69

Closed dythj closed 6 months ago

dythj commented 6 months ago

when I calling interface usb_find_devices(),it return 0. But it works on the other computer and return 1

mcuee commented 6 months ago

Did you install the libusb0.sys driver for at least one device?

dythj commented 6 months ago

Do you mean I need to run install-filter.exe to install the driver?

I ran install-filter.exe and install-filter-win.exe, install-filter.exe was crashed, install-filter-win.exe installed the driver, but my device stopped working

dythj commented 6 months ago

Here's a comparison of the two results

Snipaste_2024-04-23_18-47-03

Snipaste_2024-04-23_18-49-40

mcuee commented 6 months ago

filter driver is not guarateed to work. Please post your device details to the following issue.

Are you saying that the filter driver version 1.2.6 works with the USB keyboard but not 1.4.0 version?

Does device driver mode work? You need to use Zadig to install the device driver (replacing the system USB keyboard driver).

dythj commented 6 months ago

Quote: Are you saying that the filter driver version 1.2.6 works with the USB keyboard but not 1.4.0 version?

These two images are the result of two computers running out, one computer can find the device, the other can't

Quote:Does device driver mode work? You need to use Zadig to install the device driver (replacing the system USB keyboard driver).

I tried to use the Zadig software to reverse the driver, but I plugged the device into the computer and couldn't find the device

Snipaste_2024-04-23_19-10-41

mcuee commented 6 months ago

You have to select Options -- List All Devoces.

And you have to use the custom version of Zadig here. https://github.com/mcuee/libusb-win32/releases/tag/release_1.4.0.0

dythj commented 6 months ago

When I install WinUSB driver on my device, the device will not run, but installed libusb-win32 driver will run, do you know the difference between the two drivers?

mcuee commented 6 months ago

When I install WinUSB driver on my device, the device will not run, but installed libusb-win32 driver will run, do you know the difference between the two drivers?

Device driver will replace the original driver -- so your keyboard function will be gone. Filter driver will not replace the original driver -- so your keyboard function will still be there. But it is not guaranteed to work, as mentioned in the Wiki and Issue #35.

Anyway, if you want to play with the USB Keyboard, please do not use libusb-win32, it is not the right library.

If you want to play with generic HID device, then you may want to consider HIDAPI instead. But it may not be the right library either for keyboard/mouse. https://github.com/libusb/hidapi

dythj commented 6 months ago

Ok,I will try it.Anyway, problem solved. Thank you!!