Etikettarkiv: sleep

Sleep resume in Ubuntu screws up mouse pad

I found that my Lenovo laptops did not always get the mousepad right when coming out of sleep or hibernate. After a bit of research I found that a modprobe remove and insert of the psmouse kernel module did the trick.

To automatize this you can insert a file in the systemd control structure to fix the problem yourself (if you are experiencing it). Below is a block of code. Save this to a file in /lib/systemd/system-sleep/touchpad

#!/bin/sh

PATH=/sbin:/usr/sbin:/bin:/usr/bin

case "$1" in
    pre)
    #code execution BEFORE sleeping/hibernating/suspending
    # unload touchpad driver
	/usr/sbin/modprobe -r psmouse
    ;;
    post)
    #code execution AFTER resuming
    # reload touchpad driver
	/usr/sbin/modprobe psmouse
    ;;
esac

exit 0