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

Miquel
  • 151

7 Answers7

8

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

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

KGIII
  • 4,101
2

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

Max_Payne
  • 144
2

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
Raphael
  • 21
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.

nobody
  • 5,792
0

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

DMT
  • 864
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.

jwill
  • 1