How to permanently disable autosuspend for specific USB port?
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
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.targetTo enable that service execute:
sudo systemctl enable usbsuspend.service(or your service name)
To start the service right away:
sudo systemctl start usbsuspend.service