reox
reox

Reputation: 5252

Sending the right HID Keycode?

I'm currently developing a very smal and specific HID Keyboard with a atmega microcontroller. The biggest problem i have is that a keycode is very specific for the locale that is currently set on the host pc.

All normal chars like a-z are working very well but some special chars are producing bad results when the key is pressed.

For example the + Key, which is 0xE1 & 0x2E (LeftShift & KeyboardEqualSign) does only work on a US Keyboard. But i use a German Layout, so i get a ß instead.

How can i now get the right keycodes for the German Layout? I cant find any document that describes such keys... I think the HID Keycodes are really bad designed to support multiple keyboard layouts :(

Do i need to lookup my keys on a german layout what they would be in us? So for the + Sign its probably the ] key? But why the heck its a so stupid design? Is there any wrapper for that?

Upvotes: 2

Views: 2626

Answers (1)

F. K.
F. K.

Reputation: 101

had the same problem. I took a picture of an en_us keyboard and compared it to my german keyboard and then I transfered that on the keycodes... Its not yet finished because its a suprisingly lot of work and I do not need other characters right now. Most important characters should be there. Its sorted after Iso8859, I let the iso codes stay maybe that helps someone.

Here you go:

iso8859 hex code, modifier, usb hid keycode, character

  • 0x22, shift,0x1F , "
  • 0x23, 0,0x31 , #
  • 0x24, shift,0x21 , $
  • 0x25, shift,0x22 , %
  • 0x26, shift,0x23 , &
  • 0x27, shift,0x31 , '
  • 0x28, shift,0x25 , (
  • 0x29, shift,0x26 ,
  • 0x2A, shift,0x30 , *
  • 0x2B, 0,0x30 , +
  • 0x2C, 0,0x36 , ,
  • 0x2D, 0,0x38 , -
  • 0x2E, 0,0x37 , .
  • 0x2F, shift,0x24 , /
  • 0x30 to 0x39 are the numbers, no changes here to en_us
  • 0x3A, shift,0x37 , :
  • 0x3B, shift,0x36 , ;
  • 0x3C, 0,0x64 , <
  • 0x3D, shift,0x27 , =
  • 0x3E, shift,0x64 , >
  • 0x3F, shift,0x2D , ?
  • 0x40, altgr,0x14 , @ *Upper case letter, no changes here to en_us
  • 0x59, shift,0x1D ,switch Z,Y
  • 0x5A, shift,0x1C;
  • 0x5B, altgr,0x25 , [
  • 0x5C, altgr,0x2D , "\"
  • 0x5D, altgr,0x26 , ]
  • 0x5E, 0,0x35 , ^
  • 0x5F, shift,0x38 , _
  • 0x60, shift,0x2E , ` *lower case letters, no changes here to en_us
  • 0x79, 0,0x1D ,switch z,y
  • 0x7A, 0,0x1C
  • 0x7B, altgr,0x24 , {
  • 0x7C, altgr,0x64 , |
  • 0x7D, altgr,0x27 , }
  • 0x7E, altgr,0x30 , ~ *0x80 to 0x9F not in use 0xA0 Not existing "nonbreaking space"
  • havent done yet
  • 0xC4, shift,0x34 ,Ä
  • havent done yet
  • 0xD6, shift,0x33 ,Ö
  • havent done yet
  • 0xDC, shift,0x2F ,Ü
  • havent done yet
  • 0xE4, 0,0x34 , ä
  • havent done yet
  • 0xF5, 0,0x33 ,ö
  • havent done yet
  • 0xFC, 0,0x2F ,ü
  • havent done yet

Hope that helps you or the next stumbling upon that problem :)

Best regards

Upvotes: 1

Related Questions