How to disable auto power off of usb devices like usb mouse?
Solution 1
It's PowerNap that's doing this.
You can disable just this part of PowerNap's power savings scripts with:
sudo powernap-action --disable usb_autosuspend
Solution 2
Just copy paste the following command in terminal and it will disable auto suspending.
Disabling auto suspending USB
echo 2 | sudo tee /sys/bus/usb/devices/*/power/autosuspend >/dev/null
Disable USB autosuspend
echo on | sudo tee /sys/bus/usb/devices/*/power/level >/dev/null
Solution 3
Could it be that laptop mode tools are causing this? If so, try the following:
-
Optional: Create a backup of
/etc/laptop-mode/conf.d/usb-autosuspend.conf
by copying it in your home folder:cp /etc/laptop-mode/conf.d/usb-autosuspend.conf ~/usb.autosuspend.old
-
Get the USB ID of your mouse/keyboard
lsusb
This will return a list including
ID xxxx:xxxx
for your mouse/keyboard. -
Edit the original
usb-autosuspend.conf
sudo gedit /etc/laptop-mode/conf.d/usb-autosuspend.conf
There will be an entry called
AUTOSUSPEND_USBID_BLACKLIST=''
change this toAUTOSUSPEND_USBID_BLACKLIST='xxxx:xxxx'
-
This should stop your USB mouse/keyboard from being suspended. Now you either need to restart your computer or restart laptop-mode using
sudo service laptop-mode restart
Source: http://www.hecticgeek.com/2012/06/fix-usb-mouse-not-working-laptop-mode-tools-ubuntu/
Related videos on Youtube
rrj
Updated on September 18, 2022Comments
-
rrj over 1 year
I don't know how , but somehow automatic power-off of usb devices got accidentally enabled. Now my usb mouse goes off even if it's idle for 2-3 seconds. It's really irritating.
This happened after I installed
powertop
andpowernap
. Maybe it has something to do with these two applications.How can I disable this "feature"?
-
Fernando Kosh over 10 yearsDisable USB autosuspend is exactly what I was looking for. Here I don't have powernap installed.
-
eggonlegs about 10 yearsSame, I don't have powernap either. This worked for me.
-
mveroone about 10 yearsIs that reboot-persistent ?
-
Qasim about 10 yearsnope @Kwaio ... also have a look askubuntu.com/questions/285434/…
-
Bryce over 9 yearsHow to make it reboot-persistent: askubuntu.com/questions/73590/…
-
rubo77 over 9 yearsYou find your ID with the command
lsusb|grep -i mouse|sed 's/^.* ID //g'|sed 's/ .*$//g'
(assuming there is the word "mouse" in the string for your mouse) If you don't find out the ID of your mouse, usewatch -d lsusb
while you plug in your mouse. -
rosencreuz about 9 yearsWhat is this difference between the two scripts? Do I need both or only one of them?
-
Qasim about 9 yearsI would recommend the use of tlp. @rosencreuz
-
Qasim about 9 years@rosencreuz askubuntu.com/questions/285434/…
-
partofthething almost 9 yearsAt least in Ubuntu 15.04, this file has been moved to
runtime-pm.conf
and the line to add the id to is now calledAUTOSUSPEND_RUNTIME_DEVID_BLACKLIST=""
. Strangely, I couldn't get my blacklist to work so I just disabled this module by settingCONTROL_RUNTIME_AUTOSUSPEND=0
. It worked! -
laertiades almost 9 yearsI had to change line 2 to
do sudo sh -c "echo on > $foo";
-
Qasim almost 9 yearsJust do sudo su , before you do anything.... be root @laertiades
-
ctrl-alt-delor about 8 yearsIt worked on Debian Jessie (8.4), but file is
/etc/laptop-mode/conf.d/runtime-pm.conf
-
ctrl-alt-delor about 8 yearsWorks, but converting from device number given by
lsusb
, and number in/sys/bus/usb/devices
, is hard. I see no relationship. The bus number is the same, then I just poke around looking for a matching manufacturer:device ID. -
ctrl-alt-delor about 8 yearsFor me in debian jessie (8.4) it was laptop mode. See answer below. Writing to
/sys/bus/usb/devices/«device»/power/level
also worked, see other answer. -
Adam Plocher over 7 yearsYou were spot on, in my case I ran "lmt-config-gui" for Laptop Mode Tools and unchecked "Enable module runtime-pm". This issue began after updating my KDE Neon kernel from 4.4 to 4.8 last night and was driving me bonkers! Thanks!
-
aashish almost 7 yearsWe need to run both commands. It works !!
-
Erik van Oosten almost 7 yearsOn Ubuntu 16.04
kern.log
says:WARNING! power/level is deprecated; use power/control instead
-
dragon788 over 6 yearsI didn't have laptop-mode installed (though something was suspending my USB) and when I did install
laptop-mode-tools
I didn't have the usb-autosuspend.conf (that was for 14.04 but I have 16.04). I did have a/etc/laptop-mode/conf.d/runtime-pm.conf
per askubuntu.com/a/370406/318507 . Still waiting to see if this fixes the issue or if I have to track down what was originally suspending it.