Ubuntu: How to remap Fn Key combinations?


I want to do some advanced key mapping on my Sony VAIO. It involves the Fn key. This is what I want to do:

I want to do a Fn key inversion, ie to remap: [Fn+ F2toF7] on my keyboard to [F2 to F7] soft keys respectively. After the remap, I want other key combinations involving the function keys to work as usual (like Alt+F4), if possible.

This will come in handy because I never use function keys other than in a key combination. Also I use the volume and brightness controls a lot (Fn+ F2toF7).

I've googled around and found this on another ask-ubuntu question:

The Fn key usually doesn't send a key code; it's handled by the BIOS, not by the OS. You can sometimes get at it as an ACPI event.

At this point I have checked the BIOS, and I can't change it from there.

I found that when I press these combinations, it triggers ACPI events. Here is the output when I sequentially press Fn+ F2toF7:

Fn + F1 (Toggle TouchPad, not working) press down:  button/fnf1 FNF1 00000080 00000000 K  sony/hotkey SNY5001:00 00000001 0000000c    Fn + F1 release:  sony/hotkey SNY5001:00 00000001 0000003b    Fn + F2 press down:  button/mute MUTE 00000080 00000000 K    Fn + F3 press down:  button/volumedown VOLDN 00000080 00000000 K    Fn + F4 press down:  button/volumeup VOLUP 00000080 00000000 K    Fn + F5 press down:  video/brightnessdown BRTDN 00000087 00000000    Fn + F6 press down:  video/brightnessup BRTUP 00000086 00000000    Fn + F7 release:  video/switchmode VMOD 00000080 00000000 K  sony/hotkey SNY5001:00 00000001 00000012    Fn + F7 release:  sony/hotkey SNY5001:00 00000001 0000003b  

I've observed that ACPI events are triggered only when the special key combinations are pressed, ie no event is generated if I press Fn+A. So I can't assign short cuts like Fn+A, but can't I somehow manipulate the key combinations for which ACPI events are triggered?

Edit: I found keyboard mapping of scan codes to key codes in /lib/udev/hwdb.d/60-keyboard.hwdb. It's relevant sections are posted here. But the udev configuration is overridden by something else, because I swapped the vol up and mute keys, and the change was not reflected even after a reboot.

Edit 2: Output of X event of each key [Fn+ F2toF7] using xev -event keyboard.


Your question is a little confusing. I am assuming that you want to change Fn + F# to register as F# for all function keys F1 through F12.

Your information on this is correct. This cannot be done through the OS. It has to be done through BIOS. Go through all the options in BIOS once again, I am pretty sure you will be able to find it. If not, then google how to do this from BIOS and add your BIOS version to the search.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »