Comment 21 for bug 1586195

Revision history for this message
Thiago Padilha (tpadilhacc) wrote :

The following workaround fixes for me: https://ubuntuforums.org/showthread.php?t=2226734

Here are the steps adapted for systemd:

- Check the output of `ls /sys/bus/pci/drivers/xhci_hcd`. In my laptop I see "0000:00:14.0 bind new_id remove_id uevent unbind". The goal is to get the id of the xhci_hcd, for me it is "0000:00:14.0"(which I will use in the following steps). Also verify that the output shows "bind" and "unbind" as directory entries. The following commands should be executed in a root shell

- Create a script to unbind the xhci:

    # cat > /usr/local/bin/unbind-xhci << "EOF"
    #!/bin/sh
    echo -n '0000:00:14.0' | tee /sys/bus/pci/drivers/xhci_hcd/unbind
    EOF
    # chmod +x /usr/local/bin/unbind-xhci

- Create a script to rebind the xhci:

    # cat > /usr/local/bin/rebind-xhci << "EOF"
    #!/bin/sh
    echo -n '0000:00:14.0' | tee /sys/bus/pci/drivers/xhci_hcd/bind
    EOF
    # chmod +x /usr/local/bin/rebind-xhci

- Create a systemd service that runs before sleep:

    # cat > /etc/systemd/system/unbind-xhci.service << "EOF"
    [Unit]
    Description=Unbind xHCI Host Controller Driver before sleep
    Before=sleep.target

    [Service]
    Type=oneshot
    ExecStart=/usr/local/bin/unbind-xhci

    [Install]
    WantedBy=sleep.target
    EOF

- Create a systemd service that runs after wakeup:

    # cat > /etc/systemd/system/rebind-xhci.service << "EOF"
    [Unit]
    Description=Unbind xHCI Host Controller Driver after wakeup
    After=suspend.target
    After=hibernate.target
    After=hybrid-sleep.target

    [Service]
    Type=oneshot
    ExecStart=/usr/local/bin/rebind-xhci

    [Install]
    WantedBy=suspend.target
    WantedBy=hibernate.target
    WantedBy=hybrid-sleep.target
    EOF

- Reload systemd

    # systemctl daemon-reload