You are not logged in.

#1 2018-04-23 10:38:53

aytekinar
Member
From: Stockholm
Registered: 2013-12-19
Posts: 25

[SOLVED] Bluetooth keyboard disconnects randomly

I have been using my bluetooth keyboard (if that helps, it is Kinesis Freestyle2 Blue) without any problems so far. I had set it up following the wiki post. However, since the last week, I have been having connection problems, which I am not sure is related to this topic.

The thing is that when I boot my laptop, the keyboard gets paired and I can use it properly. Then, after some time passes, I simply lose connection to my keyboard. Running bluetoothctl to remove and pair back the keyboard does not help, either. I need a cold reboot to get my keyboard working back again, and this loop continues. Below are some information I can provide:

~> uname -a
Linux KTH-5435 4.16.3-1-ARCH #1 SMP PREEMPT Thu Apr 19 09:17:56 UTC 2018 x86_64 GNU/Linux

~> grep "AutoEnable" /etc/bluetooth/main.conf 
# AutoEnable defines option to enable all controllers when they are found.
AutoEnable=true

~> lsmod | grep blue
bluetooth             634880  36 btrtl,hidp,btintel,bnep,btbcm,rfcomm,btusb
ecdh_generic           24576  2 bluetooth
rfkill                 28672  6 bluetooth,dell_laptop,dell_rbtn,cfg80211
crc16                  16384  2 bluetooth,ext4

~> rfkill list
1: hci0: Bluetooth
	Soft blocked: no
	Hard blocked: no
2: dell-wifi: Wireless LAN
	Soft blocked: no
	Hard blocked: no
3: dell-bluetooth: Bluetooth
	Soft blocked: no
	Hard blocked: no
4: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no

# here I have lost connection to my keyboard

~> bluetoothctl 
Agent registered
[bluetooth]# paired-devices 
Device 20:73:14:81:84:36 aytekinkinesis
Device 04:52:C7:C7:B0:C3 aytekinbose
[bluetooth]# info 20:73:14:81:84:36
Device 20:73:14:81:84:36 (public)
	Name: Kinesis KB800PB-BT
	Alias: aytekinkinesis
	Class: 0x00000540
	Icon: input-keyboard
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: no
	LegacyPairing: no
	UUID: Service Discovery Serve.. (00001000-0000-1000-8000-00805f9b34fb)
	UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	Modalias: usb:v0A5Cp8502d011B
[CHG] Device 20:73:14:81:84:36 Connected: yes
[CHG] Device 20:73:14:81:84:36 Connected: no
[bluetooth]# quit

~> dmesg
[   58.617621] Bluetooth: RFCOMM TTY layer initialized
[   58.617630] Bluetooth: RFCOMM socket layer initialized
[   58.617636] Bluetooth: RFCOMM ver 1.11
[   79.531047] logitech-hidpp-device 0003:046D:4041.0004: HID++ 4.5 device connected.
[  101.455905] Bluetooth: hci0: last event is not cmd complete (0x0f)
[  129.461950] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[  129.461958] Bluetooth: HIDP socket layer initialized
[  132.221898] hid-generic 0005:0A5C:8502.0007: unknown main item tag 0x0
[  132.222109] input: Kinesis KB800PB-BT as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/bluetooth/hci0/hci0:11/0005:0A5C:8502.0007/input/input23
[  132.222637] hid-generic 0005:0A5C:8502.0007: input,hidraw4: BLUETOOTH HID v1.1b Keyboard [Kinesis KB800PB-BT] on 74:e5:43:4f:a2:d2
[  132.325550] Bluetooth: hci0: last event is not cmd complete (0x0f)
[  147.251100] hid-generic 0005:0A5C:8502.0008: unknown main item tag 0x0
[  147.251191] input: Kinesis KB800PB-BT as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4/1-1.4:1.0/bluetooth/hci0/hci0:12/0005:0A5C:8502.0008/input/input24
[  147.251430] hid-generic 0005:0A5C:8502.0008: input,hidraw4: BLUETOOTH HID v1.1b Keyboard [Kinesis KB800PB-BT] on 74:e5:43:4f:a2:d2
[  148.325523] Bluetooth: hci0: last event is not cmd complete (0x0f)
[ 1241.801214] usb 1-1-port4: disabled by hub (EMI?), re-enabling...
[ 1241.889856] usb 1-1.4: reset full-speed USB device number 4 using ehci-pci
[ 1241.988769] usb 1-1.4: USB disconnect, device number 4
[ 1242.396584] usb 1-1.4: new full-speed USB device number 6 using ehci-pci
[ 1242.497962] usb 1-1.4: New USB device found, idVendor=413c, idProduct=8197
[ 1242.497968] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1242.497971] usb 1-1.4: Product: BCM20702A0
[ 1242.497974] usb 1-1.4: Manufacturer: Broadcom Corp
[ 1242.497976] usb 1-1.4: SerialNumber: 74E5434FA2D2
[ 1251.385061] Bluetooth: hci0: corrupted ACL packet
[ 1283.425408] Bluetooth: hci0: corrupted ACL packet
[ 1283.425410] Bluetooth: hci0: ACL packet for unknown connection handle 11
[ 1283.425412] Bluetooth: hci0: ACL packet for unknown connection handle 8
[ 1339.693622] Bluetooth: hci0: corrupted ACL packet
[ 1339.693665] Bluetooth: hci0: ACL packet for unknown connection handle 12
[ 1339.693675] Bluetooth: hci0: ACL packet for unknown connection handle 8

