15

I have a keyboard K850 and a M720 Triathlon mouse both from Logitech. They work correctly but get disconnected when idle.

The behaviour seems to be like an auto suspend function where the device disconnects after a few seconds and reconnects when there is interaction. It makes the use of these device tedious, specially the keyboard as it does not remember the key strokes when it reactivates and it takes a few secs to become responsive again.

I researched online and found a few solutions related to autosuspend of bluetooth and usb. For instance I tried the following line in grub:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash btusb.enable_autosuspend=n usbcore.autosuspend=-1 usbcore.autosuspend_delay_ms=-1"

Which does not work for me.

This is a session with bluetoothctl:

root@balearics:~# bluetoothctl
Agent registered
[CHG] Controller 5C:87:9C:35:87:83 Pairable: yes
[M720 Triathlon]# devices
Device C9:58:68:E2:1A:D9 M720 Triathlon
Device DA:95:18:89:C3:30 Keyboard K850
[CHG] Device C9:58:68:E2:1A:D9 ServicesResolved: no
[CHG] Device C9:58:68:E2:1A:D9 Connected: no
[CHG] Device C9:58:68:E2:1A:D9 Connected: yes
[CHG] Device C9:58:68:E2:1A:D9 ServicesResolved: yes
[CHG] Device DA:95:18:89:C3:30 ServicesResolved: no
[CHG] Device DA:95:18:89:C3:30 Connected: no
[CHG] Device DA:95:18:89:C3:30 Connected: yes
[CHG] Device DA:95:18:89:C3:30 ServicesResolved: yes
[M720 Triathlon]#

As you can see after idling it gets disconnected and when I touch it / type it gets connected again.

Any help would be appreciated

3
  • Please post the output of tlp-stat
    – GunJack
    Commented Aug 11, 2020 at 7:56
  • tlp is not installed
    – Miquel
    Commented Aug 13, 2020 at 18:28
  • @Miquel perhaps it's worth checking if your keyboard/mouse battery should be replaced? Commented Sep 18, 2020 at 14:17

7 Answers 7

7

Increase the IdleTimeout in /etc/bluetooth/input.conf or set it to 0 to disable it.

You can also try setting FastConnectable to true in /etc/bluetooth/main.conf to allow the devices to reconnect faster at the trade off of increased power consumption.

Restart blue tooth after any changes: sudo service bluetooth restart

3
  • 1
    IdleTimeout has been set to 0 and FastConnectable to true but no change. Both mouse and keyboard disconnect after some idle time (a few seconds)
    – Miquel
    Commented Aug 8, 2020 at 17:48
  • Helped with Ubuntu 21.04 + Microsoft Wireless Laser Mouse 8000(the FastConnectable significantly decreased the reconnecting after the mouse sleep) and Microsoft Precision Mouse (IdleTimeout, that I had already set before, improved the the delay after the mouse sleep). Commented Apr 19, 2021 at 17:12
  • Did not work for me in Ubuntu 20.04 with Logitech Triathlon M720, still getting reconnect lag. Commented Jan 15, 2022 at 12:25
4

You didn't make it clear if you'd gone through the GUI and power settings, so I'll take a stab at this.

Open your power settings and disable the ability to suspend Bluetooth devices to save power.

Ubuntu 20.04 power management - bluetooth

7
  • 4
    s, I saw that, but BT is turned off as soon as I switch that off :(
    – Miquel
    Commented Aug 13, 2020 at 18:31
  • @Miquel, can you share your power management settings? In this case, they'll have to be screenshots. Usually that's frowned upon, but I can't think of a way to get them in plain text. Check all your power management settings.
    – KGIII
    Commented Aug 13, 2020 at 18:56
  • I can't add images, but power settings are: Blank Screen: Never Wi-FI can be turned off to save power is Off. Bluetooth can be turned off to save power is ON (because what I said, if I turn that off as you suggest Bluetooth disconects entirely).
    – Miquel
    Commented Aug 18, 2020 at 21:03
  • 1
    Wow - that may be the worst bit of UI design i've ever seen. That switch does not control "switching off of bluetooth to save power" instead it controls bluetooth power (its the off switch). The words underneath mean "power might be reduced if you turn this off", not whether its allowed to turn off bluetooth.
    – Greg
    Commented May 14, 2021 at 2:30
  • 2
    This is the worst advice ever. Consider this as a solution is ridiculous.... The button turns off Bluetooth instead of turn off the power management for bluetooth. In fact this power management for bluetooth in linux is disabled by default as said on /etc/bluetooth/input.conf # Set idle timeout (in minutes) before the connection will # be disconnect (defaults to 0 for no timeout) Bluetooth implementation in linux is a crap
    – Lelis718
    Commented May 13, 2022 at 13:10
1

This works for my Keychron K2 (v.2). Put this to /etc/rc.local:

# Prevents the Bluetooth USB card from getting reset which disconnects the mouse
BTUSB_DEV="8087:07dc"
BTUSB_BINDING="$(lsusb -d "$BTUSB_DEV" |
    cut -f 1 -d : |
    sed -e 's,Bus ,,' -e 's, Device ,/,' |
    xargs -I {} udevadm info -q path -n /dev/bus/usb/{} |
    xargs basename)"


