Bluetooth mouse lags after upgrading to 18.10 Cosmic
Initially, there was no issue in the first few days after upgrading to 18.10 Cosmic (from 18.04 Bionic), even after suspend/restart/shutdown.
Today, after waking from suspend, the bluetooth mouse started to lag. If I left it stationary for 5 seconds, it would take 2 seconds of constant movement before pointer can move. It seemed to switch to sleep mode after just 5 seconds.
I tried:
-
scan off
inbluetoothctl
(the command failed to run anyway). - Re-
modprobe
the btusb. sudo sh -c 'echo N > /sys/module/drm_kms_helper/parameters/poll'
-
tlp
andpowertop
are not installed.
Solution 1:
Remove canonical-livepatch
which is supported in LTS releases only, i.e. not supported in 18.10.
To remove,
$ sudo snap remove canonical-livepatch
I previously had an issue was also (partially) caused by the package.
Edit: the issue resurface again. Installing powertop
without any config somehow resolve it.
$ sudo apt install powertop
Edit: USB autosuspend is probably the cause.
- Launch powertop using
sudo powertop
. - Keep pressing Tab till you reach the "Tunables" section.
- Find your mouse in that list "Autosuspend for USB device...". Mine is "Autosuspend for unknown USB device 2-6 (8087-07dc)".
- "Good" status means autosuspend is on. Fix this issue by toggling to "Bad", by pressing "Enter". Continue the reset of the steps to re-apply the setting after reboot/suspend.
-
A command will shows up on Terminal,
>> echo 'on' > /usr/bus/usb/devices/2-6/power/control';
Note down the command.
-
Create a shell script in
/usr/bin/
.$ sudo pluma /usr/bin/disable-bt-mouse-autosuspend
Paste the following:
#!/bin/sh
# Disable USB auto-suspend for my mouse on startup
sleep 5;
MOUSE="/sys/bus/usb/devices/2-6/power/control";
if [ -f "$MOUSE" ]; then
echo 'on' > $MOUSE;
fi
- Change
2-6
to what you got from powertop in Step 5. -
Make the script executable.
$ sudo chmod u+x /usr/bin/disable-bt-mouse-autosuspend
-
Add
disable-bt-mouse-autosuspend
to systemd.$ sudo pluma /etc/systemd/system/disable-bt-mouse-autosuspend.service
Paste the following,
[Unit]
Description=Disable USB auto-suspend for bluetooth mouse
[Service]
ExecStart=/usr/bin/disable-bt-mouse-autosuspend
[Install]
WantedBy=multi-user.target
-
Save it. Start and enable it.
$ sudo systemctl start disable-bt-mouse-autosuspend
$ sudo systemctl enable disable-bt-mouse-autosuspend
-
The setting will also reset during suspend. To re-apply it:
$ sudo pluma /lib/systemd/system-sleep/00disable-bt-mouse-autosuspend
Paste the following script and save it,
#!/bin/sh
# restart the service after suspend
if [ $1 = post ] && [ $2 = suspend ]
then systemctl start disable-bt-mouse-autosuspend.service
fi
-
Set executable permission,
$ sudo chmod u+x /lib/systemd/system-sleep/00disable-bt-mouse-autosuspend
Solution 2:
After two days of searching how to fix mouse slow update rate, I found a solution, mby it is your case. Just change to your mouse mac.
# HANDLE="$(hcitool con | grep '<Bluetooth Mouse mac address>' | awk '{print $5}')" # get the device handle
# hcitool lecup --handle $HANDLE --latency 0 --min 6 --max 8
source: arch linux section "Troubleshooting"
Solution 3:
I had the exact same problem with an MX Anywhere mouse and an HP Spectre x360. By my research, it was caused by a bug in the newer Linux kernel versions. Some USB devices are incompatible with the USB auto suspend feature in Linux. In my case, it was the Bluetooth chip that was causing the mouse to lag after around 5 seconds of idle. I solved it by loosely following the steps in this post, which seems to accurately pinpoint the problem. The post tells you to look for the USB mouse by running:
sudo lsusb -v
My mouse is a Bluetooth one, same as yours, so it obviously didn't show up with that. However, what did show up, among other devices, of course, was this:
Bus 001 Device 003: ID 8087:0a2b Intel Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 224 Wireless
bDeviceSubClass 1 Radio Frequency
bDeviceProtocol 1 Bluetooth
bMaxPacketSize0 64
idVendor 0x8087 Intel Corp.
idProduct 0x0a2b
bcdDevice 0.10
iManufacturer 0
iProduct 0
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 177
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 100mA
This seemed to me like it could be the Bluetooth chip, and since there is a chance it could be incompatible with USB auto suspend, I tried turning USB auto suspend off for just this device (as directed in that post). My mouse worked perfectly after that, so it seems like my guess was right. Hope this works for you and anyone searching for a solution! PS: some power saving utilities like powertop could also cause the same problems, so you should also try disabling all of those. (this is also mentioned in that post I linked to)