Stop your wireless mouse cutting out when on batteries

Applies to Kubuntu 13.10, should apply to other distros with a mild bit of tweaking (please add a comment if you can provide specifics for a distro, and do forget to mention the version as things can change).

Have you noticed that when on battery power your swanky wireless mouse cuts out from time to time? This is due to power management trying to save those precious Joules in your battery and switching off the USB when it thinks it’s not needed. And if you device does not correctly support “autosuspend” this can either be mildly annoying to absolutely infuriating. There are three ways to stop it:

  1. Uninstall “laptop-mode-tools” or your distros equivalent. This is stupid.
  2. Disable power management. This is also stupid.
  3. Tell power management to cut your mouse some slack. This is what we want.

Firstly, run “lsusb” and find out the ID of you mouse. e.g.:

user@computer:~$ lsusb
Bus 002 Device 003: ID 062a:4101 Creative Labs 
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

In this case, the ID of the USB device is “062a:4101” and appears as “Creative Labs” even though it’s a”Tecknet” mouse. Curious. Anyway, we take a note of that and then using your text weapon of choice (vi, kate, Notepad…snigger) open the file “/etc/laptop-mode/conf.d/usb-autosuspend.conf” as root. e.g.:

sudo kate /etc/laptop-mode/conf.d/usb-autosuspend.conf

In there you will find various, well commented options. The one we’re going to update is “/etc/laptop-mode/conf.d/usb-autosuspend.conf”. e.g.:

AUTOSUSPEND_USBID_BLACKLIST="062a:4101"

This will stop the USB shutting down for that specific device and the change should take effect immediately (it did for me, or seemed to at any rate). You can also disable the autosuspend for classes of device (e.g. input devices like mice and mass storage). Note the different name of the setting.

AUTOSUSPEND_USBTYPE_BLACKLIST="usbhid usb-storage"

Best document I could find off-the-cuff were some Ubuntu man pages. I also see lots of other posts for the same issue on Ubuntu derivatives (e.g. “Linux Mint”). You could do worse than check the relevant forums if the above doesn’t help.

Once you’ve done this and tested it, follow the advice in “/etc/laptop-mode/conf.d/usb-autosuspend.conf” and fire off an email to the OEM of the offending device. This will achieve two things:

  1. Let them know their autosuspend support is borked; and
  2. Inform them that they have GNU/Linux customers.

Leave a Reply