echo "Disabling autosuspend for Bluetooth USB Soundcard: $BTUSB_BINDING..."
echo -1 > "/sys/bus/usb/devices/$BTUSB_BINDING/power/autosuspend_delay_ms"

Substitute the value of BTUSB_DEV with vendor:product of your bluetooth card.

To get BTUSB_DEV use:

lsusb -v | grep -iE '\<(Bus|iProduct|bDeviceClass|bDeviceProtocol|Bluetooth)' 2>/dev/null

You will see something like that:

Bus 001 Device 007: ID 0489:e036 Foxconn / Hon Hai 
  bDeviceClass          224 Wireless
  bDeviceProtocol         1 Bluetooth
  iProduct                2 
      bInterfaceProtocol      1 Bluetooth
      bInterfaceProtocol      1 Bluetooth
      bInterfaceProtocol      1 Bluetooth
      bInterfaceProtocol      1 Bluetooth
      bInterfaceProtocol      1 Bluetooth
      bInterfaceProtocol      1 Bluetooth

ID 0489:e036 (yours will be different) is what you need.

Before disabling autosuspend for my internal bluetooth card, I have seen in the kernel logs (sudo dmesg) when my keyboard connects many errors related to timeout, connection, etc. Then, these errors disappeared completely.

Dec 11 10:32:29 sonyvaio kernel: [ 5290.684002] input: Keychron K2 System Control as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/bluetooth/hci0/hci0:21/0005:05AC:024F.0004/input/input23
Dec 11 10:32:29 sonyvaio kernel: [ 5290.684304] hid-generic 0005:05AC:024F.0004: input,hidraw2: BLUETOOTH HID v1.1b Keyboard [Keychron K2] on 08:ed:b9:cf:f7:36
Dec 11 10:33:46 sonyvaio kernel: [ 5367.749903] Bluetooth: hci0: corrupted ACL packet
Dec 11 10:35:07 sonyvaio kernel: [ 5448.214626] Bluetooth: hci0: corrupted ACL packet
Dec 11 10:36:30 sonyvaio kernel: [ 5531.356542] Bluetooth: hci0: ACL packet for unknown connection handle 0
...

Source: https://ubuntuforums.org/showthread.php?t=2159645&page=6&p=12926730#post12926730

1

After trying several things, the following seems to have fixed the problem for me:

  1. Instal tlp: sudo apt install tlp
  2. sudo nano /etc/tlp.conf
  3. Change the parameter USB_BLACKLIST_BTUSB from 0 to 1
1
  • saved my life!! Commented Jul 5, 2022 at 16:55
0

maybe this is working ( I do not use bluetooth devices)

create a file

/etc/modprobe/btusb.conf

with conntent.

options btusb enable_autosuspend=0

Make i reboot.

3
  • I already tried this: miquel@balearics:~$ cat /etc/modprobe.d/disable.autosuspend.conf # Disable autosuspend for btusb to make the bluetooth keyboard work again options btusb enable_autosuspend=n
    – Miquel
    Commented Aug 13, 2020 at 18:33
  • Okay, i think it should be a number. enable_autosuspend:Enable USB autosuspend by default (bool) what gives cat /sys/module/btusb/parameters/enable_autosuspend please?
    – nobody
    Commented Aug 13, 2020 at 18:49
  • I tried both n and 0 none worked. miquel@balearics:~$ cat /sys/module/btusb/parameters/enable_autosuspend
    – Miquel
    Commented Aug 18, 2020 at 21:02
0

Tried all the solutions proposed in this thread, but only this one finally helped.

0

If anyone is still looking for a fix for this, I edited the /etc/bluetooth/input.conf file and changed the IdleTimeout parameter to IdleTimeout=30. This makes it so it times out after 30 minutes. I guess the default 0 doesn't help. So far, I haven't had a disconnect in about 10 minutes which is probably the longest since I've been using this on Linux.

UPDATE: I think it was my phone being so close to my keyboard that was interfering w/ the signal. When I moved my phone back close to it, it started disconnecting every 5 mins or so. I moved the phone about 1 foot away & no disconnections in about 10 mins.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .