How to change bluetooth timeout settings for bluetooth mouse

I have a Logitech MX Master 3 that I am using with Ubuntu 20.04.1 LTS (kernel 5.4.0-58-generic). If the mouse sits idle for a short period (less than 30 seconds, though I haven't timed it precisely) it appears to enter a low-power state and only returns to normal operation after a couple of seconds of motion. This creates a pretty annoying visual "hitch" when you move the mouse after letting it sit idle for unreasonably short periods.

I have encountered this exact issue on Windows 10 w/ a different laptop (but the same mouse). On windows the fix is to use the device manager to disable the setting which allows the Bluetooth Controller to be put to sleep to save power. I am now trying to do the same thing on Ubuntu, with no luck so far.

From this reddit thread I learned that the "timeout" setting in /var/lib/bluetooth/{BT MAC]/{mouse MAC}/info might be useful. On my system it is configured as follows:

[ConnectionParameters]
MinInterval=6
MaxInterval=9
Latency=44
Timeout=216

I tried setting the timeout to a large value (10000) and also to zero. After changing the value, I ran:

bluetoothctl power off
bluetoothctl power on

I observed no effect. I then tried changing the value and running:

sudo systemctl restart bluetooth

This had the effect of setting the value back to the default of 216. With some random googling, I stumbled upon this thread which seems to imply that hcitool lecup might be able to set the value so I tried:

sudo hcitool lecup --handle 3585 --timeout 0

Where 3585 is the handle of my mouse. This just produces Could not change connection params: Input/output error(5).

I am not a deep linux expert, and am admittedly unfamiliar with the relationship between bluetoothctl, the bluetooth service, and hcitool. What I would like to know is:

  1. How do I get the change to the /var/lib/bluetooth/{BT MAC]/{mouse MAC}/info file to take effect so I can test different values?
  2. Maybe I am barking up the wrong tree - is there an easier way to just disable the bluetooth "sleeping" functionality?

You should be able to control this through the IdleTimeout setting in /etc/bluetooth/input.conf. It looks like this:

# Configuration file for the input service

# This section contains options which are not specific to any
# particular interface
[General]

# Set idle timeout (in minutes) before the connection will
# be disconnect (defaults to 0 for no timeout)
#IdleTimeout=30

...

Remove the # and set the timeout to something like 5. If you set it to zero, be ready to charge batteries on a much more regular basis. From there you can sign out and back in again to begin using the setting.


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 Arch and i have a Mx master 3 and i aslo experienced similar issue to what you described.

This is how i went about fixing it:

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

Bus 07.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/4p, 12M
    ID 1d6b:0001 Linux Foundation 1.1 root hub
    |__ Port 3: Dev 2, If 0, Class=Wireless, Driver=btusb, 12M
        ID 8087:0a2a Intel Corp. Bluetooth wireless interface
    |__ Port 3: Dev 2, If 1, Class=Wireless, Driver=btusb, 12M
        ID 8087:0a2a Intel Corp. Bluetooth wireless interface

The id of my bluetooth module is 8087:0a2a

  1. Create a udev rule to disable auto suspend for the module.

edit/create following file /etc/udev/rules.d/50-usb_power_save.rules

and add this line

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="8087", ATTR{idProduct}=="0a2a", ATTR{power/autosuspend}="-1"

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

I used following links for reference.

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

https://fueledonbacon.com/popos-bluetooth-autosuspend-problem/