You are not logged in.

#1 2020-09-10 15:51:00

Tim.Hilt
Member
Registered: 2018-06-16
Posts: 16

Bluetooth-Headset auto-connect disconnects directly after connecting

Hi there!

I followed the instructions on how to setup auto-connection, so adding

# automatically switch to newly-connected devices
load-module module-switch-on-connect

to

/etc/pulse/default.pa

and setting up Auto-Enabling Bluetooth at boot. Also my device is trusted, as can be seen here:

[bluetooth]# devices
Device 1C:52:16:7E:9E:2C Redmi AirDots_R
Device EF:19:4B:0A:EE:06 MX Master 2S
[bluetooth]# info 1C:52:16:7E:9E:2C
Device 1C:52:16:7E:9E:2C (public)
	Name: Redmi AirDots_R
	Alias: Redmi AirDots_R
	Class: 0x00240418
	Icon: audio-card
	Paired: yes
	Trusted: yes
	Blocked: no
	Connected: no
	LegacyPairing: no
	UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
	UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	Modalias: bluetooth:v005Dp223Bd0100
[bluetooth]#
[bluetooth]#

Manual connection always works, but when i switch on the headset and have bluetoothctl open, i see something like this:

[bluetooth]#
[CHG] Device 1C:52:16:7E:9E:2C Connected: yes
[CHG] Device 1C:52:16:7E:9E:2C Connected: no
[bluetooth]#

btmon gives:

~ λ sudo btmon
[sudo] password for tim:
Bluetooth monitor ver 5.54
= Note: Linux version 5.8.7-arch1-1 (x86_64)                                          0.998604
= Note: Bluetooth subsystem version 2.22                                              0.998605
= New Index: F8:94:C2:2D:20:48 (Primary,USB,hci0)                              [hci0] 0.998606
= Open Index: F8:94:C2:2D:20:48                                                [hci0] 0.998606
= Index Info: F8:94:C2:2D:20:48 (Intel Corp.)                                  [hci0] 0.998607
@ MGMT Open: bluetoothd (privileged) version 1.17                            {0x0001} 0.998608
@ MGMT Open: btmon (privileged) version 1.17                                 {0x0002} 0.998675
> HCI Event: Connect Request (0x04) plen 10                                 #1 [hci0] 9.298352
        Address: 1C:52:16:7E:9E:2C (DONGGUAN HELE ELECTRONICS CO., LTD)
        Class: 0x240418
          Major class: Audio/Video (headset, speaker, stereo, video, vcr)
          Minor class: Headphones
          Rendering (Printing, Speaker)
          Audio (Speaker, Microphone, Headset)
        Link type: ACL (0x01)
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7               #2 [hci0] 9.298493
        Address: 1C:52:16:7E:9E:2C (DONGGUAN HELE ELECTRONICS CO., LTD)
        Role: Master (0x00)
> HCI Event: Command Status (0x0f) plen 4                                   #3 [hci0] 9.299364
      Accept Connection Request (0x01|0x0009) ncmd 1
        Status: Success (0x00)
> HCI Event: Vendor (0xff) plen 4                                           #4 [hci0] 9.386498
      Intel PTT Switch Notification (0x26)
        Handle: 256
        Packet type table: Enhanced data rate (0x01)
> HCI Event: Vendor (0xff) plen 4                                           #5 [hci0] 9.387392
      Intel PTT Switch Notification (0x26)
        Handle: 256
        Packet type table: Enhanced data rate (0x01)
> HCI Event: Connect Complete (0x03) plen 11                                #6 [hci0] 9.393499
        Status: Success (0x00)
        Handle: 256
        Address: 1C:52:16:7E:9E:2C (DONGGUAN HELE ELECTRONICS CO., LTD)
        Link type: ACL (0x01)
        Encryption: Disabled (0x00)
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2          #7 [hci0] 9.393764
        Handle: 256
> HCI Event: Command Status (0x0f) plen 4                                   #8 [hci0] 9.394393
      Read Remote Supported Features (0x01|0x001b) ncmd 1
        Status: Success (0x00)
< HCI Command: Write Scan Enable (0x03|0x001a) plen 1                       #9 [hci0] 9.394469
        Scan enable: No Scans (0x00)
> HCI Event: Command Complete (0x0e) plen 4                                #10 [hci0] 9.397358
      Write Scan Enable (0x03|0x001a) ncmd 2
        Status: Success (0x00)
> HCI Event: Max Slots Change (0x1b) plen 3                                #11 [hci0] 9.405386
        Handle: 256
        Max slots: 5
> HCI Event: Read Remote Supported Features (0x0b) plen 11                 #12 [hci0] 9.407367
        Status: Success (0x00)
        Handle: 256
        Features: 0xff 0xff 0xff 0xfa 0xdb 0xfd 0x7b 0x87
          3 slot packets
          5 slot packets
          Encryption
          Slot offset
          Timing accuracy
          Role switch
          Hold mode
          Sniff mode
          Park state
          Power control requests
          Channel quality driven data rate (CQDDR)
          SCO link
          HV2 packets
          HV3 packets
          u-law log synchronous data
          A-law log synchronous data
          CVSD synchronous data
          Paging parameter negotiation
          Power control
          Transparent synchronous data
          Flow control lag (least significant bit)
          Flow control lag (middle bit)
          Flow control lag (most significant bit)
          Broadcast Encryption
          Enhanced Data Rate ACL 2 Mbps mode
          Enhanced inquiry scan
          Interlaced inquiry scan
          Interlaced page scan
          RSSI with inquiry results
          Extended SCO link (EV3 packets)
          EV4 packets
          EV5 packets
          AFH capable slave
          AFH classification slave
          LE Supported (Controller)
          3-slot Enhanced Data Rate ACL packets
          5-slot Enhanced Data Rate ACL packets
          Pause encryption
          AFH capable master
          AFH classification master
          Enhanced Data Rate eSCO 2 Mbps mode
          Enhanced Data Rate eSCO 3 Mbps mode
          3-slot Enhanced Data Rate eSCO packets
          Extended Inquiry Response
          Simultaneous LE and BR/EDR (Controller)
          Secure Simple Pairing
          Encapsulated PDU
          Erroneous Data Reporting
          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          #13 [hci0] 9.407454
        Handle: 256
        Page: 1
> HCI Event: Command Status (0x0f) plen 4                                  #14 [hci0] 9.408352
      Read Remote Extended Features (0x01|0x001c) ncmd 1
        Status: Success (0x00)
> HCI Event: Link Supervision Timeout Changed (0x38) plen 4                #15 [hci0] 9.465509
        Handle: 256
        Timeout: 5000.000 msec (0x1f40)
> HCI Event: Read Remote Extended Features (0x23) plen 13                  #16 [hci0] 9.466368
        Status: Success (0x00)
        Handle: 256
        Page: 1/2
        Features: 0x03 0x00 0x00 0x00 0x00 0x00 0x00 0x00
          Secure Simple Pairing (Host Support)
          LE Supported (Host)
< HCI Command: Remote Name Request (0x01|0x0019) plen 10                   #17 [hci0] 9.466526
        Address: 1C:52:16:7E:9E:2C (DONGGUAN HELE ELECTRONICS CO., LTD)
        Page scan repetition mode: R2 (0x02)
        Page scan mode: Mandatory (0x00)
        Clock offset: 0x0000
< ACL Data TX: Handle 256 flags 0x00 dlen 10                               #18 [hci0] 9.466555
      L2CAP: Information Request (0x0a) ident 1 len 2
        Type: Extended features supported (0x0002)
> HCI Event: Command Status (0x0f) plen 4                                  #19 [hci0] 9.467346
      Remote Name Request (0x01|0x0019) ncmd 1
        Status: Success (0x00)
> HCI Event: QoS Setup Complete (0x0d) plen 21                             #20 [hci0] 9.468359
        Status: Success (0x00)
        Handle: 256
        Flags: 0x00
        Service type: Best Effort (0x01)
        Token rate: 0
        Peak bandwidth: 0
        Latency: 25000
        Delay variation: -1
> ACL Data RX: Handle 256 flags 0x02 dlen 10                               #21 [hci0] 9.468393
      L2CAP: Information Request (0x0a) ident 1 len 2
        Type: Extended features supported (0x0002)
