1

When I use the suspend-to-ram function and then later resume my system, my USB keyboard and mouse no longer work.

If I SSH into my system after resuming, I can see that lsusb does not see the keyboard and mouse.

Physically disconnecting and reconnecting the USB devices causes them to start working again.

Is there a way to fix this?

Motherboard: Asus P8P67 Pro

Ubuntu 19.04

USB devices:

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 Answer 1

0

Power on all USB during resume

It's very difficult to isolate what is going on. One good chance of making everything work is with this script that simulates unplugging your IR during suspend and plugging it during resume:

#!/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

Housekeeping

Create the script with root powers:

  • sudo -H gedit /lib/systemd/system-sleep/custom-xhci_hcd

Insert text above and save file. Mark script as executable:

  • sudo chmod a+x /lib/systemd/system-sleep/custom-xhci_hcd

Reboot and test

If the script doesn't help remove it with:

  • sudo rm -f /lib/systemd/system-sleep/custom-xhci_hcd
2
  • Afraid this didn't seem to have any effect :(
    – Oenotria
    May 15, 2019 at 20:39
  • Can you confirm script was running with journalctl -b | grep custom-xhci after you resume? May 16, 2019 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.