Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am using a keyboard with the "fn" key. This is on a laptop.

So my FN + Up/down/left/right keys are mapped to brightness/volume. I would much rather them be mounted to page up/down, home/end. And map the other 4 keys to these 2. The page up/down has FN+ them for home/end. Its a shitty keyboard layout but I want to make it work.

Anyone knows how to figure out what the keycodes are and how to remap them?

Version: 10.04 x32

So here are some experiments:

Using xmodmap -pke I discovered that keycodes 122 = vol down, 123 = vol up. And I got all the info for Home/End/Page Up (next), Page Down (prior).

Now when using the vol up keys, there are no events being fired that xev can detect.

I can remap the volume keys to XF86AudioLowerVolume or XF86AudioRaiseVolume, but once I map those two to Home/End (respectively) they don't do anything. xev still does not pick up these events after a remap.

Remap: xmodmap -e "keycode 122 = Home"

share|improve this question
    
Related question: superuser.com/questions/377063/mapping-keys-on-linux –  Ondra Žižka Jan 11 '12 at 3:04
add comment

3 Answers 3

Some laptop Fn key combinations are multimedia keys (appearing to the OS as ordinary keys with nonstandard codes), while others trigger ACPI events that eventually reach the OS, and some are just handled by the BIOS and never seen by the OS. The information paths are explained on the Hotkeys/Architecture page on the Ubuntu wiki, complete with diagrams.

The KeyTouch program should handle anything that is seen by the OS, and has a friendly GUI for describing your model and configuring what the keys should do (install the keytouch-editor package as well as keytouch).

If the OS can't see anything when you press the brightness keys, it could be because they're handled directly by the BIOS. The battle is not completely lost — it is in principle possible to hack the BIOS — but the difficulty level is considerably raised.

share|improve this answer
    
Wow! Thanks! I will try this ASAP! –  Dmitriy Likhten Oct 6 '10 at 15:24
add comment

There is a program called xev that does what you require. I liked the tutorial on setting it up.

share|improve this answer
    
I'll definitely look into it, thanks. –  Dmitriy Likhten Aug 16 '10 at 18:14
1  
that probably because these keys are mapped directly to graphic card or sound card :) –  myusuf3 Aug 16 '10 at 18:56
1  
@Dmitriy: Maybe some of the Fn key combinations produce ACPI events rather than keyboard events. Look in /var/log/kern.log if something appears when you press these key combinations. Even if nothing appears, there may be ACPI events that you can get to see if you use the right tools (sorry, I don't know what the right tools are). –  Gilles Aug 16 '10 at 19:45
1  
The program that remaps is xmodmap; xev is just used to view events. –  Roger Pate Aug 19 '10 at 5:40
2  
-1 dead link for the tutorial. Any chance you copied this info or is it lost forever? –  Tom Brossman Jul 13 '12 at 5:42
show 5 more comments

The Fn key combinations is not defined in software and can therefor not be redefined, so you need a soldering iron and some electronics knowhow!

share|improve this answer
    
What??? No I don't care about making the FN key different. Just re-map the events associated with the FN key. As in FN + Left = Volume Down event that the computer recognizes, I just want to change the effect of the event so it appears as if I pressed Home. I mean the keyboard layout is what defines what key does what, how do I modify that. –  Dmitriy Likhten Aug 16 '10 at 17:44
3  
I clearly didn't express my self clearly! But you cant change the predefined values. These combinations doesn't send signals to the OS but directly to the graphics-card/sound-card. –  Source Lab Aug 16 '10 at 18:20
    
Oh! Though the OS does recognize that the brightness is changing and the volume too to show this information in the GUI. –  Dmitriy Likhten Aug 16 '10 at 19:05
3  
@Source Lab: On most laptops produced this century or thereabouts, all recognized Fn key combinations either trigger keyboard events or ACPI events. Keyboard events go to the OS; ACPI events can be handled by the BIOS but the OS can intercept them. –  Gilles Aug 16 '10 at 19:42
    
@Gilles Oh. I didn't know that newer computers will send keyboard events. –  Source Lab Aug 16 '10 at 20:15
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.