3

Thinkpad laptop W520 series with kernel: 4.15.0-51-generic x86_64 bits: 64

Following the latest dist-update the trackpoint and it's related keys don't work after return from suspend mode. Unloading and (re-)loading of psmouse fixes the issue but is only a workaround and somewhat annoying.

TLP is installed.

Any help highly appreciated. mgw

mgw
  • 134

3 Answers3

4

Having to unload and reload the psmouse driver when resuming from suspend is a common problem. You can automate the process with a script though:

Create a new file in the /lib/systemd/system-sleep/ directory containing:

#!/bin/bash

case $1/$2 in pre/) echo "Going to $2..." # Place your pre suspend commands here, or exit 0 if no pre suspend action required modprobe -r psmouse ;; post/) echo "Waking up from $2..." # Place your post suspend (resume) commands here, or exit 0 if no post suspend action required sleep 2 modprobe psmouse ;; esac

Make it executable:

sudo chmod a+x /lib/systemd/system-sleep/script-name

After the next reboot, the script will be active.

A script like this has worked for many people over the years. Of course your other option would be trying the previous kernel version and if it works sticking with it.

Notes when your script isn't working:

  • Ensure the systemd suspend target is enabled.

  • From the same accepted answer in the link, you may need to set PATH for external commands by inserting the following command into your script. Add any additional directories your commands may be in:

    PATH=/sbin:/usr/sbin:/bin:/usr/bin
    
  • If it still isn't working, post a new question. Then drop a comment below with a link to the new question and I'll have a look.

  • Txs. Another funny thing is that configure-trackpoint tells me it doesn't detect anything even though the device is working after reloading of module. – mgw Jul 22 '19 at 10:15
  • @mgw I've never used configure-trackpoint. You would be best served posting a new question about that problem. In the meantime click the grey check mark next to the answer if it solves the current question. Thanks. – WinEunuuchs2Unix Jul 22 '19 at 15:39
  • It's "only" a workaround. Let's wait for the next kernel update. Txs for the script @WinEunuuchs2Unix – mgw Jul 23 '19 at 15:57
  • The script solves the problem on my Thinkpad L13 Yoga, thanks! However, it has introduces two (less severe) problems: 1. The touchpad is not deactivated any more, despite being switched off in the mouse settings. 2. The "hold middle mouse button and move trackpoint" scrolling is broken after wake up but returns if I close and reopen the window in question. Any thoughts about why this happens? – Photon May 23 '21 at 13:04
  • 1
    @Photon Automatically deactivating touchpad can be done by adding instructions from: https://askubuntu.com/questions/751413/how-to-disable-enable-toggle-touchpad-in-a-dell-laptop into script. As for #2 you should post a new question in Ask Ubuntu. Don't forget to upvote answers you find useful :) – WinEunuuchs2Unix May 23 '21 at 13:47
  • Thanks, I already upvoted this one when I first tried the fix. :) I will try the solution for the first issue and report back! – Photon May 23 '21 at 13:52
  • Unfortunately, adding "xinput disable 10" after the modprobe line of the post/*) block didn't make any difference... – Photon May 23 '21 at 14:18
  • @Photon It probably won't make a difference but you can try changing xinput to /usr/bin/xinput. PS Following my own advise I just upvoted question and first two answers in the link. – WinEunuuchs2Unix May 23 '21 at 14:29
  • Maybe I should put in another sleep command between rmmod and xinput? – Photon May 23 '21 at 15:07
  • @Photon I thought you put xinput after insert module not after remove module? But yes a sleep wouldn't hurt. – WinEunuuchs2Unix May 23 '21 at 15:27
  • My bad, I meant to write modprobe rather than rmmod. The sleep command didn't help. Also I noticed that the xinput device id keeps changing so I made it "xinput disable 'Elan Touchpad'" instead, but still no luck. If I run the xinput command by hand, it disables the touchpad though, so it gets stuck somewhere executing the wakeup commands... I will try to put in some log output and see where it gets stuck! – Photon May 23 '21 at 15:48
  • It says "Unable to connect to X server" which seems like this problem: https://askubuntu.com/questions/472020/disable-a-device-on-boot However, I don't know where to place the xinput command such that it can connect to the X server and is being executed on wakeup at the same time... – Photon May 23 '21 at 15:57
  • @Photon sounds a bit like this problem: https://unix.stackexchange.com/questions/360537/cant-run-application-that-depends-on-x-as-a-systemd-service – WinEunuuchs2Unix May 23 '21 at 16:24
  • Absolutely, but I fear that all proposed solutions fire the command on login, not on unlock screen after wakeup... – Photon May 23 '21 at 16:53
  • I would follow this new question posted 30 minutes ago. Answers there will probably solve your problem too: https://askubuntu.com/questions/1340201/i-am-unable-to-connect-to-x-server – WinEunuuchs2Unix May 23 '21 at 17:37
  • Thanks for the hint! Looks like the OP isn't giving more details so the question gets stuck. I think, I'll just open a new question myself, thanks for helping to narrow down the problem! – Photon May 24 '21 at 05:41
  • Opened a new question: https://unix.stackexchange.com/questions/651159/trying-to-disable-the-touchpad-at-wakeup – Photon May 24 '21 at 13:50
  • I could finally solve the problem by following this answer: https://askubuntu.com/a/1354447/270792 – Photon Aug 14 '21 at 16:37
  • 1
    @Photon Thanks for the update. Most people don't do that. I upvoted your link because you've confirmed it works. That will help others. – WinEunuuchs2Unix Aug 14 '21 at 19:15
  • this hasn't worked for me in the latest ubuntu version. no middle button. – Pedro Rolo Jan 28 '22 at 11:02
  • @PedroRolo Answer has been updated with some things to try if script isn't working. If those notes don't help, post a new question on this site and drop the link into a comment and I will try to help. Then if successful kindly reverse your down-vote to the answer. – WinEunuuchs2Unix Jan 29 '22 at 19:17
0

Finally, replacing the palmrest fixed everything due to the fact that this behavior stems from a hardware failure. The touchpad simply gave up after 10+ years and this also had a side effect on the trackpoint - please note that the trackpoint hasn't been replaced and I'm still typing happily on the original keyboard from 2011.

mgw
  • 134
0

I'm having the same isse with a ThinkPad E14 Gen2 and this has been bugging me for years. Using "Windows" suspend mode in UEFI works - but it drains the battery much faster. The solution was to create a workaround script with a systemd unit.

Save this script to some file like /usr/local/bin/trackpoint-fix, then make it executable.

#!/bin/bash
echo -n "none" | sudo tee /sys/bus/serio/devices/serio1/drvctl
sleep 3    
echo -n "reconnect" | sudo tee /sys/bus/serio/devices/serio1/drvctl

Then create a systemd unit: sudo systemctl edit --force --full trackpoint-fix.service

[Unit]
Description=Fixes trackpoint

[Service] Type=oneshot ExecStart=/usr/local/bin/trackpoint-fix TimeoutSec=0 StandardOutput=syslog

[Install] WantedBy=multi-user.target sleep.target

Lastly, enable it: sudo systemctl enable trackpoint-fix

Works like a charm for me!

gombosg
  • 121
  • 2