Howto: Fix post suspend cursor freeze on ThinkPad T440s

Share your own howto's etc. Not for support questions!
Post Reply
Message
Author
User avatar
Hallvor
Posts: 1189
Joined: 2009-04-16 18:35
Location: Kristiansand, Norway
Has thanked: 4 times
Been thanked: 2 times

Howto: Fix post suspend cursor freeze on ThinkPad T440s

#1 Post by Hallvor »

The problem: The cursor would freeze after a given number of resumes from suspend, while the touch screen would still work.

The solution: Reload the touchpad module after each suspend. Well, that is a lot of work, so let's automate it. (Keep in mind that you can use the script for just about any task you want to automate after suspend. Just change the script.)

Make a systemd service (as root):

Code: Select all

# nano /etc/systemd/system/wakeup.service
Then paste the following content into it:

Code: Select all

[Unit]
Description=Run my_user_script
After=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target


[Service]
ExecStart=/etc/touchpadfiks.sh
#User=my_user_name
#Environment=DISPLAY=:0

[Install]
WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target
Notice the line ExecStart=/etc/touchpadfiks.sh. This is the name and location of the shell script doing the actual command.

And now let's make the script.

Code: Select all

# nano /etc/touchpadfiks.sh
Paste the following content into it. This script will remove and reload the (touchpad) module i2c_hid

Code: Select all

#!/bin/sh

case $1 in
  post)
    /sbin/rmmod i2c_hid && /sbin/modprobe i2c_hid 
  ;;
esac
Save the file with Ctrl+X, and Y to exit.

Make the script executable:

Code: Select all

# chmod +x /etc/touchpadfiks.sh
Enable the service for every boot and start it:

Code: Select all

# systemctl enable wakeup.service && systemctl start wakeup.service
That's it.

Undo the changes:

Code: Select all

# systemctl stop wakeup.service
# systemctl disable wakeup.service
# rm /etc/systemd/system/wakeup.service
# rm /usr/lib/systemd/system/wakeup.service
# systemctl daemon-reload
# systemctl reset-failed
# rm /etc/touchpadfiks.sh
Lenovo ThinkPad T440S, Intel Core i7-4600U CPU @ 2.10GHz, 8 GB RAM, 256 GB SSD, Debian Bullseye (KDE)
Lenovo ThinkPad X240, Intel Core i5-4300U CPU @ 2.90GHz, 8 GB RAM, 120 GB SSD, Debian Bullseye (KDE)

Post Reply