笔记本合盖后触摸板误触问题
Tofloor
poster avatar
jinghy98
deepin
2018-01-23 19:52
Author
新人刚接触Deepin操作系统,发现一个奇怪的问题,个人不喜欢设置为合盖后睡眠,但无操作,每次合上盖子触摸板就会误触,本人用的是暗影精灵2代,是笔记本的设计问题吗,以前用win的时候好像没有发现这个问题,是不是需要在合盖之后屏蔽触摸板才可以?要自己写脚本吗?
附上录的视频:视频中00:00:01位置开始合上盖子,可以看见触摸板不停地误触,直到第九秒打开盖子,这个问题是我昨天合上盖子后偶然间听到笔记本不停发出“叮”的声音才发现的
Reply Favorite View the author
All Replies
avatar
aida
deepin
2018-01-24 01:42
#1
Reply View the author
avatar
ih******op@vip.qq.com
deepin
2018-01-24 02:33
#2
本帖最后由 ihipop 于 2018-1-23 18:54 编辑

你的触摸板肯定不是凹进去的 或者你屏幕太脏了

你设置成合盖子自动禁用触摸板吧

  1. curl -L https://gist.githubusercontent.com/ihipop/cd3956edfbae90aabe20f28188778ee0/raw/ -o /usr/local/bin/touchpad_toggle.sh && chmod +x /usr/local/bin/touchpad_toggle.sh
Copy the Code

  1. touchpad_toggle.sh off
  2. touchpad_toggle.sh on
  3. touchpad_toggle.sh auto
Copy the Code
Reply View the author
avatar
yanbowen
deepin
Community Developer
2018-01-24 17:27
#3
检查下你的屏幕合上时是否会触碰到触摸板
Reply View the author
avatar
jinghy98
deepin
2018-01-24 20:00
#4
https://bbs.deepin.org/post/152252
你的触摸板肯定不是凹进去的 或者你屏幕太脏了

你设置成合盖子自动禁用触摸板吧

非常感谢,通过你的脚本我深受启发,自己第一次写Shell脚本花了几个小时,大致能解决这个问题了,脚本可能比较粗糙,请多指教~
  1. #!/bin/bash
  2. echo "start"
  3. open="true"
  4. #inotifywait -rm --event modify,delete,create,attrib /proc/acpi/button/lid/LID0/ | while read file
  5. while true
  6. do
  7.         status=$(sudo cat /proc/acpi/button/lid/LID0/state)
  8.         echo $status
  9.         #echo $open
  10.         #if [[ $status =~ "open" ]];
  11.         #then
  12.         #        echo "yes"
  13.         #else
  14.         #        echo "no"
  15.         #fi
  16.         if [ "$open" = "true" ]&&[ "$status" = "state:      closed" ]
  17.         then
  18.                 open="false"
  19.                 echo "touchpad off"
  20.                 sudo touchpad_toggle.sh off
  21.         fi
  22.         if [ "$open" = "false" ]&&[ "$status" = "state:      open" ]
  23.         then
  24.                 open="true"
  25.                 echo "touchpad on"
  26.                 sudo touchpad_toggle.sh on
  27.         fi
  28.         #echo "done"
  29.         sleep 1s       
  30. done
Copy the Code
Reply View the author
avatar
jinghy98
deepin
2018-01-24 20:03
#5
https://bbs.deepin.org/post/152252
检查下你的屏幕合上时是否会触碰到触摸板

屏幕应该不大会,我屏幕相比较边框稍微凹陷下去,我现在通过脚本能一定程度上解决这个问题
Reply View the author
Comments
ihipop
2018-01-24 22:07
肯定是金属边框。
avatar
ih******op@vip.qq.com
deepin
2018-01-24 21:56
#6
本帖最后由 ihipop 于 2018-1-24 14:42 编辑
https://bbs.deepin.org/post/152252
非常感谢,通过你的脚本我深受启发,自己第一次写Shell脚本花了几个小时,大致能解决这个问题了,脚本可 ...

简单点评下:
  • touchpad关闭打开以及检测盖子状态不需要root权限 sudo可以拿掉了
  • 就你这个写法来说 直接这样就可以了
    1. #!/bin/bash
    2. if grep 'open' /proc/acpi/button/lid/LID0/state;then
    3.     echo lid is open
    4.     touchpad_toggle.sh on
    5. else
    6.     echo lid is close
    7.     touchpad_toggle.sh off
    8. fi
    Copy the Code

  • 你这是死循环啊,还要常驻内存。你检测触合盖事件即可,给你个提示 /etc/acpi/events/ 这个文件夹 定义任何和lid有关的事件和执行脚本即可。不需要常驻内存