~> systemctl status bluetooth.service 
● bluetooth.service - Bluetooth service
   Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: disabled)
   Active: active (running) since Mon 2018-04-23 12:10:13 CEST; 25min ago
     Docs: man:bluetoothd(8)
 Main PID: 405 (bluetoothd)
   Status: "Running"
    Tasks: 1 (limit: 4915)
   Memory: 3.4M
   CGroup: /system.slice/bluetooth.service
           └─405 /usr/lib/bluetooth/bluetoothd

apr 23 12:10:13 KTH-5435 bluetoothd[405]: Bluetooth management interface 1.14 initialized
apr 23 12:10:48 KTH-5435 bluetoothd[405]: Refusing input device connect: No such file or directory (2)
apr 23 12:10:48 KTH-5435 bluetoothd[405]: Refusing connection from 20:73:14:81:84:36: unknown device
apr 23 12:11:07 KTH-5435 bluetoothd[405]: Endpoint registered: sender=:1.44 path=/MediaEndpoint/A2DPSource
apr 23 12:11:07 KTH-5435 bluetoothd[405]: Endpoint registered: sender=:1.44 path=/MediaEndpoint/A2DPSink
apr 23 12:12:18 KTH-5435 bluetoothd[405]: Can't get HIDP connection info
apr 23 12:30:53 KTH-5435 bluetoothd[405]: Endpoint unregistered: sender=:1.44 path=/MediaEndpoint/A2DPSource
apr 23 12:30:53 KTH-5435 bluetoothd[405]: Endpoint unregistered: sender=:1.44 path=/MediaEndpoint/A2DPSink
apr 23 12:30:54 KTH-5435 bluetoothd[405]: Endpoint registered: sender=:1.44 path=/MediaEndpoint/A2DPSource
apr 23 12:30:54 KTH-5435 bluetoothd[405]: Endpoint registered: sender=:1.44 path=/MediaEndpoint/A2DPSink

~> sudo btmon --write bt.log
Bluetooth monitor ver 5.49
= Note: Linux version 4.16.3-1-ARCH (x86_64)                                                                                                                                                                                          0.843417
= Note: Bluetooth subsystem version 2.22                                                                                                                                                                                              0.843418
= New Index: 74:E5:43:4F:A2:D2 (Primary,USB,hci0)                                                                                                                                                                              [hci0] 0.843419
= Open Index: 74:E5:43:4F:A2:D2                                                                                                                                                                                                [hci0] 0.843419
= Index Info: 74:E5:43:4F:A2:D2 (Broadcom Corporation)                                                                                                                                                                         [hci0] 0.843419
@ MGMT Open: bluetoothd (privileged) version 1.14                                                                                                                                                                            {0x0001} 0.843420
@ MGMT Open: btmon (privileged) version 1.14                                                                                                                                                                                 {0x0002} 0.843430
> HCI Event: Connect Request (0x04) plen 10                                                                                                                                                                                 #1 [hci0] 6.743524
        Address: 20:73:14:81:84:36 (OUI 20-73-14)
        Class: 0x000540
          Major class: Peripheral (mouse, joystick, keyboards)
          Minor class: 0x10
        Link type: ACL (0x01)
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7                                                                                                                                                               #2 [hci0] 6.743632
        Address: 20:73:14:81:84:36 (OUI 20-73-14)
        Role: Master (0x00)
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                                                                   #3 [hci0] 6.745503
      Accept Connection Request (0x01|0x0009) ncmd 1
        Status: Success (0x00)
