Bluetooth mouse lags after upgrading to 18.10 Cosmic

6,992

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.

  1. Launch powertop using sudo powertop.
  2. Keep pressing Tab till you reach the "Tunables" section.
  3. Find your mouse in that list "Autosuspend for USB device...". Mine is "Autosuspend for unknown USB device 2-6 (8087-07dc)".
  4. "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.
  5. A command will shows up on Terminal,

    >> echo 'on' > /usr/bus/usb/devices/2-6/power/control';

  6. Note down the command.

  7. Create a shell script in /usr/bin/.

    $ sudo pluma /usr/bin/disable-bt-mouse-autosuspend

  8. 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
  1. Change 2-6 to what you got from powertop in Step 5.
  2. Make the script executable.

    $ sudo chmod u+x /usr/bin/disable-bt-mouse-autosuspend

  3. Add disable-bt-mouse-autosuspend to systemd.

    $ sudo pluma /etc/systemd/system/disable-bt-mouse-autosuspend.service

  4. 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
  1. Save it. Start and enable it.

    $ sudo systemctl start disable-bt-mouse-autosuspend

    $ sudo systemctl enable disable-bt-mouse-autosuspend

  2. The setting will also reset during suspend. To re-apply it:

    $ sudo pluma /lib/systemd/system-sleep/00disable-bt-mouse-autosuspend

  3. 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
  1. 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)

Share:
6,992

Related videos on Youtube

Saftever
Author by

Saftever

Updated on September 18, 2022

Comments

  • Saftever
    Saftever over 1 year

    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:

    1. scan off in bluetoothctl (the command failed to run anyway).
    2. Re-modprobe the btusb.
    3. sudo sh -c 'echo N > /sys/module/drm_kms_helper/parameters/poll'
    4. tlp and powertop are not installed.
  • waffl
    waffl over 4 years
    The arch linux docs say If the mouse gets disconnected, you'll need to execute again. and thus to edit default settings through debugfs - but I can't seem to write to these files, how should one make these settings permanent?
  • Michael Lee
    Michael Lee over 4 years
    thx so much dude, you literally saved my day.
  • adi9090
    adi9090 over 4 years
    This one helped partially. I needed to run script that will modify this parameters each time on startup, which was quite annoying to do. Also, on some occasions mouse was starting to lag again, and I needed to run script again to solve this. Also tried to edit the conn_latency, conn_min_interval and conn_max_interval had issue with permission. After searching for solution I've got to this one technoshakti.blogspot.com/2017/03/… which worked perfectly.
  • Vix
    Vix over 4 years
    Thank you kind internet person!