[Bug] ErgoDox EZ prevents suspend if key is pressed during suspend and breaks USB ports until reboot
#15,108 opened on 2021年11月10日
Repository metrics
- Stars
- (20,368 stars)
- PR merge metrics
- (平均マージ 20d 9h) (30d で 27 merged PRs)
説明
Describe the Bug
I'm suspending my system using the following command:
systemctl suspend
I currently have two keyboards attached to my pc. If I execute this command by pressing Enter on my regular dumb keyboard, everything works. If I execute this command by pressing Enter on my ErgoDox EZ, the system will not suspend.
Afterwards, one of three things happens:
- I am able to wake the system back up and everything appears to be normal.
- I am able to wake the system back up but the ErgoDox EZ, the host USB port, and the surrounding USB ports are dead.
- I am not able to wake the system back up and have to reset.
In the first case, I see the following system logs:
Nov 10 14:10:29 desk kernel: Disabling non-boot CPUs ...
Nov 10 14:10:29 desk kernel: Wakeup pending. Abort CPU freeze
Nov 10 14:10:29 desk kernel: Non-boot CPUs are not disabled
The log times here are not accurate. I strongly suspect that suspend hangs after the first log message. The wakeup happens after I subsequently press any key on any of the keyboards.
In the second case, I see the same logs but additionally the following:
Nov 10 03:13:32 desk kernel: xhci_hcd 0000:08:00.3: xHCI host not responding to stop endpoint command.
Nov 10 03:13:32 desk kernel: xhci_hcd 0000:08:00.3: USBSTS: PCD
Nov 10 03:13:32 desk kernel: xhci_hcd 0000:08:00.3: xHCI host controller not responding, assume dead
Nov 10 03:13:32 desk kernel: xhci_hcd 0000:08:00.3: HC died; cleaning up
Nov 10 03:13:32 desk kernel: PM: dpm_run_callback(): usb_dev_resume+0x0/0x10 returns -22
Nov 10 03:13:32 desk kernel: usb 4-4: PM: failed to resume async: error -22
In the third case, I see the following logs:
Nov 10 15:57:02 desk kernel: usb usb3-port2: connect-debounce failed
Nov 10 15:57:02 desk kernel: xhci_hcd 0000:08:00.3: WARN: xHC save state timeout
Nov 10 15:57:02 desk kernel: PM: suspend_common(): xhci_pci_suspend+0x0/0x150 [xhci_pci] returns -110
Nov 10 15:57:02 desk kernel: PM: pci_pm_suspend(): hcd_pci_suspend+0x0/0x30 returns -110
Nov 10 15:57:02 desk kernel: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -110
Nov 10 15:57:02 desk kernel: xhci_hcd 0000:08:00.3: PM: failed to suspend async: error -110
Nov 10 15:57:02 desk kernel: PM: Some devices failed to suspend, or early wake event detected
I can work around this problem by setting NO_USB_STARTUP_CHECK.
After looking at the code, my uneducated guess is that the firmware sees that the Enter key is depressed and immediately tries to wake the system back up and is stuck in https://github.com/qmk/lufa/blob/19a5d533f02a7b46eeadca99cc9699659cef7a60/LUFA/Drivers/USB/Core/AVR8/Device_AVR8.c#L41-L53 while the kernel (or the bios, or whatever) waits for the device to go to sleep.
System Information
- Keyboard: ErgoDox EZ
- Operating system: Linux 5.14.14-arch1-1
The firmware was created by https://configure.zsa.io/