The suggested /etc/pm/sleep.d/
hooks may not make an effect if systemd-sleep
is doing the suspend instead of pm-suspend
commannd; this may be the case if, for example, you are using Xfce's exit/suspend menu instead of pm-suspend
from the commannd line.
I needed some time to understand this; thanks to https://askubuntu.com/a/643793/19753.
So I have put (additionally to /etc/pm/sleep.d/75touchpad
which contains in my case the common modprobe psmouse
-workaround mentioned by OP) the file /lib/systemd/system-sleep/my-touchpad
(executable):
#!/bin/sh
case "$1/$2" in
post/suspend)
exec /etc/pm/sleep.d/75touchpad resume
;;
post/hybrid-sleep)
/etc/pm/sleep.d/75touchpad thaw
exec /etc/pm/sleep.d/75touchpad resume
;;
post/*) # hibernate
exec /etc/pm/sleep.d/75touchpad thaw
;;
pre/suspend)
exec /etc/pm/sleep.d/75touchpad suspend
;;
pre/hybrid-sleep)
/etc/pm/sleep.d/75touchpad suspend
exec /etc/pm/sleep.d/75touchpad hibernate
;;
pre/*) # hibernate
exec /etc/pm/sleep.d/75touchpad hibernate
;;
esac
It's a kind of a universal proxy to call a script originally put for pm-utils.