[Share Experiences] 通过usb鼠标唤醒待机
Tofloor
poster avatar
yanjuner
Super Moderator
2023-10-30 22:43
Author

应用场景

硬件/整机信息:全平台

OS版本信息:全架构

问题现象

无法通过鼠标唤醒待机模式

解决方案

步骤一

1.创建50-usb-wakeup.rules

sudo deepin-editor /etc/udev/rules.d/50-usb-wakeup.rules

内容:ACTION=="add", ENV{DEVNAME}=="/dev/input/mouse[0-9]", DRIVERS=="usb", RUN+="/opt/udevScripts/wakeup.sh %S%p"

步骤二

2.创建wakeup.sh

mkdir /opt/udevScripts

sudo deepin-editor /opt/udevScripts/wakeup.sh

添加内容:

#!/bin/bash

DEV_SYS_PATH=$1

P_USB_PATH=​(echo DEV_SYS_PATH | /usr/bin/sed -ne 's/(^.usb[0-9]).$/\1/p')

WAKEUP_FILES=​(/usr/bin/find P_USB_PATH -name wakeup)

for file in $WAKEUP_FILES

do

echo "enabled" > $file

logger "<$0>: set $file to "enabled""

done

步骤三

添加文件的执行权限

3.sudo chmod +x /opt/udevScripts/wakeup.sh

步骤四

重启服务

4.systemctl restart udev

Reply Favorite View the author
All Replies
晚秋(lateautumn)
Moderator
2023-10-30 22:46
#1

学习了,谢谢分享applaud

Reply View the author
阿尼樱奈奈
Moderator
2023-10-30 22:49
#2

ok

Reply View the author
buyike
deepin
2023-10-30 23:01
#3

支持,不过我还是关闭休眠吧。

Reply View the author
hyjiao
deepin
2023-10-31 04:13
#4

我的deepin无论是待机还是休眠,本来就是晃一晃鼠标就唤醒了。😂

Reply View the author