当我使用挂起到 RAM 功能并稍后恢复系统时,我的 USB 键盘和鼠标不再工作。
如果我在恢复后通过 SSH 进入我的系统,我会发现lsusb
没有键盘和鼠标。
物理断开并重新连接 USB 设备将使它们重新开始工作。
有没有办法来解决这个问题?
主板:华硕 P8P67 Pro
Ubuntu 19.04
USB 设备:
Bus 002 Device 004: ID 0f39:1086 TG3 Electronics DK2108SZ Keyboard [Ducky Zero]
Bus 002 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
(MX2 master)
答案1
恢复期间打开所有 USB 电源
很难找出到底发生了什么。让一切正常工作的一个好机会是使用这个脚本,它模拟在挂起期间拔下 IR,并在恢复期间插入它:
#!/bin/bash
# NAME: custom-xhci_hcd
# PATH: /lib/systemd/system-sleep
# CALL: Called from SystemD automatically
# DESC: Suspend broken for USB3.0 as of Oct 25/2018 various kernels all at once
# DATE: Oct 28 2018.
# NOTE: From comment #61 at: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/522998
TMPLIST=/tmp/xhci-dev-list
case $1/$2 in
pre/*)
echo "$0: Going to $2..."
echo -n '' > $TMPLIST
for i in `ls /sys/bus/pci/drivers/xhci_hcd/ | egrep '[0-9a-z]+\:[0-9a-z]+\:.*$'`; do
# Unbind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
echo "$i" >> $TMPLIST
done
;;
post/*)
echo "$0: Waking up from $2..."
for i in `cat $TMPLIST`; do
# Bind xhci_hcd for first device XXXX:XX:XX.X:
echo -n "$i" | tee /sys/bus/pci/drivers/xhci_hcd/bind
done
rm $TMPLIST
;;
esac
家政
使用 root 权限创建脚本:
sudo -H gedit /lib/systemd/system-sleep/custom-xhci_hcd
插入上面的文本并保存文件。将脚本标记为可执行:
sudo chmod a+x /lib/systemd/system-sleep/custom-xhci_hcd
重启并测试
如果脚本无法帮助删除它:
sudo rm -f /lib/systemd/system-sleep/custom-xhci_hcd