Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Keyboard and mouse autosuspend after sid unfreeze

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
zfrank
Posts: 2
Joined: 2021-08-23 08:39

Keyboard and mouse autosuspend after sid unfreeze

#1 Post by zfrank »

Hi!
I'm running Debian Sid. After the release of Bullseye and the corresponding unfreeze a week or so ago, I got a barrage of updates on my system as usual. Since then my computer enables USB autosuspend on the keyboard and mouse at boot. This is quite annoying since it makes them unresponsive for half a second or so every time they get suspended. I didn't have this issues before the upgrade.

I tried to disable autosuspend via udev rules like this:

Code: Select all

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="XXXX", ATTR{idProduct}=="XXXX", ATTR{power/control}="on"
But for some reason this doesn't work :( Both mouse and keyboard still get power/control set to auto after boot (so autosuspend enabled). The funny thing is that if I re-plug them, then the udev rules apply and power/control is set to on.

This makes me believe that my udev rules are correct, but something is changing the value afterwards. What could that be?

In the end, I got around this by disabling USB autosuspend altogether via kernel boot parameters, by adding "usbcore.autosuspend=-1" to /etc/default/grub:

Code: Select all

GRUB_CMDLINE_LINUX_DEFAULT="quiet usbcore.autosuspend=-1"
But this is very heavy-handed and I'd prefer to allow some devices to autosuspend and save power.

Does anyone know what process would change USB power settings during boot time and override my udev rules?

zfrank
Posts: 2
Joined: 2021-08-23 08:39

Re: Keyboard and mouse autosuspend after sid unfreeze

#2 Post by zfrank »

I forgot to paste my USB set up:

Code: Select all

$ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 10000M
    |__ Port 2: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/16p, 480M
    |__ Port 2: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M                              <--- small USB hub
        |__ Port 4: Dev 7, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M       <--- keyboard
        |__ Port 2: Dev 4, If 3, Class=Audio, Driver=snd-usb-audio, 480M               <--- webcam
        |__ Port 2: Dev 4, If 1, Class=Video, Driver=uvcvideo, 480M
        |__ Port 2: Dev 4, If 2, Class=Audio, Driver=snd-usb-audio, 480M
        |__ Port 2: Dev 4, If 0, Class=Video, Driver=uvcvideo, 480M
        |__ Port 3: Dev 6, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M      <--- mouse
    |__ Port 6: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M
    |__ Port 8: Dev 5, If 0, Class=Vendor Specific Class, Driver=xpad, 12M
I use a small USB hub to connect my keyboard and mouse to my computer. According to the kernel's documentation, autosuspend should only be enabled on hubs and nothing else.

Source: https://www.kernel.org/doc/Documentatio ... gement.txt
Relevant section:
Warnings
--------

The USB specification states that all USB devices must support power
management. Nevertheless, the sad fact is that many devices do not
support it very well. You can suspend them all right, but when you
try to resume them they disconnect themselves from the USB bus or
they stop working entirely. This seems to be especially prevalent
among printers and scanners, but plenty of other types of device have
the same deficiency.

For this reason, by default the kernel disables autosuspend (the
power/control attribute is initialized to "on") for all devices other
than hubs. Hubs, at least, appear to be reasonably well-behaved in
this regard.

(In 2.6.21 and 2.6.22 this wasn't the case. Autosuspend was enabled
by default for almost all USB devices. A number of people experienced
problems as a result.)

This means that non-hub devices won't be autosuspended unless the user
or a program explicitly enables it.
As of this writing there aren't
any widespread programs which will do this; we hope that in the near
future device managers such as HAL will take on this added
responsibility. In the meantime you can always carry out the
necessary operations by hand or add them to a udev script. You can
also change the idle-delay time; 2 seconds is not the best choice for
every device.

If a driver knows that its device has proper suspend/resume support,
it can enable autosuspend all by itself. For example, the video
driver for a laptop's webcam might do this (in recent kernels they
do), since these devices are rarely used and so should normally be
autosuspended.

Sometimes it turns out that even when a device does work okay with
autosuspend there are still problems. For example, the usbhid driver,
which manages keyboards and mice, has autosuspend support. Tests with
a number of keyboards show that typing on a suspended keyboard, while
causing the keyboard to do a remote wakeup all right, will nonetheless
frequently result in lost keystrokes. Tests with mice show that some
of them will issue a remote-wakeup request in response to button
presses but not to motion, and some in response to neither.

The kernel will not prevent you from enabling autosuspend on devices
that can't handle it. It is even possible in theory to damage a
device by suspending it at the wrong time. (Highly unlikely, but
possible.) Take care.

vbernat
Posts: 1
Joined: 2021-09-04 13:48

Re: Keyboard and mouse autosuspend after sid unfreeze

#3 Post by vbernat »

Got the same issue. You need to "systemctl disable powertop". See https://bugs.debian.org/cgi-bin/bugrepo ... bug=992248

Post Reply