I want to capture raw data from a USB mouse using libusb library by C#.

I can read data with the UsbEndpointReader class, but there is a problem.

When I try to read data it seems that Windows tries to read too, and I can't read all data and the OS can't either, because mouse movements have some steps. I want to read all data and let the OS read those data too (I mean without problem in moving the cursor).

Another problem that I have is that I don't know how can I get HID descriptor. I know it's possible by calling GetDescriptor method, but how can I do it?

有帮助吗?

解决方案

To prevent conflict with Windows reading from the mouse, you should disable the associated mouse instance in Device Manager.

If you want shared access to mouse data, use a low-level mouse hook, not libusb. If you really want it in USB HID message format, you can use a filter driver to get a copy of every request and response Windows gets from the device.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top