1

Solved (2016-11-15): See more below the question.

Detailled description of the problem

I'm trying to get the touchpad disabled when I press the Fn+F6 key (actually I don't have to press the Fn key bacause of my BIOS setup) on my Lenovo Yoga 900-13ISK2.

Before trying anything whenever I pressed the Fn+F6 key I got the following in the dmesg:

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

Also whenever I put the laptop in "tablet mode", I could see the following in the dmesg:

atkbd serio0: Unknown key pressed (translated set 2, code 0xbf on isa0060/serio0).
atkbd serio0: Use 'setkeycodes e03f <keycode>' to make it known.
ideapad_laptop: Unknown event: 1
atkbd serio0: Unknown key released (translated set 2, code 0xbf on isa0060/serio0).
atkbd serio0: Use 'setkeycodes e03f <keycode>' to make it known.

So it seems that when put into tablet mode it's like pressing/releasing the Fn+F6 key along with another event. That last event seems to be related with the keyboard's backlight (since pressing Fn+Space to control the backlight induces the same logs in the dmesg). When coming out of tablet mode to laptop mode, only the ideapad_laptop: Unknown event: 1 gets logged.

All this happens using Linux 4.8. I used the Ubuntu's config-4.4.0-43-generic as the base for creating the .config file (shown in https://gist.github.com/mvaled/36b2aa23b194d33ecd5e43efe8905cba).

Afterwards, I created /etc/udev/hwdb.d/10-yoga.hwdb:

evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*80UE*:pvr*YOGA*900-13ISK2*
 KEYBOARD_KEY_bf=touchpad_toggle

After udevadm hwdb -u and udevadm trigger (or reboot), pressing the Fn+F6 stops logging the unknown key events and evtest shows the key:

Event: type 4 (EV_MSC), code 4 (MSC_SCAN), value bf
Event: type 1 (EV_KEY), code 530 (KEY_TOUCHPAD_TOGGLE), value 0

But the touchpad remains enabled.

I've been able to disable/enable the touchpad by issuing:

$ xinput set-prop "SYNA2B29:00 06CB:77C6" 'Device Enabled' 0
$ xinput set-prop "SYNA2B29:00 06CB:77C6" 'Device Enabled' 1

At this point I'm stuck. Which component should capture the KEY_TOUCHPAD_TOGGLE event and do something about it?

I know that touchpad is being driven by the 'i2c_designware_platform' driver. The keyboard seems to be driven by 'ideapad_laptop'. Is that reasonable?

Solution

The solution is to change the file /etc/udev/hwdb.d/10-yoga.hwdb to:

evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*80UE*:pvr*YOGA*900-13ISK2*
 KEYBOARD_KEY_bf=f21

@dirkt provided information about the file /usr/share/X11/xkb/symbols/inet. Reading this file is clear the X11 maps the key F21 to XF86TouchpadToggle:

key <FK21>   {      [ XF86TouchpadToggle    ]       };

So instead of mapping the scancode to touchpad_toggle I just map it to function key F21.

No scripts needed.

Remaining issues

This laptop sends this event when you put it tablet mode. But when coming back to laptop mode it does not send it again so the touchpad remains disabled.

Furthermore, if you disable the touchpad while in laptop mode, going to tablet mode enables it.

1

You already solved all the difficult parts of the puzzle :-)

You either need to run a dedicated program that reacts on the toggle command, or use an existing program that is running anyway and can react on keys. Some window managers can be very flexibly configured to react on keys, for example I'm using fvwm for the brightness and volume keys on my laptop. So find out what window manager you are using, and how you can configure it.

You can find out the X keycode instead of the kernel keycode by running xev, focusing it and pressing Fn+F6.

The second problem is that to perform a toggle operation, you need to know the current state. The simplest way is probably to write a little shell script to read the Device Enabled property with xinput, and then either enable or disable it with xinput set-prop. Run this shell script from your window manager (if you can) whenever you receive the X even code you found out.

Solution

The solution is to change the file /etc/udev/hwdb.d/10-yoga.hwdb to:

evdev:atkbd:dmi:bvn*:bvr*:bd*:svnLENOVO:pn*80UE*:pvr*YOGA*900-13ISK2*
 KEYBOARD_KEY_bf=f21

@dirkt provided information about the file /usr/share/X11/xkb/symbols/inet. Reading this file is clear the X11 maps the key F21 to XF86TouchpadToggle:

key <FK21>   {      [ XF86TouchpadToggle    ]       };

So instead of mapping the scancode to touchpad_toggle I just map it to function key F21.

No scripts needed.

Remaining issues

This laptop sends this event when you put it tablet mode. But when coming back to laptop mode it does not send it again so the touchpad remains disabled.

Furthermore, if you disable the touchpad while in laptop mode, going to tablet mode enables it.

  • On a terminal over X, evtest do capture the events. But xev logs nothing. Trying to create a custom shortcut using Ubuntu's Unity settings, does not see the key press either. So, there should be some component (probably in the X stack) that is dismissing the key. – manu Nov 15 '16 at 18:37
  • That's strange, the X keysym XF86XK_TouchpadToggle exists, and /usr/share/X11/xkb/symbols/inet seems to contain a translation in the evdev section. And I do know that e.g. the volume and brightness keys in the same section work properly. I'm not familiar enough with X keyboard stuff to give advice how to debug this. In principle, you should be able to define your own keyboard translation in case there's a bug in the default one. – dirkt Nov 15 '16 at 22:08
  • 1
    Thanks! I think you've got some point there. The section 'evdev' translate the key F21 to that. From my previous research it seems that Linux used to use F21 for the touchpad toggle. Now I just have to learn how to extend that mapping. – manu Nov 16 '16 at 0:34
  • I just changed the hwdb file to send the F21 instead of th touchpad_toggle and now the X11 properly enable/disabled the touchpad. And, of course, it works when I put the laptop in tablet mode. Unfortunally when I come out of tablet mode back to laptop mode, the event is not send and I have to enable the touchpad manually. Many thanks! – manu Nov 16 '16 at 1:00
0

Using synaptics under xorg, I often use :

 synclient touchpadoff=1 # for disable and =0 for enable

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.