> HCI Event: Role Change (0x12) plen 8                                                                                                                                                                                      #4 [hci0] 6.905423
        Status: Success (0x00)
        Address: 20:73:14:81:84:36 (OUI 20-73-14)
        Role: Master (0x00)
> HCI Event: Connect Complete (0x03) plen 11                                                                                                                                                                                #5 [hci0] 7.078532
        Status: Success (0x00)
        Handle: 12
        Address: 20:73:14:81:84:36 (OUI 20-73-14)
        Link type: ACL (0x01)
        Encryption: Disabled (0x00)
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2                                                                                                                                                          #6 [hci0] 7.078675
        Handle: 12
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                                                                   #7 [hci0] 7.079422
      Read Remote Supported Features (0x01|0x001b) ncmd 1
        Status: Success (0x00)
> HCI Event: Max Slots Change (0x1b) plen 3                                                                                                                                                                                 #8 [hci0] 7.080441
        Handle: 12
        Max slots: 5
> HCI Event: Read Remote Supported Features (0x0b) plen 11                                                                                                                                                                  #9 [hci0] 7.090469
        Status: Success (0x00)
        Handle: 12
        Features: 0xbf 0x06 0x86 0x78 0x18 0x1e 0x59 0x87
          3 slot packets
          5 slot packets
          Encryption
          Slot offset
          Timing accuracy
          Role switch
          Sniff mode
          Power control requests
          Channel quality driven data rate (CQDDR)
          Paging parameter negotiation
          Power control
          Broadcast Encryption
          Enhanced inquiry scan
          Interlaced inquiry scan
          Interlaced page scan
          RSSI with inquiry results
          AFH capable slave
          AFH classification slave
          Sniff subrating
          Pause encryption
          AFH capable master
          AFH classification master
          Extended Inquiry Response
          Secure Simple Pairing
          Encapsulated PDU
          Non-flushable Packet Boundary Flag
          Link Supervision Timeout Changed Event
          Inquiry TX Power Level
          Enhanced Power Control
          Extended features
< HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3                                                                                                                                                          #10 [hci0] 7.090529
        Handle: 12
        Page: 1
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                                                                  #11 [hci0] 7.091464
      Read Remote Extended Features (0x01|0x001c) ncmd 1
        Status: Success (0x00)
> ACL Data RX: Handle 11 flags 0x02 dlen 16                                                                                                                                                                                #12 [hci0] 7.092589
      L2CAP: Information Response (0x0b) ident 1 len 8
        Type: Extended features supported (0x0002)
        Result: Success (0x0000)
        Features: 0x000c200c
          Bi-directional QoS
          Enhanced Retransmission Mode
          Unknown features (0x000c2000)
> ACL Data RX: Handle 8 flags 0x00 dlen 1                                                                                                                                                                                  #13 [hci0] 7.092599
        frame too short
        02                                               .               
> HCI Event: Read Remote Extended Features (0x23) plen 13                                                                                                                                                                  #14 [hci0] 7.095514
        Status: Success (0x00)
        Handle: 12
        Page: 1/1
        Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
< HCI Command: Remote Name Request (0x01|0x0019) plen 10                                                                                                                                                                   #15 [hci0] 7.095606
        Address: 20:73:14:81:84:36 (OUI 20-73-14)
        Page scan repetition mode: R2 (0x02)
        Page scan mode: Mandatory (0x00)
        Clock offset: 0x0000
