14

looking for help diagnosing bluetooth mouse lag. I'm using a Logitech MX Anywhere 2, I've had it a few years now and it's worked well on a number of Linux distros. I recently installed Debian 10 and set it up to use Sid repos. In this environment, the mouse does not work as responsively as normal. I'm on a laptop, and the touchpad works perfectly smoothly, and a wired mouse is also perfectly smooth. What I get with the bluetooth mouse is as if the sampling rate is maybe once every 3 or 4 frames.

I still have Pop!_OS installed which is based on Ubuntu 19.04, the mouse works as expected in that environment. Forgetting the mouse and re-adding it offers no change to behaviour, same with reboots. I've updated to the latest state of the repos, no dice. I've also tried switching from Wayland to Xorg with no effect.

My best guess would be that it's down to the iwlwifi module (it's a Lenovo Yoga 900 with an Intel Core i7 6560U with integrated Intel Wireless 8260), but no idea where to go from here.

Cheers!

Eraph
  • 243
  • 1
  • 2
  • 6
  • 1
    Please let us know whether the mouse is really connected by Bluetooth or a dongle by Logitech. Sometimes their mice can do both. If I am not mistaken `iwlwifi` only handles Wi-Fi, not Bluetooth. (Of course you will know whether you have a USB dongle by Logitech ("Unifying Receiver") in a USB port, but also check Bluetooth settings whether the device is listed as currently connected, while using it.) – Ned64 Sep 05 '19 at 08:09
  • No dongle @Ned64, it's all bluetooth on this occasion. And I agree that it may not be `iwlwifi` at all, but that I mentioned it as a potential starting point. – Eraph Sep 05 '19 at 19:34
  • Are you still having this issue? I'm having the same problem with my Logitech MX Master on a new Dell Precision 5540 with Intel AX200 running Ubuntu 18.04.3 out of the box with kernel 4.15.0-1057-oem. – ashughes Oct 15 '19 at 23:57
  • I'm afraid so, @ashughes! While I'd prefer to use bluetooth I have just switched to using the dongle instead. – Eraph Oct 15 '19 at 23:59
  • 1
    @Eraph That's a bummer! I've tried to set bt_coex_active=0 as suggested at https://askubuntu.com/a/823316 but this has made no difference for me. :'( – ashughes Oct 16 '19 at 00:08
  • @Eraph I just tried https://www.reddit.com/r/linuxquestions/comments/bc15f8/bluetooth_mouse_is_laggy_very_limited_pollrate/ez3ufhs/ and it now appears to be working! I'm not a huge fan of the solution since it's very specific to the single bluetooth device...but so far it's good and it's based on the MAC address which isn't going to change. – ashughes Oct 16 '19 at 00:39
  • Thanks @ashughes, I'll give it a look! – Eraph Oct 16 '19 at 03:06
  • This is what it worked for me! It seems electronic noise from computer leading the bt receiver in error states https://www.worldcadaccess.com/blog/2014/03/when-the-cursor-gets-erratic-its-the-mouses-nano-receiver-at-fault.html – BangTheBank Mar 23 '20 at 17:56
  • I have the same issue, but only when I connect the MX Master 3 through bluethose. It works well if I connect it with unify receiver. My is Ubuntu 20.04 – Kostanos Oct 23 '21 at 17:53

4 Answers4

10

Solution from reddit from @ashughes in an above comment -https://www.reddit.com/r/linuxquestions/comments/bc15f8/bluetooth_mouse_is_laggy_very_limited_pollrate/ez3ufhs/

sudo nano /var/lib/bluetooth/xx\:xx\:xx\:xx\:xx\:xx/yy\:yy\:yy\:yy\:yy\:yy/info

where xx:xx.... is pc bluetooth address and yy:yy... is the mouse bluetooth address.

In the file, I added the section at the end:

[ConnectionParameters]
MinInterval=6
MaxInterval=7
Latency=0
Timeout=216

You may also need to reconnect the mouse.

I also tracked this proposal on ubuntu bug here:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1824559?comments=all

