Power Management: USB mouse and keyboard laggy and loosing events

Bug #1603659 reported by Thomas Mayer
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
laptop-mode-tools (Ubuntu)
Confirmed
Undecided
Unassigned
linux (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

This issue is a regression after update to 16.04 (coming from 14.04). To my knowledge, I was using TLP together with 14.04, which got removed during the upgrade in favour of upower.

Two devices behave unexpected reproducably after a fresh reboot:

Bus 002 Device 004: ID 046a:0023 Cherry GmbH CyMotion Master Linux Keyboard G230
Bus 002 Device 003: ID 046d:c24c Logitech, Inc. G400s Optical Mouse

It looks like a power management related issue. By default,
- USB mouse pointer is invisible and mouse looses any event unless I press a mouse button (which also is executed in a dangerous manner at the last position of the invisible pointer)
- USB keyboard is inactive unless I press a few keys. These first characters get lost in the output
- This happens directly after reboot (e.g. first characters of password get lost, mouse is invisible).
- After login, it still happens: After a few seconds of inactivity, mouse and keyboard are non-responsive again.
- In addition, I also experience lost events without any delay from time to time
- In addition, scrolling with the mouse is laggy in particular

Most of these problems are gone as soon as I disable powersave in powertop for mouse and keyboard:

Bad Automatische Bereitschaft für USB-Gerät G400s Optical Gaming Mouse [Logitech]
Bad Automatische Bereitschaft für unbekanntes USB-Gerät 2-1.2 [046a:0023]

The only remaining problem is laggy scrolling and sometimes loosing events like keyboard presses, but this could still be another issue.

The powertop status of other USB devices does not have an effect on this workaround. However, the workaround via powertop is lost after next reboot.

It also has no effect when changing USB-Ports or USB-Controllers. I tried
- built-in USB 2.0 Ports of my DELL Latitude E5510 (1d6b:0002)
- replicated USB 2.0 ports of my docking station PR02X (1d6b:0002)
- PCMCIA USB 3.0 Express card (1d6b:0003)

Accordingly, this issue is not related to particular USB controllers/hubs. Plus, as two non-related USB hardware devices are concerned, this issue also might not be related to particular USB devices, bat rather affect many USB devices.

I don't experience any problems when using the built-in keyboard of the DELL Latitude E5510.

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: linux-image-4.4.0-31-generic 4.4.0-31.50
ProcVersionSignature: Ubuntu 4.4.0-31.50-generic 4.4.13
Uname: Linux 4.4.0-31-generic x86_64
ApportVersion: 2.20.1-0ubuntu2.1
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: thomas 3933 F.... pulseaudio
CurrentDesktop: GNOME-Flashback:Unity
Date: Sat Jul 16 17:43:05 2016
HibernationDevice: RESUME=UUID=28eded29-f9e6-44b5-9e54-c4dd60c8e3cd
InstallationDate: Installed on 2014-11-29 (595 days ago)
InstallationMedia: Ubuntu 14.04.1 LTS "Trusty Tahr" - Release amd64 (20140722.2)
MachineType: Dell Inc. Latitude E5510
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/@/boot/vmlinuz-4.4.0-31-generic root=UUID=6408c2d9-1b60-43d7-9a7f-2dceeb40de28 ro rootflags=subvol=@ quiet splash vt.handoff=7
RelatedPackageVersions:
 linux-restricted-modules-4.4.0-31-generic N/A
 linux-backports-modules-4.4.0-31-generic N/A
 linux-firmware 1.157.2
SourcePackage: linux
UpgradeStatus: Upgraded to xenial on 2016-06-15 (30 days ago)
dmi.bios.date: 12/06/2013
dmi.bios.vendor: Dell Inc.
dmi.bios.version: A16
dmi.board.name: 023HKR
dmi.board.vendor: Dell Inc.
dmi.board.version: A00
dmi.chassis.type: 9
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvrA16:bd12/06/2013:svnDellInc.:pnLatitudeE5510:pvr0001:rvnDellInc.:rn023HKR:rvrA00:cvnDellInc.:ct9:cvr:
dmi.product.name: Latitude E5510
dmi.product.version: 0001
dmi.sys.vendor: Dell Inc.

Revision history for this message
Thomas Mayer (thomas303) wrote :
Revision history for this message
Thomas Mayer (thomas303) wrote :

I did not post the correct devices in my previous comment.

The two affected devices are:
Bus 002 Device 004: ID 046a:0023 Cherry GmbH CyMotion Master Linux Keyboard G230
Bus 002 Device 003: ID 046d:c24c Logitech, Inc. G400s Optical Mouse

Mouse and keyboard, respectively. Both connected with their standard USB cable.

This issue is about USB only (not bluetooth related).

description: updated
Revision history for this message
Brad Figg (brad-figg) wrote : Status changed to Confirmed

This change was made by a bot.

Changed in linux (Ubuntu):
status: New → Confirmed
Revision history for this message
linrunner (linrunner) wrote :

Hi,

a plain Ubuntu does not enable USB autosuspend for input devices. Maybe you implemented something like 'powertop --autotune' in your rc.local?

I suggest you install tlp again (it's in the official repos now), start it with

sudo tlp start

and attach the output of

tlp-stat -u

ps. upower is neither a replacement for TLP nor does it save battery power.

Revision history for this message
Thomas Mayer (thomas303) wrote :

No, /etc/rc.local was untouched. The file was empty besides of an "exit 0".

/etc$ sudo fgrep -ril powertop *
/etc$ sudo fgrep -ril autotune *
both give an empty result.

I installed TLP again, which automatially removed package
"laptop-mode-tools".

Using powertop, I've set back the two USB devices to "Bad" again, just to see what TLP
does to it.

Before I started TLP, the output of "tlp-stat -u" was:

Bus 002 Device 004 ID 046a:0023 control = auto, autosuspend_delay_ms =
2000 -- Cherry GmbH CyMotion Master Linux Keyboard G230 (usbhid)
Bus 002 Device 003 ID 046d:c24c control = auto, autosuspend_delay_ms =
2000 -- Logitech, Inc. G400s Optical Mouse (usbhid)

Note that 2000 ms of autosuspend_delay is pretty much the time I
experienced for the devices to become unresponsive.

Then I started TLP with a

sudo tlp start

Now that TLP was started, the output of "tlp-stat -u" was:

TLP started in AC mode.
Bus 002 Device 004 ID 046a:0023 control = on, autosuspend_delay_ms =
2000 -- Cherry GmbH CyMotion Master Linux Keyboard G230 (usbhid)
Bus 002 Device 003 ID 046d:c24c control = on, autosuspend_delay_ms =
2000 -- Logitech, Inc. G400s Optical Mouse (usbhid)

Basically that means that TLP disables autosuspend in AC mode.
Both devices are working great, like the way they did with the
workaround using powertop after every reboot. With TLP enabled, everything still works after a reboot. I also can type in my login password without loss of the first characters.

Same for battery mode:
sudo tlp start
TLP started in battery mode.
tlp-stat -u
Bus 002 Device 004 ID 046a:0023 control = on, autosuspend_delay_ms = 2000 -- Cherry GmbH CyMotion Master Linux Keyboard G230 (usbhid)
Bus 002 Device 003 ID 046d:c24c control = on, autosuspend_delay_ms = 2000 -- Logitech, Inc. G400s Optical Mouse (usbhid)

Now that my computer had autosuspend enabled after a reboot (before I reinstalled TLP), which
package was responsible for that? laptop-mode-tools?

If laptop-mode-tools enabled autosuspend for input devices, even in AC mode, that should be avoided with the behaviour I experienced. That said, I think this issue is not related to the linux kernel at all, but to one of the power saving tools.

Revision history for this message
Thomas Mayer (thomas303) wrote :

As documented in https://wiki.ubuntuusers.de/laptop-mode-tools/#Eingabegeraete, one can configure laptop-mode-tools with

AUTOSUSPEND_USBTYPE_BLACKLIST=”usbhid”

IMO, this should be enabled by default.

Changed in linux (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Hans-Georg Beyer (hans-georg-beyer) wrote :

Hi,

I just changed from Ubuntu 14.04 (flawlessly working) to 16.04 and
experienced a similar behavior of my Logitech, Inc. Cordless Mouse:
after a few seconds of inactivity, the mouse exhibits a lagging
behavior. Interestingly, using a USB cord connected mouse does not
show this behavior.

I searched the WWW and tried all proposed actions without
success. However, I have not found THIS bug report. Finally, as a
last random resort, I decided to fully disable the laptop mode
ENABLE_LAPTOP_MODE_TOOLS=0 in /etc/laptop-mode/laptop-mode.conf
and the problem disappeared.

After that finding I searched the web regarding bugs in laptop mode
and found this entry.

A few information:
lsusb yields (only the interesting line displayed here):

Bus 003 Device 002: ID 046d:c501 Logitech, Inc. Cordless Mouse Receiver

Relevant output of usb-devices:

T: Bus=03 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 2 Spd=1.5 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=046d ProdID=c501 Rev=09.10
S: Manufacturer=Logitech
S: Product=USB Receiver
C: #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=50mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=usbhid

I did not find any error or warning messages in the log files.

So this is definitely a bug in or wrong parametrization of the
laptop-mode tools or the programs invoked by laptop-mode.

It would be good if this could be corrected in one of the next
updates given the fact that this bug persists now for more than
a year.

Thanks and best wishes,
Hans-Georg

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in laptop-mode-tools (Ubuntu):
status: New → Confirmed
Revision history for this message
Ritesh Raj Sarraf (rrs) wrote : Re: [Bug 1603659] Re: Power Management: USB mouse and keyboard laggy and loosing events

On Fri, 2017-07-28 at 07:43 +0000, Hans-Georg Beyer wrote:
> So this is definitely a bug in or wrong parametrization of the
> laptop-mode tools or the programs invoked by laptop-mode.

Please see: https://github.com/rickysarraf/laptop-mode-tools/wiki/FAQ

Especially:

My USB Mouse / Keyboard stops working after seconds of inactivity

Many devices advertise power savings but misbehave when power savings
is triggered. Laptop Mode Tools, by default, enabled power savings for
all devices.

In newer version of Laptop Mode Tools (1.69 and above), we have revised
the default list of blacklisted devices. USB Mice, USB Keyboards and
USB Storage are obvious device types.

If you have devices, that mis-behave when running on battery, you can
blacklist them.

For details on blacklisting the device, please refer to the
configuration details in /etc/laptop-mode/conf.d/runtime-pm.conf

--
Ritesh Raj Sarraf
RESEARCHUT - http://www.researchut.com
"Necessity is the mother of invention."

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.