0
Waking from suspend from a USB keyboard stops working on my laptop if I have unplugged and replugged the keyboard while the laptop is in suspend.
I'm on Linux, specifically NixOS (although I imagine this question would be relevant for any distro).
Waking from suspend works fine if I don't unplug the USB keyboard during suspend.
/sys/bus/usb/devices/1-7.1
is the keyboard in question. /sys/bus/usb/devices/1-7.1/power/wakeup
is set to enabled
, both before and after suspend.
My laptop is a Lemur 8 from System76. There are no BIOS options related to USB wake from suspend.
I am suspending the laptop by running sudo systemctl suspend
from a terminal.
edit: I wanted to clarify the exact steps I am performing:
- The computer is turned on, awake, and the USB keyboard is plugged in.
- I suspend the laptop using
sudo systemctl suspend
from a terminal. - With the laptop suspended, I unplug the USB keyboard.
- With the laptop still suspended, I re-plug the USB keyboard.
- I hit a key on the USB keyboard, expecting it to wake the laptop. Nothing happens. The laptop does not wake up.
If I don't do steps 3 and 4 (that is to say, if I don't unplug and re-plug the USB keyboard), I am able to wake the laptop up by hitting a key on the USB keyboard.
So don't unplug your keyboard. If your system is suspended how do you expect it to recognise that a new device has been plugged in? – DavidPostill – 2018-02-14T11:13:16.320
My keyboard is actually on a KVM switch, so if I want to use another computer, I will need to effectively "unplug" the usb keyboard from this laptop in question. However, I have confirmed that the KVM is not related to this problem, and it persists even if I just unplug/replug a normal USB keyboard directly into the laptop. – illabout – 2018-02-14T13:10:01.473
I'm not sure how the laptop would be able to recognize that a new device is plugged in when it is suspended. That's why I am asking the question. I assumed that it would be possible to wake up the laptop from suspend regardless of when I plugged in the keyboard. If it is not possible to wake up a laptop from a USB keyboard if the keyboard was not plugged in before the laptop was suspended, then, well, I would accept that as an answer. – illabout – 2018-02-14T13:14:37.773
"My keyboard is actually on a KVM switch." That's a different question. Please [edit] and add this essential information to you question. – DavidPostill – 2018-02-14T13:55:51.940
As I said in my previous comment, I've tested that the problem still exists without using the KVM switch. It occurs when using a USB keyboard directly plugged into the computer, as described in the question. Therefore, the KVM switch isn't relevant to this question. – illabout – 2018-02-15T02:44:42.030
I agree that if the problem occured only when the keyboard was plugged in through a KVM switch, then it would be relevant information. However, that is not the case. The problem occurs whether or not a KVM switch is being used. – illabout – 2018-02-15T02:45:48.327
Please clarify exactly what action is taking place -- removing keyboard from KVM, removing KVM from computer, removing keyboard from computer, switching KVM without unplugging anything? The symptom may be the same, but the cause and corrective action would be different. And if you're using a KVM, why do you need to unplug anything? – fixer1234 – 2018-03-02T04:36:41.057
@fixer1234 Like I said in a previous comment, the problem occurs whether or not I am using a KVM switch. The fact that I am using a KVM switch is not part of the question. As described in the question, if I just plug/unplug a USB keyboard directly into my laptop, I experience the problem. I will add little bit more explanation to the question about the exact sequence of steps I perform. – illabout – 2018-03-02T04:47:26.930
1Whether you're actually using a KVM is important. Unplugging a keyboard from the computer will always cause the problem you describe. If you are working through a KVM and the KVM remains connected, you should not have the problem when you switch the KVM or disconnect the keyboard from the KVM (at least as long as the KVM is switched to the other computer; not sure if the KVM is switched to the the computer in question). If the problem occurs when the KVM is connected, at least when switched to the other computer, it indicates a bad KVM (a different cause). – fixer1234 – 2018-03-02T05:03:30.883
@fixer1234 "Unplugging a keyboard from the computer will always cause the problem you describe." If that is true, then you could add it as an answer and I will accept it. (Of course, if you add some sort of reference it would be better for other people who visit this question). – illabout – 2018-03-02T05:08:42.930
@fixer1234 "If the problem occurs when the KVM is connected, at least when switched to the other computer, it indicates a bad KVM (a different cause)." That is definitely good to know, although it seems like a different question than the one I asked. Maybe I should create a new question asking specifically about suspending while having a KVM connected. (Although I guess you've basically already answered it: "a bad KVM") – illabout – 2018-03-02T05:11:10.080
1Ali Chen's answer already covers why the problem occurs if you disconnect directly from the computer. A KVM maintains the USB connection when you switch to the other computer. I'm not sure whether it also provides the USB connection when switched to the current computer (i.e., the computer sees the switch as a device and the switch passes the keyboard signal across), or the KVM simply relies on the connected keyboard for that. In the latter case, disconnecting the keyboard from the KVM would break the USB connection. – fixer1234 – 2018-03-02T05:22:52.067