diff --git a/acpi-wakeup/README.org b/acpi-wakeup/README.org new file mode 100644 index 0000000..609474e --- /dev/null +++ b/acpi-wakeup/README.org @@ -0,0 +1,39 @@ +#+OPTIONS: toc:nil timestamp:nil +#+TITLE: 华为笔记本休眠失败修复方法 + +** 现象 + +华为笔记本在休眠后会被自动唤醒,查看日志并没有发现错误信息,于是猜测是某些设备产生的 =wakeup= 事件唤醒的。 +便查看 =/proc/acpi/wakeup= 文件,发现只有 =XHC= 设备是 =enabled= 。 +遂将其关闭(=echo XHC >> /proc/acpi/wakeup=), 然后测试休眠,则工作正常。 + +#+BEGIN_QUOTE +通过 =XHC= 的 =sysfs node= (=lspci -s = 发现其是一个 =USB= 控制器, +在 =/sys/bus/pci/devices/= 中发现其下有两个 =USB= 设备,通过设备下的 =uevent= 文件(里面的 =PRODUCT= 字段)和 =lsusb= 命令可查到此设备的名称。 +#+END_QUOTE + +** 处理方法 + +为了使上面的关闭方法持久化,这里决定使用 =systemd service= 来实现,并在加载 =multi-user.target= 时执行。 + +文件(=huawei_suspend_workaround.service=)如下: + +#+BEGIN_SRC shell +[Unit] +Description=Huawei Suspend Workaround + +[Service] +Type=oneshot +ExecStart=/bin/sh -c "echo XHC >> /proc/acpi/wakeup" + +[Install] +WantedBy=multi-user.target +#+END_SRC + +执行以下命令安装并启用: + +#+BEGIN_SRC shell +sudo cp huawei_suspend_workaround.service /lib/systemd/system/ +sudo systemctl daemon-reload +sudo systemctl enable huawei_suspend_workaround.service +#+END_SRC diff --git a/acpi-wakeup/acpi_wakeup_workaround.sh b/acpi-wakeup/acpi_wakeup_workaround.sh new file mode 100755 index 0000000..b0c99a7 --- /dev/null +++ b/acpi-wakeup/acpi_wakeup_workaround.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +ENTRIES=`cat /proc/acpi/wakeup|grep enabled|awk '{print $1}'|xargs` +for i in ${ENTRIES}; do + echo "Entry: $i" + if [ $i != "PBTN" ]; then + echo "echo $i|tee /proc/acpi/wakeup" + echo $i|tee /proc/acpi/wakeup + fi +done diff --git a/acpi-wakeup/huawei_suspend_workaround.service b/acpi-wakeup/huawei_suspend_workaround.service new file mode 100644 index 0000000..55046a9 --- /dev/null +++ b/acpi-wakeup/huawei_suspend_workaround.service @@ -0,0 +1,9 @@ +[Unit] +Description=Huawei Suspend Workaround + +[Service] +Type=oneshot +ExecStart=/bin/sh -c "echo XHC >> /proc/acpi/wakeup" + +[Install] +WantedBy=multi-user.target diff --git a/GoModule/.gitignore b/go-module/.gitignore similarity index 100% rename from GoModule/.gitignore rename to go-module/.gitignore diff --git a/GoModule/README.org b/go-module/README.org similarity index 100% rename from GoModule/README.org rename to go-module/README.org diff --git a/GoModule/src/test/main.go b/go-module/src/test/main.go similarity index 100% rename from GoModule/src/test/main.go rename to go-module/src/test/main.go diff --git a/LDAP/.gitignore b/ldap/.gitignore similarity index 100% rename from LDAP/.gitignore rename to ldap/.gitignore diff --git a/LDAP/ldap.go b/ldap/ldap.go similarity index 100% rename from LDAP/ldap.go rename to ldap/ldap.go diff --git a/TaskManager/job.go b/task-manager/job.go similarity index 100% rename from TaskManager/job.go rename to task-manager/job.go diff --git a/TaskManager/task.go b/task-manager/task.go similarity index 100% rename from TaskManager/task.go rename to task-manager/task.go diff --git a/TaskManager/task_manager.go b/task-manager/task_manager.go similarity index 100% rename from TaskManager/task_manager.go rename to task-manager/task_manager.go