32

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 and powernap. Maybe it has something to do with these two applications.

How can I disable this "feature"?

1

3 Answers 3

35

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
13
  • 2
    Disable USB autosuspend is exactly what I was looking for. Here I don't have powernap installed. Jan 24, 2014 at 1:08
  • 7
    Is that reboot-persistent ?
    – mveroone
    Apr 25, 2014 at 12:23
  • 2
    How to make it reboot-persistent: askubuntu.com/questions/73590/…
    – Bryce
    Sep 18, 2014 at 23:54
  • 2
    What is this difference between the two scripts? Do I need both or only one of them?
    – rosencreuz
    Mar 10, 2015 at 11:07
  • 2
    On Ubuntu 16.04 kern.log says: WARNING! power/level is deprecated; use power/control instead Jul 30, 2017 at 18:28
12

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
1
  • 1
    For 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. Apr 7, 2016 at 9:26
10

Could it be that laptop mode tools are causing this? If so, try the following:

  1. 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
    
  2. Get the USB ID of your mouse/keyboard

    lsusb
    

    This will return a list including ID xxxx:xxxx for your mouse/keyboard.

  3. Edit the original usb-autosuspend.conf

    sudo gedit /etc/laptop-mode/conf.d/usb-autosuspend.conf
    
  4. There will be an entry called AUTOSUSPEND_USBID_BLACKLIST='' change this to AUTOSUSPEND_USBID_BLACKLIST='xxxx:xxxx'

  5. 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/

5
  • You 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, use watch -d lsusb while you plug in your mouse.
    – rubo77
    Oct 10, 2014 at 22:26
  • At least in Ubuntu 15.04, this file has been moved to runtime-pm.conf and the line to add the id to is now called AUTOSUSPEND_RUNTIME_DEVID_BLACKLIST="". Strangely, I couldn't get my blacklist to work so I just disabled this module by setting CONTROL_RUNTIME_AUTOSUSPEND=0. It worked! Aug 9, 2015 at 18:36
  • It worked on Debian Jessie (8.4), but file is /etc/laptop-mode/conf.d/runtime-pm.conf Apr 7, 2016 at 9:21
  • You 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! Oct 16, 2016 at 8:01
  • I 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.
    – dragon788
    Sep 6, 2017 at 19:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.