3

On my Lenovo IdeaPad Yoga 2 Pro on Windows, there is a function available Fn+F6 that should turn the touchpad on and off (I would like to map the correct key to the script here on askubuntu).

But on Linux, it doesn't work.

How can I find out the event keycode that it emmits when I press this combination?

I tried showkey -a, showkey -k and xev which both shows most keys codes when pressed, but at Fn+F6 they stay quiet. The other Fn+F1-F5 show output, only F6 doesn't, although it works on Windows. What other alternatives are there to xev and showkey?

The only hint i found so far is:

grep TOUCHPAD /usr/include/linux/input.h

#define KEY_TOUCHPAD_TOGGLE 0x212   /* Request switch touchpad on or off */
#define KEY_TOUCHPAD_ON     0x213
#define KEY_TOUCHPAD_OFF    0x214

source: comment in https://askubuntu.com/a/270428/34298 with link to this article

Maybe someone has an idea?

rubo77
  • 28,966
  • Depending on the BIOS, this may trigger a keyboard press or an ACPI event. If it triggers a keyboard press, it may need to be declared to the kernel before X can see it (see http://unix.stackexchange.com/questions/81166/key-mappings-in-linux/81195#81195). – Gilles 'SO- stop being evil' Apr 18 '14 at 22:12
  • I have a thinkpad T410 and xev definitely shows the Fn+F6 keys. – slm Apr 18 '14 at 23:34
  • @rubo77 - what about sudo showkey -k? – slm Apr 18 '14 at 23:47
  • also no effect. It seems like Lenovo has connected the Fn+F6 key somehow different than the others – rubo77 Apr 19 '14 at 00:24

4 Answers4

4

When I run either xev or showkey I'm able to get keycodes for Fn+F6.

Example

When I use showkey -k I get the following on a Thinkpad T410 laptop.

$ sudo showkey -k 
kb mode was ?UNKNOWN?
[ if you are trying this under X, it might not work
since the X server is also reading /dev/console ]

press any key (program terminates 10s after last keypress)...
keycode  28 release
keycode 143 press                   <--- Fn press + release
keycode 143 release
^[[17~keycode  64 press             <--- F6 press + release
keycode  64 release
keycode 212 press                   <--- Fn + F6 press + release
keycode 212 release
keycode  29 press                   <--- Ctrl + C press + release
^Ccaught signal 2, cleaning up...

Perhaps it's not supported?

I found this Arch Linux wiki articled titled: Lenovo Ideapad Yoga 2 Pro, which would seem to be showing that this key isn't directly being mapped. Will continue digging but thought I'd add this info here as well.

excerpt

Keyboard special keys

BIOS has a setting to flip the behavior of the FN key.

  fn+F1   XF86AudioMute
  fn+F2   XF86AudioLowerVolume
  fn+F3   XF86AudioRaiseVolume
  fn+F4   Alt_L+<F4>
  fn+F5   <F5>
  fn+F6   n/a
  fn+F7   n/a
  fn+F8   Alt_L+Tab
  fn+F9   n/a?
  fn+F10  super_L+p
  fn+F11  XF86MonBrightnessDown
  fn+F12  XF86MonBrightnessUp

Use the modified ideapad_laptop module?

I found this page titled: Lenovo IdeaPad Yoga 2 Pro on the LinLap Wiki. The article discusses a patched version of the ideapad_laptop module which may resolve your issues with certain keys not working.

excerpt

Blacklist ideapad_laptop to get it to work, by adding blacklist ideapad_laptop to /etc/modprobe.d/blacklist.conf. The patched ideapad_laptop module available from https://github.com/pfps/yoga-laptop in the yoga_laptop directory makes wireless work correctly and also handles the Airplane Mode key.

The README for this patched module also had this to say about the F6 key:

Disable Touchpad (F6) produces scan codes that are not recognized. This can be fixed manually by sudo setkeycodes e03f 191 and then setting XF86TouchPadToggle to trigger a script to toggle the state of the touchpad. Pause and Break produce the same character. This can be fixed by sudo setkeycodes e046 194; xmodmap -e "keycode 202 = Break". A better way to do this is via udev rules - see the yoga_laptop/README for more information.

References

slm
  • 369,824
  • I tried that, but on the Yoga 2 Pro it seems not to work for that key. Fn+F4 for close current program correctly shows the key for atl and for F4 directly after another – rubo77 Apr 19 '14 at 00:23
  • I found some hint: grep TOUCHP /usr/include/linux/input.h does that help? – rubo77 Apr 19 '14 at 00:41
  • @rubo77 - see updates. I think we're getting closer with the patched ideapad_laptop module. – slm Apr 19 '14 at 00:55
  • I tried to install this like this: https://gist.github.com/rubo77/11070514 but no effect yet. How do I activate the module? – rubo77 Apr 19 '14 at 01:14
  • The link I referenced showed how. – slm Apr 19 '14 at 02:20
  • For me Fn + F11 doesn't show anything in showkey -k nor xev. It's an airplane mode key. What do you do when these keys aren't shown at all? – CMCDragonkai Jan 27 '16 at 05:08
  • @CMCDragonkai - if you have a new question, I'd encourage you to ask it and refer to this one as a base. – slm Jan 27 '16 at 07:26
1

https://wiki.ubuntu.com/Hotkeys/Troubleshooting has some hints for troubleshooting such keyboard problems:

install

sudo apt-get install evtest

and run

sudo evtest

select 3 for

/dev/input/event3:  AT Translated Set 2 keyboard

and you will see something like

Event: time 1397868878.732211, -------------- SYN_REPORT ------------
Event: time 1397868878.915728, type 4 (EV_MSC), code 4 (MSC_SCAN), value bf
rubo77
  • 28,966
1

On my box (Lenovo Yoga 900 13ISK2) whenever I press the Fn F6 I can see the following output in dmesg:

[20468.127492] atkbd serio0: Unknown key pressed (translated set 2, code 0xbf on isa0060/serio0). [20468.127504] atkbd serio0: Use 'setkeycodes e03f <keycode>' to make it known.

I'm using the 4.8 kernel compile from the git source tree. In include/uapi/linux/input-event-codes.h I see:

#define KEY_TOUCHPAD_TOGGLE 0x212   /* Request switch touchpad on or off */

So I did setkeycodes e03f 530. After that dmesg didn't show the message anymore but pressing the key didn't toggle the touchpad on/off.

Another interesting fact: when I flip the screen to "tablet mode", I can the same message in dmesg so it seems the BIOS is sending the same event as pressing the Fn F6. Unfortunately this only happen after I flip the screen completely and not after it has surpassed 190º or so.

manu
  • 125
0

This is a little old, but I had a similar sort of problem with a laptop (not to switch modes, but it being unmapped is similar). Every time I pressed the "Fn" key, it would report 6f as being unmapped. I finally found the mapping for the "Fn" key to be 464 (0x1D0) from https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h ... Then I could use:

setkeycodes 6f 464 And it shows up as "KEY_FN" now instead. But to make it permanent I ended up creating a startup script. In your case, if it didn't work for the toggle, there might be another keycode that is better? But you really need evtest (as someone already pointed out) to make sure "fn+f6" produces bf. I wouldn't go with what the dmesg says, because when I used "e0xx" like it said, it didn't work. It looks like yours should be:

setkeycodes bf 530