Index

# Workaround for broken TrackPoint

2022-12-05

Sometimes, seemingly at random after clicking the dedicated left click or right click buttons, the buttons and trackpoint on my Lenovo Thinkpad T14s stops working. Instead of clicking, the three mouse buttons just makes the pointer move a bit and the trackpoint makes the pointer move in a random direction and seems to issue clicks.

When this happens, the kernel buffer is spammed with "`psmouse serio1: elantech: discarding packet`". Searching the interwebs, I found that more people seem to be experiencing similar weirdness with the elantech trackpoint driver.

Rebooting the computer works, but it's annoying. Removing and re-adding the misbehaving kernel module resolves the issue too fortunately. I put the following in `~/bin/fixmouse`:

    #!/bin/sh
    doas rmmod psmouse
    doas modprobe psmouse

So now I can run `fixmouse` whenever the driver stops working.

Update 2023-09-24: If the psmose module is builtin, it can't be unloaded, giving "`rmmod: ERROR: Module psmouse is builtin.`" Fortunately, there's a better way of reloading the trackpad using a method described in an article on LWN from 2005.

The error in the kernel buffer indicates that the trackpad is called `serio1`, but for posterity we can find devices using the `psmouse` driver with `find`:

    $ find /sys/bus -name psmouse
    /sys/bus/serio/drivers/psmouse
    $ ls -l /sys/bus/serio/drivers/psmouse
    total 0
    --w-------. 1 root root 4096 Sep 23 22:19 bind
    -rw-r--r--. 1 root root 4096 Sep 23 22:19 bind_mode
    -r--r--r--. 1 root root 4096 Sep 23 22:19 description
    lrwxrwxrwx. 1 root root    0 Sep 24 10:42 serio1 -> ../../../../devices/platform/i8042/serio1
    --w-------. 1 root root 4096 Sep 23 14:20 uevent
    --w-------. 1 root root 4096 Sep 24 10:36 unbind

As described in the article, we can unbind the touchpad with (as root)

    echo -n "serio1" > /sys/bus/serio/drivers/psmouse/unbind

My touchpad rebinds automatically after a few seconds, but you should be able to bind it manually using `[...]/psmouse/bind`.