You are not logged in.

#1 2014-08-17 03:16:09

LeftyAce
Member
Registered: 2012-08-18
Posts: 159

USB Mouse keeps falling asleep

Hi all,

I have a Thinkpad X61 laptop which recently developed a problem with the usb mouse. When I first boot up the computer, or when I resume it from hibernation, the mouse works initially, and then a few seconds later the tracking light goes out (optical mouse) and I cannot move the pointer. If I click one of the mouse buttons, it wakes up and I can use it, but if I stop moving it for a few seconds it falls asleep again. This happens whether it is plugged in through the docking station or directly into the computer. It happens when the mouse is plugged in while the machine powers up.

If I unplug it and re plug it into the USB port the problem goes away, it stays on continuously and is fantastic until I shut down or hibernate again.

Any idea what this is? Or where I should start looking?

Thanks in advance,

Lefty

Offline

#2 2014-08-17 04:48:32

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,804

Re: USB Mouse keeps falling asleep

LeftyAce wrote:

.... Or where I should start looking?

I would take a close look at dmesg, journalctl and Xorg.0.log in that order.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2014-08-17 10:27:05

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: USB Mouse keeps falling asleep

Using any of the power saving suggestions from powertop, such as autosuspend for your mouse?


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#4 2014-08-18 02:22:40

LeftyAce
Member
Registered: 2012-08-18
Posts: 159

Re: USB Mouse keeps falling asleep

Thank you both for your replies.

Powertop showed that on boot-up usb autosuspend was enabled for the mouse. Unplugging and re-plugging the mouse made that go away. I went and blacklisted the mouse in /etc/laptop-mode/conf.d/usb-autosuspend.conf, which fixed the problem. The strange thing is that USB autosuspend is now disabled for all USB devices, so it appears the blacklist is a bit overzealous. Not sure if I care, if I'm using the USB mouse I'm on AC power anyway.

Offline

#5 2014-08-18 04:34:55

LeftyAce
Member
Registered: 2012-08-18
Posts: 159

Re: USB Mouse keeps falling asleep

Well darn. The fix stopped working. After a system update (perhaps coincidental?), the mouse has started misbehaving again. I checked, the laptop-mode file blacklist entry still matches the ID for the mouse (According to lsusb). Powertop shows the mouse is being set to autosuspend.

Any ideas?

Thanks in advance,

Lefty

Offline

#6 2014-08-18 08:21:39

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: USB Mouse keeps falling asleep

Find what is enabling usb autosuspend, I would look first into laptop-mode or any other similar tools. I don't use any of that so can't help there.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#7 2014-08-18 09:01:34

ooo
Member
Registered: 2013-04-10
Posts: 1,638

Re: USB Mouse keeps falling asleep

you can also disable usb autosuspend for specific device with an udev rule:

# /etc/udev/rules.d/usb-autosuspend.rules
# enable usb autosuspend
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto"
# disable it for usb mouse
#ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="XXXX", ATTR{idProduct}=="XXXX", TEST=="power/control", ATTR{power/control}="on"

just check the idVendor and idProduct from lsusb
not sure how this would behave with laptop-mode-tools though.

Offline

#8 2014-09-01 04:37:22

LeftyAce
Member
Registered: 2012-08-18
Posts: 159

Re: USB Mouse keeps falling asleep

Finally had a chance to try a udev rule. Here's what I did (it didn't work): I created a file called /etc/udev/rules.d/usb-autosuspend.rules with these contents:

# enable USB autosuspend
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control", ATTR{power/control}="auto"
# disable for USB mouse
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="19ff", ATTR{idProduct}=="0238", TEST=="power/control", ATTR{power/control}="on"

I ran

# udevadm test $(udevadm info -q path -n  /dev/input/by-id/usb-PixArt_DynexWired_USB_Optical_Mouse-mouse ) 2>&1 

and got no errors. But the mouse behavior is unchanged. Is there a way to check whether that rule was successfully loaded/is active?

Currently what I'm doing is running powertop and toggling the USB autosuspend for the mouse manually. When I start powertop, it complains:

 Cannot load from file /var/cache/powertop/saved_parameters.powertop 

I don't know if that's related. Based on some searching that may just be because I haven't run the powertop calibration, so perhaps not related?

Any other ideas?

Thanks,

Lefty

Offline

#9 2014-09-01 08:18:20

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: USB Mouse keeps falling asleep

LeftyAce wrote:

Is there a way to check

Yes, see my old post.

Offline

#10 2014-09-01 16:35:41

LeftyAce
Member
Registered: 2012-08-18
Posts: 159

Re: USB Mouse keeps falling asleep

Thanks for that, brebs.

It looks like either my udev rule is not being run, or is failing. Here's what I get from your check command:

5-4.1   auto    1.5     DynexWired USB Optical Mouse

That's true right after boot up and after running udevadm control --reload.

Offline

#11 2014-09-01 20:50:33

brebs
Member
Registered: 2007-04-03
Posts: 3,742

Re: USB Mouse keeps falling asleep

Woah, why are you tempting fate with your filename? Use:

/etc/udev/rules.d/91-local.rules

Look at all the other filenames, they are processed in order.

After changing the udev rules, run:

udevadm control --reload

Offline

#12 2014-09-16 18:34:28

gps1539
Member
From: Los Gatos, CA
Registered: 2013-11-06
Posts: 134