Reply View the author
avatar
jinghy98
deepin
2018-01-24 23:35
#7
https://bbs.deepin.org/post/152252
简单点评下:
  • touchpad关闭打开以及检测盖子状态并不需要root权限 sudo可以拿掉了

  • 哇,感谢指点,原来只要在/etc/acpi/events/里加一个配置文件就可以!
    1. event=button/lid/LID0
    2. action=touchpad_toggle.sh auto
    Copy the Code
    Reply View the author
    avatar
    ih******op@vip.qq.com
    deepin
    2018-01-24 23:57
    #8
    本帖最后由 ihipop 于 2018-1-24 16:30 编辑
    https://bbs.deepin.org/post/152252
    哇,感谢指点,原来只要在/etc/acpi/events/里加一个配置文件就可以!

    auto是如果触摸板关就开 如果触摸版开就关,
    建议还是用7楼提供的脚本再包一下 确保盖子开一定开 盖子关一定关

    Reply View the author
    avatar
    jinghy98
    deepin
    2018-01-25 00:13
    #9
    https://bbs.deepin.org/post/152252
    auto是如果触摸板关就开 如果触摸版开就关,
    建议还是用7楼提供的脚本再包一下 确保盖子开一定开 盖子关一 ...

    好的~感谢热心回复~
    Reply View the author
    avatar
    ih******op@vip.qq.com
    deepin
    2018-01-25 01:38
    #10
    https://bbs.deepin.org/post/152252
    好的~感谢热心回复~

    记得把systemd的acpid的服务设置成开机启动
    Reply View the author
    avatar
    jinghy98
    deepin
    2018-01-25 07:54
    #11
    https://bbs.deepin.org/post/152252
    记得把systemd的acpid的服务设置成开机启动

    请问是这样就行了吗
    1. sudo systemctl enable acpid.service
    Copy the Code
    1. $ service acpid status
    2. ● acpid.service - ACPI event daemon
    3.    Loaded: loaded (/lib/systemd/system/acpid.service; enabled; vendor preset: enabled)
    4.    Active: active (running) since Wed 2018-01-24 15:30:48 CST; 8h ago
    5. Main PID: 28169 (acpid)
    6.     Tasks: 1 (limit: 4915)
    7.    CGroup: /system.slice/acpid.service
    8.            └─28169 /usr/sbin/acpid
    Copy the Code
    Reply View the author
    Comments
    ihipop
    2018-01-26 01:02
    avatar
    jinghy98
    deepin
    2018-01-26 01:43
    #12
    https://bbs.deepin.org/post/152252
    记得把systemd的acpid的服务设置成开机启动

    好像还是不行,用service acpid status查看状态显示Active:active(running),但合上盖子也不能自动执行脚本,明明一开始在/etc/acpi/events里写完配置文件后就能生效,不知道为什么现在重启之后不能生效?
    Reply View the author
    avatar
    ih******op@vip.qq.com
    deepin
    2018-01-26 18:34
    #13
    https://bbs.deepin.org/post/152252
    好像还是不行,用service acpid status查看状态显示Active:active(running),但合上盖子也不能自动执行脚 ...

    先执行 systemctl status acpid
    贴输出。
    然后执行 sudo su 切换到root
    然后 systemctl stop acpid
    然后 acpid -dd
    然后开合盖子 贴输出。
    Reply View the author
    avatar
    jinghy98
    deepin
    2018-01-26 23:31
    #14
    https://bbs.deepin.org/post/152252
    先执行 systemctl status acpid
    贴输出。
    然后执行 sudo su 切换到root
    1. $ systemctl status acpid
    2. ● acpid.service - ACPI event daemon
    3.    Loaded: loaded (/lib/systemd/system/acpid.service; enabled; vendor preset: enabled)
    4.    Active: active (running) since Fri 2018-01-26 15:17:26 CST; 8min ago
    5. Main PID: 506 (acpid)
    6.     Tasks: 1 (limit: 4915)
    7.    CGroup: /system.slice/acpid.service
    8.            └─506 /usr/sbin/acpid
    Copy the Code
    1. # systemctl stop acpid
    2. Warning: Stopping acpid.service, but it can still be activated by:
    3.   acpid.socket
    4.   acpid.path

    5. # acpid -dd
    6. Deprecated /proc/acpi/event was not found.  Trying netlink and the input layer...
    7. input layer /dev/input/event0 (Lid Switch) opened successfully, fd 4
    8. input layer /dev/input/event1 (Power Button) opened successfully, fd 5
    9. input layer /dev/input/event10 (HP WMI hotkeys) opened successfully, fd 6
    10. input layer /dev/input/event11 (HDA Intel PCH Mic) opened successfully, fd 7
    11. input layer /dev/input/event12 (HDA Intel PCH Headphone) opened successfully, fd 8
    12. input layer /dev/input/event13 (HDA Intel PCH HDMI/DP,pcm=3) opened successfully, fd 9
    13. input layer /dev/input/event14 (HDA Intel PCH HDMI/DP,pcm=7) opened successfully, fd 10
    14. input layer /dev/input/event15 (HDA Intel PCH HDMI/DP,pcm=8) opened successfully, fd 11
    15. input layer /dev/input/event2 (Power Button) opened successfully, fd 12
    16. input layer /dev/input/event3 (AT Translated Set 2 keyboard) opened successfully, fd 13
    17. input layer /dev/input/event4 (Video Bus) opened successfully, fd 14
    18. input layer /dev/input/event5 (Video Bus) opened successfully, fd 15
    19. inotify fd: 16
    20. inotify wd: 1
    21. netlink opened successfully
    22. acpid: starting up with netlink and the input layer
    23. parsing conf file /etc/acpi/events/auto_touchpad_control
    24. acpid: 1 rule loaded
    25. acpid: waiting for events: event logging is off
    26. expanded "/usr/local/bin/clear_auto_touchpad.sh" -> "/usr/local/bin/clear_auto_touchpad.sh"
    27. 2018-01-26-15-26-53 lid is close
    28. Touchpad disabled.
    29. expanded "/usr/local/bin/clear_auto_touchpad.sh" -> "/usr/local/bin/clear_auto_touchpad.sh"
    30. state:      open
    31. 2018-01-26-15-26-58 lid is open
    32. Touchpad enabled.
    Copy the Code

    这样操作能生效但每次重启之后还是不行,麻烦指导一下
    Reply View the author
    avatar
    ih******op@vip.qq.com
    deepin
    2018-01-27 02:23
    #15
    acpid服务禁用了以后重启一下 试试
    Reply View the author
    avatar
    jinghy98
    deepin
    2018-01-27 04:15
    #16
    https://bbs.deepin.org/post/152252
    acpid服务禁用了以后重启一下 试试

    还是不行呀,只有执行了acpid -dd之后才能生效。。。
    Reply View the author