Files
linux-wiki/content/deepin折腾笔记/第十章/10.6.md
2021-10-21 14:57:58 +08:00

51 lines
1.7 KiB
Markdown
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 10.6 睡眠/休眠唤醒之后触摸板失灵
1 作者ChenHacker QQ2041026133
2 链接https://www.luogu.com.cn/blog/ChenHacker/linuxsleep
3 问题原因:
4 Linux的触摸板驱动是启动内核作为一个模块加载的睡眠的时候可能由于Linux内核的bug这个模块坏掉了所以需要重新加载而我们知道Linux系统中重新加载内核模块的方法是:
```
PaperDragon26788865646@qq.com)添加,这个问题是由于系统的软件锁不兼容导致
```
5 sudo modprobe -r *** #移除模块
6 sudo modprobe *** #加载模块
7 经过我几个小时的摸索得知我的笔记本触摸板驱动的模块是i2c_hid(部分笔记本是psmouse) ,所以当唤醒睡眠之后执行一下命令我的触摸板就可以工作了。
8 sudo modprobe -r i2c_hid && sudo modprobe i2c_mid
9 但是每次睡眠之后都要打开终端执行这个命令在Linux下怎么可以这么繁琐
10 所以我们通过修改/usr/lib/systemd/system/systemd-suspend.service文件来解决。
11 这个文件是有关休眠服务的文件,也就是当你按下睡眠键时,系统就会执行这个文件。
12 我们先写好自己的睡眠文件:/usr/lib/systemd/system/mysleep
13 #!/bin/bash
14 /usr/lib/systemd/systemd-sleep suspend && modprobe -r i2c_hid &&modprobe i2c_hid
15 添加可执行权限sudo chmod +x /usr/lib/systemd/system/mysleep
16 然后修改/usr/lib/systemd/system/systemd-suspend.service文件中的对应选项
17 [Service]
18 Type=oneshot
19 ExecStart=/usr/lib/systemd/system/mysleep
20 刷新系统服务:
21 sudo systemctl daemon-reload
22 然后这个问题就被根治了!