Why my USB mouse gets suspended after 3 seconds of inactivity?

13

5

Mouse's bottom LED goes off after 3 seconds after connection and cursor movements and wheel stops. Pressing any button, reconnecting or resetting USB device resumes it for another 3 seconds (when resumed by pressing button, this event does no go to X).

This happens when using any of USB ports. This mouse works well with other computer with Linux. It was working well before.

Why can it happen? How to fix it?

Update: It happens only if laptop is on battery.

Answer: this is caused by powersaving done by laptop-mode-tools. To temporary turn off powersaving one can use

for i in /sys/bus/usb/devices/*/power/control; do echo on > $i; done

Vi.

Posted 2012-04-04T21:56:26.510

Reputation: 13 705

My crappy no name wireless mouse does this. It doesn't matter if my computer is plugged in or on battery. To make matters worse, no amount of activity will "unsuspend" the mouse once it gets stuck, forcing me to remove and reinsert the batteries every 3-5 seconds. Useless piece of s**t. – Emanuel Landeholm – 2015-01-01T14:49:29.747

@Vi.: I propose changing the accepted answer to the one of OscarGarcia, because his is the most accurate, actually answers both your questions, and doesn't have any side-effects like disabling USB autosuspend at all... – Martin Pecka – 2017-04-25T12:08:53.693

This only happens on linux, or other operation systems? – soandos – 2012-04-04T21:59:28.127

I have just observed it. May be reboot will fix it, but I want to know why this can happen. – Vi. – 2012-04-04T22:02:06.053

Answers

5

It's a very old question, related with laptop-mode, but I'll post my solution:

In Ubuntu 14.04 I edited /etc/laptop-mode/conf.d/usb-autosuspend.conf and change this lines to blacklist usbhid:

# The list of USB driver types that should not use autosuspend.  The driver
# type is given by "DRIVER=..." in a USB device's uevent file.
# Example: AUTOSUSPEND_USBID_BLACKLIST="usbhid usb-storage"
## Old value: AUTOSUSPEND_USBTYPE_BLACKLIST=""
AUTOSUSPEND_USBTYPE_BLACKLIST="usbhid"

In Ubuntu 12.04 I must to edit /etc/laptop-mode/conf.d/runtime-pm.conf and change this lines to blacklist usbhid:

# The list of device driver types that should use autosuspend.  The driver
# type is given by "DRIVER=..." in a device's uevent file.
# Example: AUTOSUSPEND_DEVTYPE_WHITELIST="usbhid usb-storage"
## Old value: AUTOSUSPEND_RUNTIME_DEVTYPE_WHITELIST=""
AUTOSUSPEND_RUNTIME_DEVTYPE_WHITELIST="usbhid"

You can also blacklist usb-storage! and you can also blacklist device by ID (AUTOSUSPEND_RUNTIME_DEVID_WHITELIST in Ubuntu 12.04 or AUTOSUSPEND_USBID_BLACKLIST in Ubuntu 14.04).

Then you'll need to restart laptop mode for the changes to take effect:

sudo /etc/init.d/laptop-mode restart

And then replug mouse. The mouse will not suspend again.

This works for me at work (ubuntu 12.04) and home (ubuntu 14.04).

Hope It helps :)

OscarGarcia

Posted 2012-04-04T21:56:26.510

Reputation: 166

This answer solved my problem in Debian. I blacklisted usbhid and psmouse and after restarting laptop-mode service, and replug my mouse, the issue is solved – Sharuzzaman Ahmat Raslan – 2016-01-15T11:30:04.623

This should really be the accepted answer, since it only blacklists autosuspend of HID devices, but leaves you the possibility to autosuspend all other devices. – Martin Pecka – 2017-04-25T12:03:24.633

Because of that I suggest AUTOSUSPEND_USBID_BLACKLIST too. – OscarGarcia – 2017-04-25T12:14:04.457

Doesn't work for me on Ubuntu 14.04, lenovo thinkpad :( – Thomas – 2018-03-10T12:31:29.473

@Thomas which of the solutions does not work for you? Could you share the lsusb id or the module, mouse type, ect? If it is using an wireless adaptor, maybe it is necessary to blacklist it too! Edit: do you have laptop-tools installed? – OscarGarcia – 2018-03-10T12:55:38.310

11

I have the perfect solution!

If

for i in /sys/bus/usb/devices/*/power/control; do echo on > $i; done

works for you, but only once, edit /etc/laptop-mode/conf.d/usb-autosuspend.conf to replace :

CONTROL_USB_AUTOSUSPEND="auto"

by

CONTROL_USB_AUTOSUSPEND=0

It works for me.

Léo

Posted 2012-04-04T21:56:26.510

Reputation: 111

only the first command (for ...) did work. I tried everything even stopping laptop-mode service and it didn't change. Thanks – lepe – 2016-11-26T00:30:39.397

The file /etc/laptop-mode/conf.d/usb-autosuspend.conf doesn't exist for me. Should I create it? – Simon Baars – 2018-05-22T07:00:23.007

Man, you really said something that makes sense. Thanks! – BrunoJCM – 2013-06-10T20:18:41.677

I didn't know that I had the 'laptop-mode-tools' package installed.. It may also explain other problems with the cpu scalling indicator I had. – BrunoJCM – 2013-06-10T20:20:09.870

0

This is a normal behaviour of all mouses after they are getting wireless, to save battery. you can adjust it if it has a 3rd party software coming within the box.

siesta

Posted 2012-04-04T21:56:26.510

Reputation: 17

2He doesn't says if it's a wireless mouse. – Renan – 2012-04-04T22:13:09.680

1This is wired USB mouse. – Vi. – 2012-04-04T22:17:57.703

Ok. I just looked my wired usb mouse and also it is getting inactive after 5 seconds, and this is also for energy saving, because you may use it with a laptop which battery time matters. And isn't it a good feature? – siesta – 2012-04-04T22:22:26.990

The LED is not dimmed, but is off at all, preventing the normal use of mouse (need to click every time before moving). – Vi. – 2012-04-04T22:35:08.787

Battery saving? Probably, because of turning the netbook to AC prevents turning off mouse. How to [temporarily] disable such energy saving? – Vi. – 2012-04-04T22:36:08.227

firstly try "sudo pm-powersave false" if not work search for "laptop-mode-tools" – siesta – 2012-04-04T22:46:58.003

"pm-powersave false" does nothing, but disabling laptop-mode-tools works. – Vi. – 2012-04-04T22:57:07.917

1Please comment on the answer above, this one is completely wrong and misleading. – BrunoJCM – 2013-06-10T20:26:33.640