[英]Executing bash script on wakeup
一段时间以来,我的 Linux 发行版(Kubuntu 18.04)有一个问题。 每次我的 linux 从待机模式恢复时,触摸板都无法正常工作(无法抓取和拖动文件或其他对象)。
我已经为我的问题找到了解决方案:
modprobe psmouse -r
modprobe psmouse
这段代码确实解决了这个问题。 但是,在此之后,我总是在 sartup 禁用的右键单击区域再次启用。 我有一个在启动时运行的脚本,它执行以下操作:
synclient RightButtonAreaLeft=0
synclient RightButtonAreaTop=0
我现在要做的是编写一个脚本,该脚本在系统从待机模式唤醒时运行。 我写了这样的脚本:
#!/bin/bash
exec 1> /home/luc/Schreibtisch/update.log 2>&1
set -x
case $1/$2 in
pre/*)
echo "Going to $2..."
# Place your pre suspend commands here, or `exit 0`
# if no pre suspend action required
exit 0
;;
post/*)
echo "Waking up from $2..."
sh /home/luc/Schreibtisch/test.sh
sh /home/luc/Schreibtisch/test2.sh
;;
esac
其中 test.sh 运行modprobe
命令,而 test2.sh 运行synclient
命令。
进入待机模式并再次醒来后,我收到以下日志:
+ case $1/$2 in
+ echo 'Waking up from suspend...'
Waking up from suspend...
+ sh /home/luc/Schreibtisch/test.sh
+ sh /home/luc/Schreibtisch/test2.sh
Failed to connect to X Server.
Failed to connect to X Server.
并且文件的抓取和拖动工作完美,但仍然启用右键单击。
我现在的问题是在 X 服务器准备好之后是否可以执行synclient
命令?
亲切的问候百事隆
看来我找到了解决唤醒后触摸板无法正常工作的问题的解决方法。
在我的/etc/modprobe.d/blacklist.conf
模块i2c_i801
被列入黑名单。 从黑名单中删除此模块后,我的触摸板现在在待机模式后可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.