Re: USB Mouse keeps falling asleep

Hi

Did you find a solution?

I am seeing a very similar problem on a Thinkpad T410. My mouse is inactive when I redock the laptop. I have to either reinsert the usb cable for the mouse or the power cord for the Dock to wake up the mouse.

Last edited by gps1539 (2014-09-17 05:29:25)

Offline

#13 2014-09-16 18:48:33

LeftyAce
Member
Registered: 2012-08-18
Posts: 159

Re: USB Mouse keeps falling asleep

Unfortunately I still do not have a solution. I updated the udev rule name to be less dangerous, but nothing has changed. I haven't had time to investigate further, but I'm still looking for suggestions :-)

Offline

#14 2014-09-18 17:50:53

daulpavis
Member
Registered: 2013-10-10
Posts: 3

Re: USB Mouse keeps falling asleep

Same problem on ASUS ux31 with a USB dell mouse. Bad on boot and okay after unplug plug cycle.
Bus 001 Device 014: ID 0461:4d81 Primax Electronics, Ltd Dell N889 Optical Mouse

I think I am also seeing something similar with the USB keyboard dropping the first few strokes if I haven't typed for a few seconds.
Bus 001 Device 013: ID 413c:2011 Dell Computer Corp. Multimedia Pro Keyboard

Again its down to the autosuspend state.

Offline

#15 2014-09-18 18:19:32

emeres
Member
Registered: 2013-10-08
Posts: 1,570

Re: USB Mouse keeps falling asleep

@all What if you:

# echo on > /sys/class/usb/[path-to-device]/power/control; # by hand ?

@LeftyAce the second value of the command brebs linked to still states "auto", so the rule did not apply.

 You can globally disable autosuspend with modprobe options:

$ cat /etc/modprobe.d/50-usbcore.conf
options usbcore autosuspend=-1

 The kernel should also accept this, although untested:

usbcore.autosuspend=-1

Offline

#16 2014-09-18 18:43:29

Kilzool
Member
From: Ireland
Registered: 2010-08-04
Posts: 232

Re: USB Mouse keeps falling asleep

I looked around my house, and found a mouse adapter for USB -> to PS/2 -- that solved all my mouse problems.

Offline

#17 2014-09-24 15:08:39

gps1539
Member
From: Los Gatos, CA
Registered: 2013-11-06
Posts: 134

Re: USB Mouse keeps falling asleep

Latest update partially fixes the issue (now on 3.16.3-1).

Sometimes the mouse still does not wake up from reboot or resume, but does when I redock.

Last edited by gps1539 (2014-09-24 16:00:37)

Offline

#18 2014-11-08 18:35:49

LeftyAce
Member
Registered: 2012-08-18
Posts: 159

Re: USB Mouse keeps falling asleep

Thanks for the replies everyone, clearly I haven't had time to play with this much in the past month.

I ended up globally disabling USB autosuspend in the /etc/laptop-mode/conf.d/runtime-pm.conf file. I have a question about whether this was a good idea:

Does USB autosuspend just save power by powering down attached USB devices? Or does shutting off the USB ports save power when nothing is plugged in?

My only usb devices are a mouse and keyboard which should not suspend, and I noticed that my mp3 player's port would suspend (so it stops charging) but the player thinks it's plugged in and doesn't power off, so leaving it plugged in to the computer for a few hours was actually worse than not plugging it in at all :-P Bottom line is I don't see any benefit to USB autosuspend for my uses, and it causes numerous problems.

Offline

#19 2014-11-08 18:54:29

LeftyAce
Member
Registered: 2012-08-18
Posts: 159

Re: USB Mouse keeps falling asleep

Well darn. Not sure if this should go into a new thread or not. After disabling USB autosuspend as described above, I now have a kworker/0:2 process eating up between 30 and 90% of my cpu. I'm pretty sure it's connected, as re-enabling usb autosuspend and rebooting makes it go away. Any idea where on earth that's coming from?

Offline

#20 2015-12-26 08:15:44

rashv
Member
Registered: 2015-12-21
Posts: 1

Re: USB Mouse keeps falling asleep

LeftyAce wrote:

Thanks for the replies everyone, clearly I haven't had time to play with this much in the past month.

I ended up globally disabling USB autosuspend in the /etc/laptop-mode/conf.d/runtime-pm.conf file. I have a question about whether this was a good idea:

Does USB autosuspend just save power by powering down attached USB devices? Or does shutting off the USB ports save power when nothing is plugged in?

My only usb devices are a mouse and keyboard which should not suspend, and I noticed that my mp3 player's port would suspend (so it stops charging) but the player thinks it's plugged in and doesn't power off, so leaving it plugged in to the computer for a few hours was actually worse than not plugging it in at all :-P Bottom line is I don't see any benefit to USB autosuspend for my uses, and it causes numerous problems.


Instead of globally disabling USB autosuspend in  /etc/laptop-mode/conf.d/runtime-pm.conf. I added the device ID of my Dell USB mouse on the same file and it works after reboot:

# The list of Device IDs that should not use autosuspend. Use system commands or
# look into sysfs to find out the IDs of your devices.
# Example: AUTOSUSPEND_DEVID_BLACKLIST="046d:c025 0123:abcd"
AUTOSUSPEND_RUNTIME_DEVID_BLACKLIST="04ca:0061"

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

Offline

Board footer

Powered by FluxBB