< ACL Data TX: Handle 12 flags 0x00 dlen 10                                                                                                                                                                                #16 [hci0] 7.095618
      L2CAP: Information Request (0x0a) ident 1 len 2
        Type: Extended features supported (0x0002)
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                                                                  #17 [hci0] 7.097513
      Remote Name Request (0x01|0x0019) ncmd 1
        Status: Success (0x00)
> HCI Event: Remote Name Req Complete (0x07) plen 255                                                                                                                                                                      #18 [hci0] 7.120413
        Status: Success (0x00)
        Address: 20:73:14:81:84:36 (OUI 20-73-14)
        Name: Kinesis KB800PB-BT
@ MGMT Event: Device Connected (0x000b) plen 38                                                                                                                                                                       {0x0002} [hci0] 7.120483
        BR/EDR Address: 20:73:14:81:84:36 (OUI 20-73-14)
        Flags: 0x00000000
        Data length: 25
        Name (complete): Kinesis KB800PB-BT
        Class: 0x000540
          Major class: Peripheral (mouse, joystick, keyboards)
          Minor class: 0x10
@ MGMT Event: Device Connected (0x000b) plen 38                                                                                                                                                                       {0x0001} [hci0] 7.120483
        BR/EDR Address: 20:73:14:81:84:36 (OUI 20-73-14)
        Flags: 0x00000000
        Data length: 25
        Name (complete): Kinesis KB800PB-BT
        Class: 0x000540
          Major class: Peripheral (mouse, joystick, keyboards)
          Minor class: 0x10
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                                                                                                     #19 [hci0] 7.229433
        Num handles: 1
        Handle: 12
        Count: 1
< HCI Command: Disconnect (0x01|0x0006) plen 3                                                                                                                                                                            #20 [hci0] 11.241074
        Handle: 12
        Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4                                                                                                                                                                                 #21 [hci0] 11.306387
      Disconnect (0x01|0x0006) ncmd 1
        Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4                                                                                                                                                                            #22 [hci0] 11.393401
        Status: Success (0x00)
        Handle: 12
        Reason: Connection Terminated By Local Host (0x16)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                                                                                                                    {0x0002} [hci0] 11.393448
        BR/EDR Address: 20:73:14:81:84:36 (OUI 20-73-14)
        Reason: Connection terminated by local host (0x02)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                                                                                                                                    {0x0001} [hci0] 11.393448
        BR/EDR Address: 20:73:14:81:84:36 (OUI 20-73-14)
        Reason: Connection terminated by local host (0x02)

~> sudo btmon --analyze bt.log 
Bluetooth monitor ver 5.49
Creating new device for unknown index
Unknown opcode 14
Unknown opcode 14
Unknown opcode 17
Unknown opcode 17
Unknown opcode 17
Unknown opcode 17
Trace contains 33 packets

Found BR/EDR controller with index 65535
  BD_ADDR 00:00:00:00:00:00
  0 commands
  0 events
  0 ACL packets
  0 SCO packets
  0 vendor diagnostics
  2 system notes
  0 user logs
  2 unknown opcodes

Found BR/EDR controller with index 0
  BD_ADDR 74:E5:43:4F:A2:D2 (Broadcom Corporation)
  5 commands
  14 events
  3 ACL packets
  0 SCO packets
  0 vendor diagnostics
  0 system notes
  0 user logs
  4 unknown opcodes

I would appreciate if you helped me understand/solve the problem. Please let me know if I can provide more information to help resolve the issue.

EDIT. Added btmon logs.

Last edited by aytekinar (2018-04-24 18:48:10)

Offline

#2 2018-04-23 21:41:19

ziro360
Member
Registered: 2012-04-27
Posts: 30

Re: [SOLVED] Bluetooth keyboard disconnects randomly

Hi,

I have the exact same problem and after digging around I found this bug report https://bugzilla.kernel.org/show_bug.cgi?id=199351

On that an user talks about btusb autosuspend being added by default to the kernel. According to him disabling the feature by adding to the boot kernel parameters

btusb.enable_autosuspend=n

fixed the problem.

I'm currently doing a test run and will report back if it fixed or not.

Offline

#3 2018-04-24 07:49:51