< ACL Data TX: Handle 256 flags 0x00 dlen 16                               #22 [hci0] 9.468444
      L2CAP: Information Response (0x0b) ident 1 len 8
        Type: Extended features supported (0x0002)
        Result: Success (0x0000)
        Features: 0x000002b8
          Enhanced Retransmission Mode
          Streaming Mode
          FCS Option
          Fixed Channels
          Unicast Connectionless Data Reception
> HCI Event: Number of Completed Packets (0x13) plen 5                     #23 [hci0] 9.473371
        Num handles: 1
        Handle: 256
        Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5                     #24 [hci0] 9.475375
        Num handles: 1
        Handle: 256
        Count: 1
> ACL Data RX: Handle 256 flags 0x02 dlen 16                               #25 [hci0] 9.477090
      L2CAP: Information Response (0x0b) ident 1 len 8
        Type: Extended features supported (0x0002)
        Result: Success (0x0000)
        Features: 0x000002a8
          Enhanced Retransmission Mode
          FCS Option
          Fixed Channels
          Unicast Connectionless Data Reception
< ACL Data TX: Handle 256 flags 0x00 dlen 10                               #26 [hci0] 9.477189
      L2CAP: Information Request (0x0a) ident 2 len 2
        Type: Fixed channels supported (0x0003)
> HCI Event: Number of Completed Packets (0x13) plen 5                     #27 [hci0] 9.505496
        Num handles: 1
        Handle: 256
        Count: 1
> ACL Data RX: Handle 256 flags 0x02 dlen 10                               #28 [hci0] 9.505848
      L2CAP: Information Request (0x0a) ident 2 len 2
        Type: Fixed channels supported (0x0003)
< ACL Data TX: Handle 256 flags 0x00 dlen 20                               #29 [hci0] 9.505963
      L2CAP: Information Response (0x0b) ident 2 len 12
        Type: Fixed channels supported (0x0003)
        Result: Success (0x0000)
        Channels: 0x0000000000000086
          L2CAP Signaling (BR/EDR)
          Connectionless reception
          Security Manager (BR/EDR)
> HCI Event: Remote Name Req Complete (0x07) plen 255                      #30 [hci0] 9.510419
        Status: Success (0x00)
        Address: 1C:52:16:7E:9E:2C (DONGGUAN HELE ELECTRONICS CO., LTD)
        Name: Redmi AirDots_R
@ MGMT Event: Device Connected (0x000b) plen 35                       {0x0002} [hci0] 9.510485
        BR/EDR Address: 1C:52:16:7E:9E:2C (DONGGUAN HELE ELECTRONICS CO., LTD)
        Flags: 0x00000000
        Data length: 22
        Name (complete): Redmi AirDots_R
        Class: 0x240418
          Major class: Audio/Video (headset, speaker, stereo, video, vcr)
          Minor class: Headphones
          Rendering (Printing, Speaker)
          Audio (Speaker, Microphone, Headset)
@ MGMT Event: Device Connected (0x000b) plen 35                       {0x0001} [hci0] 9.510485
        BR/EDR Address: 1C:52:16:7E:9E:2C (DONGGUAN HELE ELECTRONICS CO., LTD)
        Flags: 0x00000000
        Data length: 22
        Name (complete): Redmi AirDots_R
        Class: 0x240418
          Major class: Audio/Video (headset, speaker, stereo, video, vcr)
          Minor class: Headphones
          Rendering (Printing, Speaker)
          Audio (Speaker, Microphone, Headset)
> ACL Data RX: Handle 256 flags 0x02 dlen 20                               #31 [hci0] 9.533510
      L2CAP: Information Response (0x0b) ident 2 len 12
        Type: Fixed channels supported (0x0003)
        Result: Success (0x0000)
        Channels: 0x0000000000000076
          L2CAP Signaling (BR/EDR)
          Connectionless reception
          Attribute Protocol
          L2CAP Signaling (LE)
          Security Manager (LE)
> HCI Event: Number of Completed Packets (0x13) plen 5                     #32 [hci0] 9.535490
        Num handles: 1
        Handle: 256
        Count: 1
