How to disable auto power off of usb devices like usb mouse?
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
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
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/