PORTS Forum
Ports and Interfaces => USB => Topic started by: Dobaz on May 14, 2013, 10:29:06 pm
-
Hi,
I have a device that emulates a hid keyboard. I can't make it send the windows key (left or right).
For the left windows key (LeftWin), I read on MSDN that the key code is 0x5B. It doesn't work. I also read from USB org that the code is 0xE3. It doesn't work. I also read that we need two bytes to send this key code 0xE05B. I can't make it work.
How to send this key to the computer?
Thanks a lot
-
The HID Usage Tables doc says Usage Page 07 and Usage IDs E3 and E7.
http://www.usb.org/developers/hidpage/
-
You can do the Win keys (also known as GUI keys) in two ways, both of which are "normal" keys (versus multimedia/consumer control keys).
One is to report them as up/down using bits in the modifier byte of the key report, the other is to send the codes like regular keys. In the latter case it's 0xE3 or 0xE7. Both methods seem to be widely supported. If you are using them as modifiers you need to keep them down while you add in the second key. Also make sure your HID report is standard enough to support those codes (that is don't set you max value lower than E3).
So the process for a modifier would be to report the Win key code. Then report the Win key code plus whatever it's modifying (like Win+A for instance). Then report the Win code. Then report all zeroes. If you just want the Win key by itself just skip the report with the A key.
0xE05B is wrong, that sounds like a PS/2 code.
GB
-
Both methods seem to be widely supported.
All the keyboards I've seen (which admittedly is not very many) report the modifier keys as a bit-map, not as "regular" keys. I think the modifier keys are grouped together (E0-E7) for this specific reason.
-
Thanks to all of you.
I made it a modifier and it works now. I didn't think it could be treated as a modifier.
Thanks again.