Send language layout from USB HID keyboard


26 Apr 2019, 08:00

I am currently working on a USB HID keyboard using an Atmel microcontroller. Everything is working fine but I usually use different keyboard layouts on different machines.

Now I started wondering if it would be possible to tell the host which keyboard layout to use, i.e. EN-US, so that keycodes will always get mapped on the right character on every machine. Any ideas?


26 Apr 2019, 12:53

The layout is usually just set in the operating system. In many operating systems you can have multiple keyboard layouts and swap between them (and/or language) with a key combination or tray icon (or similar). I think it is LAlt+Shift in MS Windows and Super+Space in Gnome in Unix/Linux viarants.

In the keyboard there is the bCountryCode field in the HID Descriptor but I don't think any OS actually acts on it, and it would be sent to the host only when the device restarts: so you would have to modify your firmware to do that as well.

Post Reply

Return to “Reviews”