alenz316
  • 216
  • 2
  • 3
  • 2
    I'm marking this as a solution as I'm sure it works in some cases. For me, I was just about to test it when I found that it had fixed itself. For the record, that file has the following for me: [ConnectionParameters] MinInterval=6 MaxInterval=9 Latency=44 Timeout=216 – Eraph Nov 17 '19 at 09:13
  • Worked for me! Much appreciated! Btw the folder needs root access so it's easier to just `sudo su` first then modify the `info` file. – Alan Wang Dec 23 '19 at 13:45
  • Thank you, this worked for me too. I made a script to run at startup and add the values automatically, its at this gist if anyone is interested. https://gist.github.com/productiveme/8b39f5799fcb3e5681d0ef985884fb51 – user125867 Dec 21 '20 at 10:19
  • @user125867 Can you tell me how to automate this script? I tried crontab, systemd service none of them not working – hurelhuyag Jan 12 '21 at 06:44
  • I run it manually after connecting the bluetooth devices. as it needs sudo and the devices connected ... haven't been able to automate it sorry – user125867 Feb 10 '21 at 19:08
3

I'm using Ubuntu 18.04 on a Dell Precision 7740 laptop and a Logitech MX Master 3 and had a pretty bad lag over Bluetooth. Setting the parameters as noted in @alenz316's answer did not make a difference for me.

However, @Eraph's settings in that thread DID work. I originally found the answer on https://forum.manjaro.org/t/logitech-mx-master-pointer-too-slow-and-laggy/105468.

To summarize,

  1. I edited /var/lib/bluetooth/XX:XX:XX:XXX:XX:XX/YY:YY:YY:YY:YY:YY/info as root, where XX:XX:XX:XX:XX:XX is the Bluetooth address of my computer's bluetooth interface, and YY:YY:YY:YY:YY:YY is the Bluetooth address of my Mouse's interface.

  2. added @Eraph's parameters to the bottom of that file as follows:

[ConnectionParameters]
MinInterval=6
MaxInterval=9
Latency=44
Timeout=216
  1. I restarted Bluetooth with sudo service bluetooth restart

Now the mouse works as well over Bluetooth as it does over the Logitech Unifying hub.

I'm not sure what will happen if I reboot or if I re-pair the mouse, but I assume I can just re-apply these steps.

Joe J
  • 131
  • 3
1

I had two problems;

  1. Poor Wi-Fi speed, and;
  2. Bad BT mouse performance.

I solved problem #1 by exchanging my cheap Qualcomm WiFi card for a better Intel card in my Dell Laptop.

However, problem #2 was still there, until I realized that my Smartphone Samsung Galaxy S21+ 5G was laying on my desk too close to my mouse and likely interfering with it.

Now my phone is more than 1m away and the mouse is reacting much better.

Greenonline
  • 1,759
  • 7
  • 16
  • 21
Mat
  • 11
  • 1
1

The issue you are facing is not related to the Bluetooth timeout but more likely the USB auto suspend feature built into the kernel.

I am running Ubuntu 22.04 LTS and i have a Logitech MX Anywhere 2S

This is how i went about fixing it:

  1. Run command to find out the id of your bluetooth module
$ lsusb -vt

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/6p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 5: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 12M
        ID 27c6:538d Shenzhen Goodix Technology Co.,Ltd. 
    |__ Port 6: Dev 3, If 0, Class=Video, Driver=uvcvideo, 480M
        ID 0bda:565a Realtek Semiconductor Corp. 
    |__ Port 6: Dev 3, If 1, Class=Video, Driver=uvcvideo, 480M
        ID 0bda:565a Realtek Semiconductor Corp. 
    |__ Port 10: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
        ID 8087:0aaa Intel Corp. Bluetooth 9460/9560 Jefferson Peak (JfP)
    |__ Port 10: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M
        ID 8087:0aaa Intel Corp. Bluetooth 9460/9560 Jefferson Peak (JfP)

The id of my bluetooth module is 8087:0aaa

  1. Create or update a udev rule to disable auto suspend for the module.
$ echo 'ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="8087", ATTR{idProduct}=="0aaa", ATTR{power/autosuspend}="-1"' >> /etc/udev/rules.d/50-usb_power_save.rules

After this reboot your pc and the lag should go away.

Note that idVendor was set to 8087 and idProduct was set to 0aaa to reflect my bluetooth settings

I used following links for reference.

https://wiki.archlinux.org/title/Power_management#USB_autosuspend

Rodrigo Reis
  • 111
  • 2