1

I want to disable autosuspend for a single USB port. I have tested the following successfully:

sudo echo on > /sys/bus/usb/devices/1-2.4/power/control 

How can I make this configuration permanent? Few sources mention /etc/rc.local, but I am not sure if this is the correct place. The USB port I am targeting is part of a docking station, so it may not be present. Sure I can check if that USB device is present, but I am suspecting that there is a better solution. It is also possible to disable autosuspend for all ports using usbcore.autosuspend=-1 in GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub. Is there a draw-back to disabling autosuspend for all devices? The only USB device that I have plugged in at all times (asides from keyboard and mouse) is a webcam. Will there be noticeably more power consumption if autosuspend is disabled?

1 Answer 1

1

The best way to set up sth permanently is to create a systemd service. In your case I'd write sth like this: sudo nano /etc/systemd/system/usbsuspend.service(choose anyName.service) It's content:

[Unit]
Description= Your description here

[Service]
Type=simple
ExecStart= echo>on > /sys/bus/usb/devices/1-2.4/power/control

[Install]
WantedBy=multi-user.target

To enable that service execute:

sudo systemctl enable usbsuspend.service(or your service name)

To start the service right away:

sudo systemctl start usbsuspend.service

2
  • I like that solution, but I had to run the command like this: /bin/sh -c 'echo on > /sys/bus/usb/devices/1-2.4/power/control' to solve Executable path is not absolute: echo>on > /sys/bus/usb/devices/1-2.4/power/control
    – fvclaus
    Commented Jul 26, 2020 at 8:44
  • Yes, it depends. Basically I wanted to point you into the direction of services. An alternative would have been to put that command in a bash file and call that executable with ExecStart
    – kanehekili
    Commented Jul 28, 2020 at 17:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .