How to easily map PS/2 scan code to HID usage id?
Okay, I have a gadget I want to reconfigure. Only problem: The configuration file wants the HID usage id for keyboards.
What I can do under C#: Get the Virtual Keycode or the PS/2 scan code through KeyEventArgs upon KeyUp/KeyDown.
What I need: The HID usage id.
Now, what I found is a nice table (see below) which translates the scan codes into usage ids and back. However, that thing is 3 pages long and would require me to type it down.
Simply searching for "c# HID usage id keyboard" and similar yielded only lots of unwanted results. Does somebody know of an easier way to get this?
translate.pdf (133.2 KB)
I found what looks like what you want in this header file:
Edit: Nope, that isn't what you want after all...
Hardcoding conversion table is the only way to convert it, from what I've seen. If you don't want to write it down all by yourself, don't worry - someone did it already, so you can just
stealthis file: https://chromium.googlesource.com/chromium/src/+/3b0960abbbec966773b933a686677485aaf1a4e4/ui/events/keycodes/dom/keycode_converter_data.inc
From what I understood, this table contains mappings from USB codes to scancodes of various operating systems. Regex that would convert this macro abomination into something useful shouldn't be too hard to write.
that thing is 3 pages long and would require me to type it down
pdftotext -layoutdoes a not completely horrible job of converting that to text that it shouldn't take vast amounts of editor fuckery to whip into whatever shape you need.