Skip to content

solution for usb devices disconnecting after closing sc-controller #115

Description

@Toddkl93

I was having this issue on my steam deck, it wasn't sending control back over to "lizard mode", meaning I would exit out of sc-controller, and instead of handing the control of my touchpads and triggers back to lizard mode, they would just stop working until I restarted my steam deck. I have cachyos handheld edition installed, I'm not sure if that makes a difference, but this solution worked for me, and I think it should work for anyone using Linux. It basically just resets your USB devices and gives control back to them after sc-controller closes when it fails to do so.

  1. Open a terminal and type: nano ~/fix-usb.sh

  2. Type this in, and then save it with ctrl+O, enter, then ctrl + X.

#!/bin/bash
for dev in $(grep -l "28de" /sys/bus/usb/devices/?-?/idVendor 2>/dev/null | cut -d/ -f6); do
for ep in "$dev":1.{0..2}; do
echo "$ep" | sudo tee /sys/bus/usb/drivers/usbhid/unbind >/dev/null 2>&1
echo "$ep" | sudo tee /sys/bus/usb/drivers/usbhid/bind >/dev/null 2>&1
done
done

3.make it executable with this:
chmod +x ~/fix-usb.sh

  1. Create a desktop launcher for the file with this command:

nano ~/.local/share/applications/fix-usb.desktop

(And then paste this, where it says YOURUSERNAME, enter your username on Linux):

[Desktop Entry]
Type=Application
Name=Fix USB
Exec=/home/YOURUSERNAME/fix-usb.sh
Terminal=true
Icon=utilities-terminal
Categories=Utility;

(And then save again with ctrl+O, enter, then ctrl+X)

Now when you look in your applications menu you will see a launcher that looks like an app called fix USB, if you launch that, it'll reset your USB devices.

  • For this to work on other Linux devices that are not Steam Deck:
  1. Find your device's vendor ID:
    Run lsusb and note the 4-digit hex code before the colon (e.g., 1234 in ID 1234:abcd).

  2. Create the script:
    nano ~/reset-usb.sh and paste this (replace YOUR_VENDOR_ID with yours):

    #!/bin/bash
    VENDOR="YOUR_VENDOR_ID"
    for dev in $(grep -l "$VENDOR" /sys/bus/usb/devices/?-?/idVendor 2>/dev/null | cut -d/ -f6); do
      for ep in "$dev":1.{0..2}; do
        echo "$ep" | sudo tee /sys/bus/usb/drivers/usbhid/unbind >/dev/null 2>&1
        echo "$ep" | sudo tee /sys/bus/usb/drivers/usbhid/bind >/dev/null 2>&1
      done
    done
    

@C0rn3j I just wanted to share this with you because I'm not sure if this can be something that's integrated into the program itself but it might help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions