[Experience sharing] 通过usb鼠标唤醒待机
Tofloor
poster avatar
天道酬勤-商店八哥
deepin
2025-03-11 16:37
Author

应用场景

硬件/整机信息:全平台

OS版本信息:全架构

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

No replies yet