Skip to content

Is it possible to send/read data from/to HID-keyboards under Windows? #403

Answered by Youw
xcme asked this question in Q&A
Discussion options

You must be logged in to vote

I see 3 or 4 entries for my keyboard

Windows creates a separate logical HID device for each (top-lelvel) usage_page/usage pair (see official doc: https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/top-level-collections).

The hid_open function has optional 'serial' parameter

hid_open is not sufficient for this purpose. You need to use hid_enumerate, and find a specific device with specific VID+PID+SerialNumber+USAGE+USAGE_PAGE.
E.g.: HID_USAGE_PAGE_GENERIC/(HID_USAGE_GENERIC_MOUSE|HID_USAGE_GENERIC_KEYBOARD) is never allowed direct access using HIDAPI on Windows. That is an OS limitation.

By opening first device (usage_page/usage) there is a high chance you get the Keyboard …

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by xcme
Comment options

You must be logged in to vote
1 reply
@Youw
Comment options

Comment options

You must be logged in to vote
3 replies
@Youw
Comment options

@JordanChiang
Comment options

@xcme
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants