10

With Logitech K290 keyboard via USB, F. keys are not accessible by default, and I need to press Fn before using them, which is not really usable.

The Fn key alone does not fire any event in xev.

Pressing F1 without Fn fires two key events, keycode 50 (Shift_L) and keycode 133 (Super_L) and displays a message "Touchpad disabled" on my Kubuntu (the same message for every keys F1 through F4)

Althoug most media keys works, I'd rather have direct F. keys access. Do you know of any way to toggle Fn behavior?

Here is the output for when I press F1 without Fn:

KeyPress event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64638420, (-352,274), root:(1462,621),
    state 0x10, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64638420, (-352,274), root:(1462,621),
    state 0x11, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

FocusOut event, serial 40, synthetic NO, window 0x1a00001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 40, synthetic NO, window 0x1a00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  4294967238 0   0   0   0   0   4   0   0   0   0   0   0   0   0   0   
           32  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeyRelease event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64638436, (-352,274), root:(1462,621),
    state 0x51, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64638436, (-352,274), root:(1462,621),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

MappingNotify event, serial 40, synthetic NO, window 0x0,
    request MappingPointer, first_keycode 0, count 0

And for F2 (still no Fn):

KeyPress event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64782724, (-202,438), root:(1491,799),
    state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64782724, (-202,438), root:(1491,799),
    state 0x18, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

FocusOut event, serial 40, synthetic NO, window 0x1a00001,
    mode NotifyGrab, detail NotifyAncestor

FocusIn event, serial 40, synthetic NO, window 0x1a00001,
    mode NotifyUngrab, detail NotifyAncestor

KeymapNotify event, serial 40, synthetic NO, window 0x0,
    keys:  4294967238 0   0   0   0   0   0   0   1   0   0   0   0   0   0   0   
           32  0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeyRelease event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64782780, (-202,438), root:(1491,799),
    state 0x58, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64782780, (-202,438), root:(1491,799),
    state 0x50, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

F1 with Fn gives expected result:

KeyPress event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64820204, (-856,-213), root:(1097,247),
    state 0x10, keycode 67 (keysym 0xffbe, F1), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x1a00001,
    root 0x2c6, subw 0x0, time 64820284, (-856,-213), root:(1097,247),
    state 0x10, keycode 67 (keysym 0xffbe, F1), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
5
  • 2
    Usually <kbd>Fn</kbd> works on keyboard's hardware level. Hopefully keycodes, as opposed to keysyms, of F-keys still differ when it is not pressed. Can you please run xev once more and paste the output for two different F-keys?
    – 9000
    Commented Dec 31, 2013 at 7:58
  • I've come across the same problem :(. This answer (askubuntu.com/a/285604/121193) might be useful, but it would be nice for something...simpler.
    – Ash
    Commented Feb 16, 2014 at 11:14
  • 1
    Sadly, Solaar only works for wireless emitters, not wired ones :(
    – user55574
    Commented Feb 17, 2014 at 16:36
  • I would start by looking in the BIOS settings. Some allow swapping the Fn key e.g. F-keys-by-default.. Commented Jul 9, 2018 at 7:04
  • really nasty that F1 reuses keycode 50, so you can't just change what 50 does either.. :P Commented Jul 9, 2018 at 7:06

2 Answers 2

1

xev can't show events that are captured by the desktop environment. A better way to test keys is using showkey command (at the Linux console, not inside X11). I'm guessing that the OS is actually receiving a Shift + Super + some-key combination.

Though you could conceivably remap said combination to just an F key, it would likely be troublesome: you'd have to "release" the Shift key (because the keyboard simulates pressing it), and making Shift+F1 work would be even more complicated, as it would require tracking if the Shift key was held down previously.

This problem is very common on laptops, which often have either a key combination to toggle multimedia hotkeys, or an option in their BIOS/firmware. But as you mentioned that this is concerning a specific model of external keyboard, looking online I found this project:

https://github.com/milgner/k290-fnkeyctl

The project's description states that it "reconfigures the way the function keys on Logitech K290 keyboards work", so it may be worth giving a try.

1

I obtained the same result by swapping the keycodes between Fn+Fx and Fx where x is 1,2,...12.

  1. Use xmodmap -pke to obtain a list of the current keycodes and keysymbols.
  2. Then run xev and press F1 through F12 keeping note of its keycode.
  3. Then make the swap in your ~/.Xmodmap file.

For e.g. in my system the result of (1):

keycode 67 = F1 F1 F1 F1 F1 F1 XF86Switch_VT_1
keycode 68 = F2 F2 F2 F2 F2 F2 XF86Switch_VT_2
keycode 69 = F3 F3 F3 F3 F3 F3 XF86Switch_VT_3
keycode 70 = F4 F4 F4 F4 F4 F4 XF86Switch_VT_4
...

keycode 121 = XF86AudioMute NoSymbol XF86AudioMute
keycode 122 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume
keycode 198 = XF86AudioMicMute NoSymbol XF86AudioMicMute
..

Then I swapped it in ~/.Xmodmap:

keycode 121 = F1 F1 F1 F1 F1 F1 XF86Switch_VT_1
keycode 122 = F2 F2 F2 F2 F2 F2 XF86Switch_VT_2
keycode 123 = F3 F3 F3 F3 F3 F3 XF86Switch_VT_3
keycode 198 = F4 F4 F4 F4 F4 F4 XF86Switch_VT_4
...


keycode 67 = XF86AudioMute NoSymbol XF86AudioMute
keycode 68 = XF86AudioLowerVolume NoSymbol XF86AudioLowerVolume
keycode 69 = XF86AudioRaiseVolume NoSymbol XF86AudioRaiseVolume
keycode 70 = XF86AudioMicMute NoSymbol XF86AudioMicMute
...

Then to take affect run xmodmap ~/.Xmodmap.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .