pc-keyboard icon indicating copy to clipboard operation
pc-keyboard copied to clipboard

Implement USB HID scancodes ?

Open CHiPs44 opened this issue 2 years ago • 2 comments

It's perhaps a silly question, but should this library implement USB HID scan codes, too?

Feel free to close this ASAP if I'm completely out of subject.

CHiPs44 avatar Dec 03 '23 07:12 CHiPs44

No it's a great question. I have wondered this, but I personally have not needed such support so I didn't write it.

It makes sense though as it's a well defined language-agnostic standard that sits alongside ScanCode Set 1 and Set 2. One issue might be though that the modifiers come as a bitfield in USB HID rather than individual keystrokes, so you'd need an API to set them all manually before feeding in key codes. HID again only gives you "is currently down" so you need a mechanism to remember what was down last time and pop up anything that is not still down (and press anything that just went down). So it's not just as easy as copying Set 2 and changing the numbers.

thejpster avatar Dec 03 '23 11:12 thejpster

Thanks!

It seems there are many libraries (even in Rust) handling USB HID devices, so inspiration or inclusion should not be too cumbersome.

CHiPs44 avatar Dec 04 '23 08:12 CHiPs44