Detecting USB keyboard and changing keyboard mapping...

Kent Dahl kentda at
Sun Oct 26 15:18:37 EDT 2008

I'm curious as to whether it is possible to easily detect when a USB
keyboard is plugged in and then change the keyboard mapping based on it.

Reason I ask is because I frequently plug a USB keyboard into the OLPC
for any non-trivial typing. For the kids, it will often still be a bit
hunt-and-peck, which means when using the embedded keyboard, it needs to
keep the default (us) mapping. But when an external is plugged in, it
really should be remapped, or the hunting will be in vain.

I can easily run setxkbmap manually whenever I need to do this, and set
up a simple Activity to do this switching in a GUI, but hopefully there
is a more automated alternative.

P.S.: Of course, writing this I realized that the ideal solution would
be to have one set of mappings for keypresses from the embedded and
another for the USB keyboard, but I have no idea as to where to begin
looking at that...

Kent Dahl <kentda at>  ---

More information about the Devel mailing list