a1ien/rusb

How to read an usb keyboard entry in windows 11?

Closed this issue · 3 comments

I used an example read_device.rs to read USB keyboard devices through pid vid and attempted to read content from them, but reported an Io error。
Active configuration: 1, Languages: [Language { raw: 1033 }], Manufacturer: Some("SM"), Product: Some("SM-2D PRODUCT HID KBW"), Serial Number: Some("APP-000000000"), Reading from endpoint: Endpoint { config: 1, iface: 0, setting: 0, address: 129 }, kernel driver? false, could not read from endpoint: Input/Output Error, No readable bulk endpoint
what can i do?

then i replace the hid keyboard device with libusb win32, it works, but i can't decode the [u8] from read, like this [0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

a1ien commented

Please read this. https://github.com/libusb/libusb/wiki/Windows#how-to-use-libusb-on-windows
If you want get what key preset on keyboard you should use another library.

Please read this. https://github.com/libusb/libusb/wiki/Windows#how-to-use-libusb-on-windows If you want get what key preset on keyboard you should use another library.

Can you recommend a library?