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:

  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/