Ubuntu: Using the Euro and Dollar Special Keys
What’s the problem
The Danish version of Acer Travelmate 5515 (5510 series) has the following keyboard layout:
Ignore that it is a Danish keyboard layout and in stead focus on the € and $ keys above the arrow keys.
The € and the $ keys above the left and right arrow key respectively are dead with the standard install of ubuntu 12.04 (with standard Danish keyboard layout).
I wanted to have [page up] where the € is and [page down] where the $ is. Like this:
This is a fairly common layout (this is from a Fujitsu Celsius H710 laptop) and I think it makes perfect sense to have all the navigation keys close to each other.
How?
To remap your the € and $ keys to [page up] and [page down] on acer add the lines:
setkeycodes 0xB3 104
setkeycodes 0xB4 109
to the ` /etc/rc.local ` file (before the exit 0
line) Step I did:
- open a terminal window.
- execute the command
sudo nano /etc/rc.local
- I like the nano editor, but use what you like. -
Add the mentioned lines (
setkeycodes 0xB3 104 setkeycodes 0xB4 109
) and save and exit ` ctrl-x -> y ` (for yes to saving) ->enter
(to save as /etc/rc.local) - reboot
- Enjoy the new keybindings
What’s behind the Magic?
The setkeycodes
command maps scancodes to keycodes.
So setkeycodes 0xB3 104
maps scancode hex B3 (the € key) to keycode decimal 104 (which is [page up])
But how did I know want scancode and keycode to use. Good question. The short answer is:
-
Scancodes
execute the command/lib/udev/findkeyboards
this should return something likeAT keyboard: input/event4
where the 4 could be another number.
Now execute the commandsudo /lib/udev/keymap -i input/event4
(replacing 4 with “input/event[number]” you got from the previous command.). Press the key you want to (re)map and note the scancode. To break the program hit escape. Don’t be really sleepy when you do this! :p
One caveat: if the scancode is above 0xFF you are out of luck due to this bug. Otherwise go on and find the keycode! -
Keycodes
in the file /usr/include/linux/input.h under the section “Keys and buttons” you can see which keys are mapped to what decimal number. Go ahead and find the key you want to map your scancode to.
Further reading:
- On your local file system there is a walkthrough for fixing key problems in the file /usr/share/doc/udev/README.keymap.txt.gz
sudo gunzip /usr/share/doc/udev/README.keymap.txt.gz
to extract the file.nano README.keymap.txt
to read the file.- start reading at the
==fixing broken keys==
section
- Post which includes solution similar to this: http://ubuntuforums.org/showthread.php?t=1286534
- Other solutions to problems with key on Ubuntu http://askubuntu.com/questions/133113/emulate-keypad-on-laptop/142339#142339 http://askubuntu.com/questions/141479/dell-inspiron-n5110-keyboard-touchpad/144207#144207 http://askubuntu.com/questions/145589/how-to-change-the-functionality-of-keyboard-special-keys