5

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.

  • To make question more clear. Could you edit question and add reference links. (Fn+ F2toF7) is 6 keys, i see 11 ACPI event lines, could you separate the events of each key. Fn+A, hmm? fn functionality depend on manufacturer brand/model, please add you current hardware info. I think it's hard if not impossible to hold Alt+F4 functional as it become Alt+fn+F4. – user.dz Jun 29 '15 at 3:34
  • I forgot, :) too long list , could you add X event of each key [Fn+ F2toF7] using xev -event keyboard – user.dz Jun 29 '15 at 3:38
  • @Sneetsher, I've updated with output of xev -event keyboard and hw info. I will add reference links to each acpi events later. Also, I thought of remapping Alt + F4 and F5 (refresh) to Alt+4 and Alt+5 respectively. – daltonfury42 Jun 29 '15 at 4:42
  • Apple computers can remap the fn key combinations. It is the only computer brand I know that does this. – William Oct 14 '18 at 17:38
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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