内核版本:4.19.0-5-amd64
现象为盖上显示屏后,系统不能进入休眠,盖子上的指示灯不会变成呼吸状态。经查看日志,与touchpad的驱动有关,即psmouse 模块,如果在盖上之前,通过 modprobe -r psmouse将其退出,则盖上盖后可以正常休眠。打开盖子后,通过 modprobe psmouse重新加载驱动,触摸也能正常使用。
之前找到一篇文章,是在 /etc/pm/sleep.d下面增加如下内容的脚本,通过 pm-hibernate命令可以正常进入到休眠状态,但如果直接盖显示屏是不行的。
#!/bin/sh
#
# Reload the psmouse module
PATH=/sbin:/usr/sbin:/bin:/usr/bin
case "${1}" in
hibernate|suspend)
rmmod psmouse
;;
thaw|resume)
modprobe psmouse
;;
*)
;;
esac
今天在 https://askubuntu.com/questions/671910/touchpad-not-working-after-suspending-laptop 看到了正解,即在/lib/systemd/system-sleep/下增加如下内容的脚本可以解决问题,注意要将脚本改成可执行
#!/bin/sh
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