aytekinar
Member
From: Stockholm
Registered: 2013-12-19
Posts: 25

Re: [SOLVED] Bluetooth keyboard disconnects randomly

Hey ziro360. Thank you very much for the heads-up. I have modified my boot loader as in

~> sudo cat /boot/loader/entries/arch.conf
title	Arch Linux
linux	/vmlinuz-linux
initrd	/intel-ucode.img
initrd	/initramfs-linux.img
options	root=/dev/sda2 rw btusb.enable_autosuspend=n
~> cat /proc/cmdline 
initrd=\intel-ucode.img initrd=\initramfs-linux.img root=/dev/sda2 rw btusb.enable_autosuspend=n

Is it the way to disable via the boot loader? I am not that good in Linux.

I will try it out for the day and report the result. Please do report yours and we can mark this topic solved, if that seems to work.

Offline

#4 2018-04-24 08:16:19

ziro360
Member
Registered: 2012-04-27
Posts: 30

Re: [SOLVED] Bluetooth keyboard disconnects randomly

Hi,

I have GRUB so I used this guide https://wiki.archlinux.org/index.php/ke … eters#GRUB

My /etc/default/grub looks like this

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
GRUB_CMDLINE_LINUX_DEFAULT="quiet btusb.enable_autosuspend=n"
GRUB_CMDLINE_LINUX=""

My working day is just starting so I will post an update at the end of the day

Last edited by ziro360 (2018-04-24 08:17:36)

Offline

#5 2018-04-24 12:44:07

aytekinar
Member
From: Stockholm
Registered: 2013-12-19
Posts: 25

Re: [SOLVED] Bluetooth keyboard disconnects randomly

Hey again,

I have had luck with disabling the autosuspend option. By the way, I have found the below solution more elegant in the sense that I can keep track of my module settings easily based on files:

~> ls -al /etc/modprobe.d/
total 16
drwxr-xr-x  2 root root 4096 24 apr 14.29 ./
drwxr-xr-x 85 root root 4096 24 apr 14.30 ../
-rw-r--r--  1 root root  109 24 apr 14.29 disable_autosuspend.conf
-rw-r--r--  1 root root   48  6 jul  2014 nobeep.conf
~> cat /etc/modprobe.d/disable_autosuspend.conf 
# Disable autosuspend for btusb to make the bluetooth keyboard work again
options btusb enable_autosuspend=n
~> systool -v -m btusb
Module = "btusb"

  Attributes:
    coresize            = "53248"
    initsize            = "0"
    initstate           = "live"
    refcnt              = "0"
    srcversion          = "B85B7172EF085BAE36BDC74"
    taint               = ""
    uevent              = <store method only>
    version             = "0.8"

  Parameters:
    disable_scofix      = "N"
    enable_autosuspend  = "N"
    force_scofix        = "N"
    reset               = "Y"

  Sections:

If you also confirm that this solves the problem by the end of the day, I will mark it [SOLVED]. Thank you once more for the help!

Offline

#6 2018-04-24 18:41:14

ziro360
Member
Registered: 2012-04-27
Posts: 30

Re: [SOLVED] Bluetooth keyboard disconnects randomly

Hi,

Everything looks good here, no random disconnect. From my end it looks this is [SOLVED].

Btw nice solution much more clean than the kernel parameters.

Offline

#7 2018-05-11 04:25:43

eephillip
Member
Registered: 2018-05-11
Posts: 1

Re: [SOLVED] Bluetooth keyboard disconnects randomly

resolved my issue as well, Thanks

Offline

#8 2023-10-14 09:34:38

HMK
Member
Registered: 2023-10-14
Posts: 2

Re: [SOLVED] Bluetooth keyboard disconnects randomly

Said to myself if this works I’ll register to thank you. It's been several hours and BT is still working fine, so thank you.

Problem started after an upgrade, no issues before, BT disconnects after a few minutes. Downgrading kernel 66 rc4 to previous rc3 did not solve it, the parameter for btusb did. Nice and clean solution with a conf in modprobe.d.

Cable is not an option for me, desktop is on other side of the room, so BT is important. Thanks again! Hope this helps others as well.

Offline

Board footer

Powered by FluxBB