> ACL Data RX: Handle 256 flags 0x02 dlen 12                               #33 [hci0] 9.588407
      L2CAP: Connection Request (0x02) ident 3 len 4
        PSM: 1 (0x0001)
        Source CID: 64
< ACL Data TX: Handle 256 flags 0x00 dlen 16                               #34 [hci0] 9.588511
      L2CAP: Connection Response (0x03) ident 3 len 8
        Destination CID: 64
        Source CID: 64
        Result: Connection successful (0x0000)
        Status: No further information available (0x0000)
< ACL Data TX: Handle 256 flags 0x00 dlen 23                               #35 [hci0] 9.588524
      L2CAP: Configure Request (0x04) ident 3 len 15
        Destination CID: 64
        Flags: 0x0000
        Option: Retransmission and Flow Control (0x04) [mandatory]
          Mode: Basic (0x00)
          TX window size: 0
          Max transmit: 0
          Retransmission timeout: 0
          Monitor timeout: 0
          Maximum PDU size: 0
> HCI Event: Number of Completed Packets (0x13) plen 5                     #36 [hci0] 9.617468
        Num handles: 1
        Handle: 256
        Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5                     #37 [hci0] 9.618394
        Num handles: 1
        Handle: 256
        Count: 1
> ACL Data RX: Handle 256 flags 0x02 dlen 12                               #38 [hci0] 9.645950
      L2CAP: Configure Request (0x04) ident 4 len 4
        Destination CID: 64
        Flags: 0x0000
< ACL Data TX: Handle 256 flags 0x00 dlen 18                               #39 [hci0] 9.646034
      L2CAP: Configure Response (0x05) ident 4 len 10
        Source CID: 64
        Flags: 0x0000
        Result: Success (0x0000)
        Option: Maximum Transmission Unit (0x01) [mandatory]
          MTU: 672
> ACL Data RX: Handle 256 flags 0x02 dlen 14                               #40 [hci0] 9.647052
      L2CAP: Configure Response (0x05) ident 3 len 6
        Source CID: 64
        Flags: 0x0000
        Result: Success (0x0000)
> HCI Event: Number of Completed Packets (0x13) plen 5                     #41 [hci0] 9.650402
        Num handles: 1
        Handle: 256
        Count: 1
> ACL Data RX: Handle 256 flags 0x02 dlen 17                               #42 [hci0] 9.704718
      Channel: 64 len 13 [PSM 1 mode Basic (0x00)] {chan 0}
      SDP: Service Search Request (0x02) tid 1 len 8
        Search pattern: [len 5]
          Sequence (6) with 3 bytes [8 extra bits] len 5
            UUID (3) with 2 bytes [0 extra bits] len 3
              Handsfree (0x111e)
        Max record count: 68
        Continuation state: 0
< ACL Data TX: Handle 256 flags 0x00 dlen 14                               #43 [hci0] 9.705118
      Channel: 64 len 10 [PSM 1 mode Basic (0x00)] {chan 0}
      SDP: Service Search Response (0x03) tid 1 len 5
        Total record count: 0
        Current record count: 0
        Continuation state: 0
> ACL Data RX: Handle 256 flags 0x02 dlen 12                               #44 [hci0] 9.759729
      L2CAP: Disconnection Request (0x06) ident 5 len 4
        Destination CID: 64
        Source CID: 64
< ACL Data TX: Handle 256 flags 0x00 dlen 12                               #45 [hci0] 9.759882
      L2CAP: Disconnection Response (0x07) ident 5 len 4
        Destination CID: 64
        Source CID: 64
> HCI Event: Number of Completed Packets (0x13) plen 5                     #46 [hci0] 9.760367
        Num handles: 1
        Handle: 256
        Count: 1
> HCI Event: Number of Completed Packets (0x13) plen 5                     #47 [hci0] 9.767480
        Num handles: 1
        Handle: 256
        Count: 1
> HCI Event: Disconnect Complete (0x05) plen 4                             #48 [hci0] 9.852509
        Status: Success (0x00)
        Handle: 256
        Reason: Remote User Terminated Connection (0x13)
@ MGMT Event: Device Disconnected (0x000c) plen 8                     {0x0002} [hci0] 9.852630
        BR/EDR Address: 1C:52:16:7E:9E:2C (DONGGUAN HELE ELECTRONICS CO., LTD)
        Reason: Connection terminated by remote host (0x03)
