7

After updating from 14.04 to 16.04 LTS Ubuntu I started experiencing strange issues with USB peripherals (logitech keyboard and mouse). The mouse randomly freezes and so does the keyboard. For mouse, after being left idle the pointer usually stops moving and only right click remains working. Rightclicking unfreezes the mouse again for normal operation, and the next freeze happens when it's left untouched for several seconds. Keyboard has a similar pattern where after a moment of not being used the next several letters won't be registered. Once it gets going it will remain working until the next pause. The freezes between the mouse and the keyboard do not appear to be in a correlation. Replugging the device temporarily gets it working as well. Since this is a laptop I can tell the built-in pointer and keyboard work fine.

There are three relevant topics I found while googling, but none of them seems to apply:

USB peripherals cutting in and out

The suggested source of the problem is the power supply. However I had this setup running flawlessly for over 2 years on 14.04 and the issues appeared immediately after upgrade to 16.04.

USB Mouse not working after installing Ubuntu 16.04 - Persistent Fix?

The rmmod/modprobe trick doesn't do it for me, nor did disabling EnableOptionROM. Also it is not that the mouse stops working completely. Right click remains working and "awakens" the rest of functionality.

Problem with USB mouse in Ubuntu 16.04

The mouse doesn't change its status in xsetpointer.

Because of symptoms I would expect this to be a strange device driver issue, however with the issue affecting both keyboard and mouse it seems to be connected with USB functionality instead.

Jatentaki
  • 243

4 Answers4

4

After more googling I finally found the solution. Apparently something has changed in default power management options making my mouse and keyboard be autosuspended to cut power usage and the functionality works even without manually installing any of the power saving software. The solution is here:

http://www.hecticgeek.com/2012/06/fix-usb-mouse-not-working-laptop-mode-tools-ubuntu/

modify etc/laptop-mode/conf.d/usb-autosuspend.conf to add your devices to the blacklist.

VERY IMPORTANT: your usb devices must be unplugged while running sudo service laptop-mode restart!

Jatentaki
  • 243
  • Thanks @Jatentaki. This solved the issue for me. However, please copy the steps here as the link may not be available in the future as we have no control over it. If you do this, you will earn my upvote. – crafter Sep 04 '17 at 09:24
  • 2
    No longer the case in 17.04 - /etc/laptop-mode isn't there – metame Sep 15 '17 at 14:44
  • I am having somewhat similar in 22.04. Still no proper answer for this – Sachith Muhandiram Aug 07 '23 at 12:19
2

I've not figured out yet how to fix this issue permanently, but there is workaround that worked to me.

First off, you should discover which is your device:

# lsusb
...
Bus 003 Device 002: ID 056d:c087 Logitech, Inc. M105 Optical Mouse

Pay attention to the bus number and id. Then, go to /sys/bus/usb/devices and you will see that folder contains a lot of symlinks. Using Bus 003 as reference, you should dig into 3-* folders.

# ll
...
lrwxrwxrwx 1 root root 0 nov 17 20:33 3-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-0:1.0/
lrwxrwxrwx 1 root root 0 nov 17 20:33 3-1 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-1/
lrwxrwxrwx 1 root root 0 nov 17 20:33 3-1:1.0 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1:1.0/
lrwxrwxrwx 1 root root 0 nov 17 20:33 4-0:1.0 -> ../../../devices/pci0000:00/0000:00:1a.1/usb4/4-0:1.0/
lrwxrwxrwx 1 root root 0 nov 17 20:33 5-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.0/usb5/5-0:1.0/
lrwxrwxrwx 1 root root 0 nov 17 20:33 6-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.1/usb6/6-0:1.0/
lrwxrwxrwx 1 root root 0 nov 17 20:33 7-0:1.0 -> ../../../devices/pci0000:00/0000:00:1d.2/usb7/7-0:1.0/
lrwxrwxrwx 1 root root 0 nov 17 20:33 usb1 -> ../../../devices/pci0000:00/0000:00:1a.7/usb1/
lrwxrwxrwx 1 root root 0 nov 17 20:33 usb2 -> ../../../devices/pci0000:00/0000:00:1d.7/usb2/
lrwxrwxrwx 1 root root 0 nov 17 20:33 usb3 -> ../../../devices/pci0000:00/0000:00:1a.0/usb3/
...

You'll notice every single folder has two files idVendor and idProduct. These files contain those id you got previously, through lsusb command. That was the tricky part.

Once you have identified the device (rename usb3/3-1 folders accordingly), run:

echo 'on' | sudo tee /sys/bus/usb/devices/usb3/3-1/power/control

The only inconvenient is that this solution is not permanent, and you should run it again every time you reboot your laptop (use reverse-i-search Ctrl+R then, will make all easier)

0

It seems this may be caused by interference from the radio (Wifi/Bluetooth) somehow. Solved by: switching off radio (button on keyboard), powering off laptop, removing battery for a few minutes, replacing battery and powering on. All USB working again. But problems only started after installing Snapd. Will see how long this lasts.

0

I am having the same trouble as you too! Its been happening a few times on my machine. But it seems like my freezing up happens when I have left my machine idle for a while and this happens when I'm trying to wake my machine up from its sleep. I do not put the machine on to suspend, all that happens is its natural sleep. It will really be great if we could have a solution to this soon...

PS: I am not allowed to post any comments yet, so this is the only way I can get in touch with your issue...

AKKA
  • 73