Closed mscheper closed 1 month ago
HID codes are not scan codes. First are converted to last ones by OS.
@kriomant: Okay. So I assume the HID codes are the ones between angular brackets, and the scan codes are the ones that showkey
shows. And from trial and error, I'm finding that the HID codes largely match the _Universal Serial Bus HID Usage Tables_ you linked to.
But it's far from a complete match, and that's part of why I was confused. e.g. According to Cinnamon Seetings' keyboard shortcut settings, <104>
is tools; <105>
to <109>
are launch5 to launch9; <110>
is just '0xc5'; <111>
is mic mute; <112>
is toggle touchpad; <113>
is touchpad on. I imagine it depends on the OS, and hopefully I can find what I want from trial and error.
You might want to add a note about that, to where you link to that document. (I can't actually find where that link is right now, though, so maybe you already got rid of it?) And if there's a way to find out what a HID code is from python -m keyboard
, then that's not clear to me, either.
Thanks for the reply.
So my laptop has eight function keys, including the brightness adjustment keys I'm interested in, that do show up in keyboard.py and the Cinnamon keyboard configuration tool, but none of the HID codes trigger them. (HID codes higher than <145>
in the YAML file, FWIW, don't produce any scan codes at all, in either tool.)
I suspect we're limited by the hardware, but is it possible to add a feature in your program to trigger scan codes, instead of HID codes? Maybe then I could get the screen brightness codes to work? (It'd be really nice to just turn a knob to turn down the brightness on my screen, instead of having to fumble for a key combination I never seem to remember when it's still dark in the morning.)
There are command line tools that I could launch to adjust the brightness when I press a key, but I suspect they won't perform as well as whatever's responding to the keypresses.
Actually, I've found another way: In Cinnamon Settings, I can go to Keyboard→Shortcuts→System→Hardware and create additional keyboard shortcuts for brightness adjustments there. I just used <137>
and <140>
, which Cinnamon sees as otherwise unused hex codes. Perhaps my feature request might still be useful for somebody else, but I no longer need it, so I don't mind if you close this.
Cheers.
I've uploaded the following config for my 3×4 two-knob keyboard [extract only]:
I have the keyboard set to the relevant layer, and verified that the letters
a
,e
,f
andj
function as expected. But unless I'm misunderstanding something, the HID codes,<100>
,<124>
and<125>
, don't match what's actually being sent, as reported by the keyboard monitor.python -m keyboard
actually outputs the following, when I press those three keys in order:<224>
and<225>
, which bothpython -m keyboard
andshowkey
report are the codes for my brightness adjustment keys (Fn+F5 and Fn+F6 on my keyboard, FWIW), don't produce any output at all.All the other functions I've tried (namely
wheelup
,wheeldown
,volumeup
,volumedown
,mute
,power
,screenlock
) work as expected.Am I misunderstanding these keyboard codes and how they're specified, or is there something else I can try?
Thank you for maintaining this program.