ThinkPad twist: disable trackpoint and touchpad when closed
Peter Hutterer
peter.hutterer at who-t.net
Sun Nov 8 18:31:17 PST 2015
On Fri, Nov 06, 2015 at 10:01:39PM +0100, Ruben De Smet wrote:
> With respect to
> http://lists.freedesktop.org/archives/wayland-devel/2014-September/017259.html
> and https://bugzilla.gnome.org/show_bug.cgi?id=698226:
>
> I own a ThinkPad Twist, which has a tablet mode. When in tablet mode,
> the back of the screen touches the trackpoint and touchpad, which makes
> the mouse pointer jiggle and move.
>
> Devices that matter in this case are
>
> /dev/input/event7: ThinkPad Extra Buttons
> /dev/input/event14: SynPS/2 Synaptics TouchPad
> /dev/input/event15: TPPS/2 IBM TrackPoint
>
> event7 triggers the right events: SW_TABLET_MODE (thanks to evtest)
>
> Event: time 1446840780.539488, type 5 (EV_SW), code 1 (SW_TABLET_MODE),
> value 1
> Event: time 1446840780.539488, -------------- SYN_REPORT ------------
> Event: time 1446840783.154657, type 5 (EV_SW), code 1 (SW_TABLET_MODE),
> value 0
> Event: time 1446840783.154657, -------------- SYN_REPORT ------------
when exactly does this event trigger? Is it an indication of when the
touchpad cannot be used anymore at all, or are there screen configurations
where the tablet switch is triggered but the touchpad could still be
useable?
This largely determines where we need to put the code. If it is a
hardware-dependent issue and the switch event is enough to determine when to
*always* disable the touchpad, then we can put it into libinput. If it's a
specific policy that should be handled on a case-by-case basis, this should
go into the compositor instead.
> If someone could guide me a little on where and how the code should come
> (probably libinput?), then I'd be happy to write this.
The libinput solution would be to take the touchpad with a
LIBINPUT_MODEL_LENOVO_TWIST udev property, then have specific code in
evdev_device_create and fallback_process to pair the device with the
touchpad and disable the touchpad accordingly. There's some precedence code
for disabling the touchpad after the trackpoint was moved, look at
tp_trackpoint_event for a hint.
The bigger task will be introducing a new device type that's only used
within libinput. Since we don't expose the actual event on the node we
should not create a publicly visible device.
>
> The first mail I mentioned ([PATCH libinput 0/8] Add
> libinput_device_suspend() to disable devices, by Peter Hutterer), makes
> me think this could become more complicated then I'd guess.
>
> If not, I'd guess it's as easy as calling
>
> int
> evdev_device_suspend(struct evdev_device *device);
>
> int
> evdev_device_resume(struct evdev_device *device);
>
> which said Peter added back in 2014, when the right events are fired.
mostly. not quite as simple, but as I said above the trackpoint suspend
handling should give you enough ideas.
but again, if this is not a "the device can only behave in this way"
situation, this type of policy should go into the compositor. Which,
unfortunately, requires a lot more work in libinput too.
Cheers,
Peter
More information about the wayland-devel
mailing list