@ MGMT Event: Device Disconnected (0x000c) plen 8                     {0x0001} [hci0] 9.852630
        BR/EDR Address: 1C:52:16:7E:9E:2C (DONGGUAN HELE ELECTRONICS CO., LTD)
        Reason: Connection terminated by remote host (0x03)
< HCI Command: Write Scan Enable (0x03|0x001a) plen 1                      #49 [hci0] 9.895785
        Scan enable: Page Scan (0x02)
> HCI Event: Command Complete (0x0e) plen 4                                #50 [hci0] 9.896357
      Write Scan Enable (0x03|0x001a) ncmd 2
        Status: Success (0x00)

and i can't really make any sense off it.

How can this be resolved? Starting the pulseaudio-daemon via

pulseaudio -D

doesn't change the behavior. I have tlp installed, but have stopped the process, which also doesn't change the behavior.

Can anyone help me out here? I'm happy to supply more information if needed. Thanks!

Offline

#2 2020-09-10 18:27:38

SurlyCycler
Member
Registered: 2019-10-26
Posts: 47

Re: Bluetooth-Headset auto-connect disconnects directly after connecting

To the best of my knowledge, there is a conflict between bluetooth and pulseaudio. The best way I have found to remove the conflict is to allow bluez to do the controlling.

try this.

sudo mkdir -p /var/lib/gdm/.config/systemd/user 
sudo ln -s /dev/null /var/lib/gdm/.config/systemd/user/pulseaudio.socket
sudo chmod -R u+w /var/lib/bluetooth 

basically it creates a directory called user.
Then you make a dynamic link from a null file and call it pulseaudio.socket. (its a big hole of nothing) This prevents pulseaudio from creating a socket, thus allowing bluetooth to control your bluetooth connections.
The last code adds write permission to the directory docs and all its contents (i.e. Recursively) for owner, and removes write permission for group and others. It prevents pulse audio from trying to change things...

You might have to go in and reset up your bluetoothctl settings again to pair, connect and trust your headset. If all goes well the next time you boot up your computer your headset should automatically connect.

Last edited by SurlyCycler (2020-09-10 18:30:01)

Offline

#3 2020-09-11 06:41:14

Tim.Hilt
Member
Registered: 2018-06-16
Posts: 16

Re: Bluetooth-Headset auto-connect disconnects directly after connecting

Thanks for the reply!

Unfortunately, that didn't change anything. I tried it after a reboot, but the experience stayed the same. It also didn't change after readding the headset!

Offline

#4 2020-09-11 07:32:26

Tim.Hilt
Member
Registered: 2018-06-16
Posts: 16

Re: Bluetooth-Headset auto-connect disconnects directly after connecting

I investigated this a bit further and found a few gotchas that i can't quite wrap my head around:

1. It could have something to do with NetworkManager, which i'm running.
2. The ArchWiki mentions some lp-group at different points and that the user should make sure that he's in that group. I would try that, but the group "lp" doesn't even exist!
3. when i look at udevadm monitor (while switching the headphones on) i see the following:

~ λ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[1509.872310] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:256 (bluetooth)
UDEV  [1509.877778] add      /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:256 (bluetooth)
KERNEL[1510.228830] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:256 (bluetooth)
UDEV  [1510.232611] remove   /devices/pci0000:00/0000:00:14.0/usb1/1-7/1-7:1.0/bluetooth/hci0/hci0:256 (bluetooth)

Does this mean the kernel sends an event to remove the device (I'm not quite understanding the udevadm-monitor-output at this point)? Why is that? Could it be resolved by downgrading the kernel?

Last edited by Tim.Hilt (2020-09-11 08:42:47)

Offline

#5 2020-09-11 12:05:13

Tim.Hilt
Member
Registered: 2018-06-16
Posts: 16

Re: Bluetooth-Headset auto-connect disconnects directly after connecting

I checked back with the LTS-kernel (everything took longer than i expected, because of the EFI-partition being to small) and with the LTS-kernel running the behavior also didn't change.

Offline

Board footer

Powered by FluxBB