Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


4.2 bluetooth
#1
Congratulations on releasing v4.2! I like the UI changes and the improvements to squeezelite integration. But I'm having a bit of trouble with making bluetooth behave. I got it working in v4.1 by modifying a config file to load the A2DP protocol and once I had my Android phone paired it worked great, I could switch bluetooth on on my phone and media audio would play to Moode.
On v4.2 it was much, much easier to get the phone connected but since doing so it hasn't been at all as smooth. When I switch on bluetooth on my phone media still plays out of the phone, and even pressing the Moode Bluetooth entry in the bluetooth settings screen doesn't transfer it to Moode. I have to use the Moode menu to connect. I'm not sure if this is a bug or a deliberate change, but I preferred the old behaviour. Is it possible to alter the behaviour so that a previously paired device can auto-connect to Moode, either through the UI or through editing a config file somewhere?

Thanks!
Reply
#2
Hi,

Bluetooth auto-connect is working fine on my end with IOS devices and an Anker Speaker. I don't have any Android devices to use for testing so I'm not going to be able to do any hands on.

Which client created the initial pairing, moOde or your Android device?

-Tim
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
@aknaggbaugh

The label "Android phone" isn't very definitive. What make and model, what version of Android?

I have a Nexus 6P phone running Android 8.1.0 and Nexus 7 and 9 tablets running Android 6.0.1 and 7.1.1 respectively. I just installed moOde 4.2 on an RPi3B+.

Once I've gone through the initial pairing and connecting process with each Android device, I can switch back and forth between normal moOde mode and the Bluetooth sink mode (moOde plays audio from the BT connection) easily with the Nexus 9 and the Nexus 6P devices simply by connecting/disconnecting via the their Bluetooth menu or by switching off their Bluetooth controller. It's a bit more fiddly with the Nexus 7 but it still works without recourse to the moOde Bluetooth configuration screen.

In summary, I don't see the behavior you report.

Regards,
Kent
Reply
#4
I paired from the phone to Moode. The behaviour is the same on my OnePlus 3 (OxygenOs 5.0.3 based on Android 8.0.0) and my wife's Samsung Galaxy S7 (Android 6.0.1), though the Samsung is slightly more verbose in that it gives an error message if I try to connect from the phone to Moode ("Unable to connect to Moode Bluetooth") whereas the OnePlus just fails silently. If I connect from the BlueZ config screen on Moode it works every time, to either phone. My Moode is a Raspberry Pi 2B with a USB bluetooth 4.2 dongle.

If there are any logs I can send that would help, I'll be happy to.
Reply
#5
Very odd.

If you know some Linux ssh then you can run the bt.sh command script manually to see if it reports something useful.

ssh pi@moode (pwd=moodeaudio)
sudo /var/www/command/bt.sh <arg>

Example that prints the list of command args

sudo pi@rp3:~ $ sudo /var/www/command/bt.sh
** BlueMoode version 1.5
**
** Usage: bt.sh [OPTION]
** -i initialize/reset controller
** -s scan and trust devices
** -l list discovered devices
** -p list paired devices
** -c list connected devices
** -d disconnect device <MAC addr>
** -r remove paired device <MAC addr>
** -P pair with device <MAC addr>
** -C connect to device <MAC addr>
** -D disconnect all devices
** -R remove all pairings
** -h help
pi@rp3:~ $

There is also the btmon utility and the bluetoothctl util.

-Tim
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#6
I've run btmon.sh and it appears to produce the expected output - both the Samsung Galaxy and Rohan (my OnePlus) paired, but not connected. I ran btmon and then attempted to connect from the OnePlus: the output contains an error message about permissions, see below.

Code:
pi@moode:~ $ sudo /var/www/command/bt.sh -l
** Discovered devices
**
** C0:D3:C0:5D:70:E2 Samsung Galaxy S7 edge
** C0:EE:FB:D7:F3:FE Rohan
**
pi@moode:~ $ sudo /var/www/command/bt.sh -p
** Paired devices
**
** C0:D3:C0:5D:70:E2 Samsung Galaxy S7 edge
** C0:EE:FB:D7:F3:FE Rohan
**
pi@moode:~ $ sudo /var/www/command/bt.sh -c
** Connected devices
**
**
pi@moode:~ $ btmon
Bluetooth monitor ver 5.49
Failed to bind channel: Operation not permitted
pi@moode:~ $ sudo btmon
Bluetooth monitor ver 5.49
= Note: Linux version 4.14.54-v7+ (armv7l)                                                                          0.321368
= Note: Bluetooth subsystem version 2.22                                                                            0.321386
= New Index: 5C:F3:70:8E:5D:5E (Primary,USB,hci0)                                                            [hci0] 0.321388
= Open Index: 5C:F3:70:8E:5D:5E                                                                              [hci0] 0.321390
= Index Info: 5C:F3:70:8E:5D:5E (Broadcom Corporation)                                                       [hci0] 0.321392
@ MGMT Open: bluetoothd (privileged) version 1.14                                                          {0x0001} 0.321395
@ MGMT Open: btmon (privileged) version 1.14                                                               {0x0002} 0.321570
> HCI Event: Connect Request (0x04) plen 10                                                              #1 [hci0] 20.459262
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Class: 0x5a020c
         Major class: Phone (cellular, cordless, payphone, modem)
         Minor class: Smart phone
         Networking (LAN, Ad hoc)
         Capturing (Scanner, Microphone)
         Object Transfer (v-Inbox, v-Folder)
         Telephony (Cordless telephony, Modem, Headset)
       Link type: ACL (0x01)
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7                                            #2 [hci0] 20.459343
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Role: Master (0x00)
> HCI Event: Command Status (0x0f) plen 4                                                                #3 [hci0] 20.460256
     Accept Connection Request (0x01|0x0009) ncmd 1
       Status: Success (0x00)
> HCI Event: Role Change (0x12) plen 8                                                                   #4 [hci0] 20.621259
       Status: Success (0x00)
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Role: Master (0x00)
> HCI Event: Connect Complete (0x03) plen 11                                                             #5 [hci0] 20.787258
       Status: Success (0x00)
       Handle: 12
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Link type: ACL (0x01)
       Encryption: Disabled (0x00)
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2                                       #6 [hci0] 20.787466
       Handle: 12
> HCI Event: Command Status (0x0f) plen 4                                                                #7 [hci0] 20.789274
     Read Remote Supported Features (0x01|0x001b) ncmd 1
       Status: Success (0x00)
> HCI Event: Max Slots Change (0x1b) plen 3                                                              #8 [hci0] 20.796282
       Handle: 12
       Max slots: 5
> HCI Event: Page Scan Repetition Mode Change (0x20) plen 7                                              #9 [hci0] 20.799257
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Page scan repetition mode: R1 (0x01)
> HCI Event: Read Remote Supported Features (0x0b) plen 11                                              #10 [hci0] 20.980261
       Status: Success (0x00)
       Handle: 12
       Features: 0xff 0xfe 0x8f 0xfe 0xd8 0x3f 0x5b 0x87
         3 slot packets
         5 slot packets
         Encryption
         Slot offset
         Timing accuracy
         Role switch
         Hold mode
         Sniff mode
         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
         Broadcast Encryption
         Enhanced Data Rate ACL 2 Mbps mode
         Enhanced Data Rate ACL 3 Mbps mode
         Enhanced inquiry scan
         Interlaced inquiry scan
         Interlaced page scan
         RSSI with inquiry results
         Extended SCO link (EV3 packets)
         AFH capable slave
         AFH classification slave
         LE Supported (Controller)
         3-slot Enhanced Data Rate ACL packets
         5-slot Enhanced Data Rate ACL packets
         Sniff subrating
         Pause encryption
         AFH capable master
         AFH classification master
         Enhanced Data Rate eSCO 2 Mbps mode
         Extended Inquiry Response
         Simultaneous LE and BR/EDR (Controller)
         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                                       #11 [hci0] 20.980320
       Handle: 12
       Page: 1
> HCI Event: Command Status (0x0f) plen 4                                                               #12 [hci0] 20.981255
     Read Remote Extended Features (0x01|0x001c) ncmd 1
       Status: Success (0x00)
> ACL Data RX: Handle 12 flags 0x02 dlen 10                                                             #13 [hci0] 20.982634
     L2CAP: Information Request (0x0a) ident 2 len 2
       Type: Extended features supported (0x0002)
> HCI Event: Read Remote Extended Features (0x23) plen 13                                               #14 [hci0] 21.070261
       Status: Success (0x00)
       Handle: 12
       Page: 1/1
       Features: 0x0f 0x00 0x00 0x00 0x00 0x00 0x00 0x00
         Secure Simple Pairing (Host Support)
         LE Supported (Host)
         Simultaneous LE and BR/EDR (Host)
         Secure Connections (Host Support)
< HCI Command: Remote Name Request (0x01|0x0019) plen 10                                                #15 [hci0] 21.070327
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       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] 21.070349
     L2CAP: Information Request (0x0a) ident 1 len 2
       Type: Extended features supported (0x0002)
< ACL Data TX: Handle 12 flags 0x00 dlen 16                                                             #17 [hci0] 21.070383
     L2CAP: Information Response (0x0b) ident 2 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: Command Status (0x0f) plen 4                                                               #18 [hci0] 21.072272
     Remote Name Request (0x01|0x0019) ncmd 1
       Status: Success (0x00)
> HCI Event: Remote Name Req Complete (0x07) plen 255                                                   #19 [hci0] 21.225257
       Status: Success (0x00)
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Name: Rohan
@ MGMT Event: Device Connected (0x000b) plen 25                                                    {0x0002} [hci0] 21.225299
       BR/EDR Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Flags: 0x00000000
       Data length: 12
       Name (complete): Rohan
       Class: 0x5a020c
         Major class: Phone (cellular, cordless, payphone, modem)
         Minor class: Smart phone
         Networking (LAN, Ad hoc)
         Capturing (Scanner, Microphone)
         Object Transfer (v-Inbox, v-Folder)
         Telephony (Cordless telephony, Modem, Headset)
@ MGMT Event: Device Connected (0x000b) plen 25                                                    {0x0001} [hci0] 21.225299
       BR/EDR Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Flags: 0x00000000
       Data length: 12
       Name (complete): Rohan
       Class: 0x5a020c
         Major class: Phone (cellular, cordless, payphone, modem)
         Minor class: Smart phone
         Networking (LAN, Ad hoc)
         Capturing (Scanner, Microphone)
         Object Transfer (v-Inbox, v-Folder)
         Telephony (Cordless telephony, Modem, Headset)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                  #20 [hci0] 21.258261
       Num handles: 1
       Handle: 12
       Count: 2
> ACL Data RX: Handle 12 flags 0x02 dlen 16                                                             #21 [hci0] 21.259010
     L2CAP: Information Response (0x0b) ident 1 len 8
       Type: Extended features supported (0x0002)
       Result: Success (0x0000)
       Features: 0x000000b8
         Enhanced Retransmission Mode
         Streaming Mode
         FCS Option
         Fixed Channels
< ACL Data TX: Handle 12 flags 0x00 dlen 10                                                             #22 [hci0] 21.259056
     L2CAP: Information Request (0x0a) ident 2 len 2
       Type: Fixed channels supported (0x0003)
> ACL Data RX: Handle 12 flags 0x02 dlen 10                                                             #23 [hci0] 21.262880
     L2CAP: Information Request (0x0a) ident 3 len 2
       Type: Fixed channels supported (0x0003)
< ACL Data TX: Handle 12 flags 0x00 dlen 20                                                             #24 [hci0] 21.262919
     L2CAP: Information Response (0x0b) ident 3 len 12
       Type: Fixed channels supported (0x0003)
       Result: Success (0x0000)
       Channels: 0x0000000000000006
         L2CAP Signaling (BR/EDR)
         Connectionless reception
> HCI Event: Number of Completed Packets (0x13) plen 5                                                  #25 [hci0] 21.323279
       Num handles: 1
       Handle: 12
       Count: 2
> HCI Event: Role Change (0x12) plen 8                                                                  #26 [hci0] 21.558269
       Status: Success (0x00)
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Role: Slave (0x01)
> HCI Event: Max Slots Change (0x1b) plen 3                                                             #27 [hci0] 21.562256
       Handle: 12
       Max slots: 5
> HCI Event: Link Supervision Timeout Changed (0x38) plen 4                                             #28 [hci0] 21.568253
       Handle: 12
       Timeout: 5000.000 msec (0x1f40)
> ACL Data RX: Handle 12 flags 0x02 dlen 20                                                             #29 [hci0] 21.575509
     L2CAP: Information Response (0x0b) ident 2 len 12
       Type: Fixed channels supported (0x0003)
       Result: Success (0x0000)
       Channels: 0x0000000000000082
         L2CAP Signaling (BR/EDR)
         Security Manager (BR/EDR)
> ACL Data RX: Handle 12 flags 0x02 dlen 12                                                             #30 [hci0] 21.576884
     L2CAP: Connection Request (0x02) ident 4 len 4
       PSM: 1 (0x0001)
       Source CID: 77
< ACL Data TX: Handle 12 flags 0x00 dlen 16                                                             #31 [hci0] 21.576956
     L2CAP: Connection Response (0x03) ident 4 len 8
       Destination CID: 64
       Source CID: 77
       Result: Connection successful (0x0000)
       Status: No further information available (0x0000)
< ACL Data TX: Handle 12 flags 0x00 dlen 23                                                             #32 [hci0] 21.576972
     L2CAP: Configure Request (0x04) ident 3 len 15
       Destination CID: 77
       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                                                  #33 [hci0] 21.581254
       Num handles: 1
       Handle: 12
       Count: 2
> ACL Data RX: Handle 12 flags 0x02 dlen 16                                                             #34 [hci0] 21.583259
     L2CAP: Configure Request (0x04) ident 5 len 8
       Destination CID: 64
       Flags: 0x0000
       Option: Maximum Transmission Unit (0x01) [mandatory]
         MTU: 672
< ACL Data TX: Handle 12 flags 0x00 dlen 18                                                             #35 [hci0] 21.583300
     L2CAP: Configure Response (0x05) ident 5 len 10
       Source CID: 77
       Flags: 0x0000
       Result: Success (0x0000)
       Option: Maximum Transmission Unit (0x01) [mandatory]
         MTU: 672
> ACL Data RX: Handle 12 flags 0x02 dlen 14                                                             #36 [hci0] 21.593381
     L2CAP: Configure Response (0x05) ident 3 len 6
       Source CID: 64
       Flags: 0x0000
       Result: Success (0x0000)
> ACL Data RX: Handle 12 flags 0x02 dlen 28                                                             #37 [hci0] 21.594757
     Channel: 64 len 24 [PSM 1 mode 0] {chan 0}
     SDP: Service Search Attribute Request (0x06) tid 0 len 19
       Search pattern: [len 5]
         Sequence (6) with 3 bytes [8 extra bits] len 5
           UUID (3) with 2 bytes [0 extra bits] len 3
             Audio Sink (0x110b)
       Max record count: 656
       Attribute list: [len 11]
         Sequence (6) with 9 bytes [8 extra bits] len 11
           Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
             0x0001
           Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
             0x0004
           Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
             0x0009
       Continuation state: 0
< ACL Data TX: Handle 12 flags 0x00 dlen 58                                                             #38 [hci0] 21.595814
     Channel: 77 len 54 [PSM 1 mode 0] {chan 0}
     SDP: Service Search Attribute Response (0x07) tid 0 len 49
       Attribute bytes: 46
         Attribute list: [len 42] {position 0}
           Attribute: Service Class ID List (0x0001) [len 2]
             UUID (3) with 2 bytes [0 extra bits] len 3
               Audio Sink (0x110b)
           Attribute: Protocol Descriptor List (0x0004) [len 2]
             Sequence (6) with 6 bytes [8 extra bits] len 8
               UUID (3) with 2 bytes [0 extra bits] len 3
                 L2CAP (0x0100)
               Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                 0x0019
             Sequence (6) with 6 bytes [8 extra bits] len 8
               UUID (3) with 2 bytes [0 extra bits] len 3
                 AVDTP (0x0019)
               Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                 0x0103
           Attribute: Bluetooth Profile Descriptor List (0x0009) [len 2]
             Sequence (6) with 6 bytes [8 extra bits] len 8
               UUID (3) with 2 bytes [0 extra bits] len 3
                 Advanced Audio Distribution (0x110d)
               Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                 0x0103
       Continuation state: 0
> HCI Event: Number of Completed Packets (0x13) plen 5                                                  #39 [hci0] 21.598256
       Num handles: 1
       Handle: 12
       Count: 2
> ACL Data RX: Handle 12 flags 0x02 dlen 12                                                             #40 [hci0] 21.601134
     L2CAP: Disconnection Request (0x06) ident 6 len 4
       Destination CID: 64
       Source CID: 77
< ACL Data TX: Handle 12 flags 0x00 dlen 12                                                             #41 [hci0] 21.601186
     L2CAP: Disconnection Response (0x07) ident 6 len 4
       Destination CID: 64
       Source CID: 77
> HCI Event: Link Key Request (0x17) plen 6                                                             #42 [hci0] 21.641260
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
< HCI Command: Link Key Request Reply (0x01|0x000b) plen 22                                             #43 [hci0] 21.641308
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Link key: b131b449f891d5dda259d7e6d89f64f4
> HCI Event: Command Complete (0x0e) plen 10                                                            #44 [hci0] 21.646260
     Link Key Request Reply (0x01|0x000b) ncmd 1
       Status: Success (0x00)
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
> HCI Event: Encryption Change (0x08) plen 4                                                            #45 [hci0] 21.770257
       Status: Success (0x00)
       Handle: 12
       Encryption: Enabled with E0 (0x01)
< HCI Command: Read Encryption Key Size (0x05|0x0008) plen 2                                            #46 [hci0] 21.770314
       Handle: 12
> HCI Event: Command Complete (0x0e) plen 7                                                             #47 [hci0] 21.771258
     Read Encryption Key Size (0x05|0x0008) ncmd 1
       Status: Success (0x00)
       Handle: 12
       Key size: 16
> ACL Data RX: Handle 12 flags 0x02 dlen 12                                                             #48 [hci0] 21.801262
     L2CAP: Connection Request (0x02) ident 7 len 4
       PSM: 25 (0x0019)
       Source CID: 67
< ACL Data TX: Handle 12 flags 0x00 dlen 16                                                             #49 [hci0] 21.801343
     L2CAP: Connection Response (0x03) ident 7 len 8
       Destination CID: 64
       Source CID: 67
       Result: Connection pending (0x0001)
       Status: Authorization pending (0x0002)
= bluetoothd: Authentication attempt without agent                                                          [hci0] 21.804175
= bluetoothd: Access denied: org.bluez.Error.Rejected                                                              21.805138
< ACL Data TX: Handle 12 flags 0x00 dlen 16                                                             #50 [hci0] 21.804824
     L2CAP: Connection Response (0x03) ident 7 len 8
       Destination CID: 64
       Source CID: 67
       Result: Connection refused - security block (0x0003)
       Status: No further information available (0x0000)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                  #51 [hci0] 21.817259
       Num handles: 1
       Handle: 12
       Count: 2
> HCI Event: Number of Completed Packets (0x13) plen 5                                                  #52 [hci0] 21.951260
       Num handles: 1
       Handle: 12
       Count: 1
> ACL Data RX: Handle 12 flags 0x02 dlen 12                                                             #53 [hci0] 23.837647
     L2CAP: Connection Request (0x02) ident 8 len 4
       PSM: 1 (0x0001)
       Source CID: 64
< ACL Data TX: Handle 12 flags 0x00 dlen 16                                                             #54 [hci0] 23.837763
     L2CAP: Connection Response (0x03) ident 8 len 8
       Destination CID: 64
       Source CID: 64
       Result: Connection successful (0x0000)
       Status: No further information available (0x0000)
< ACL Data TX: Handle 12 flags 0x00 dlen 23                                                             #55 [hci0] 23.837779
     L2CAP: Configure Request (0x04) ident 4 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                                                  #56 [hci0] 23.843255
       Num handles: 1
       Handle: 12
       Count: 2
> ACL Data RX: Handle 12 flags 0x02 dlen 16                                                             #57 [hci0] 23.850259
     L2CAP: Configure Request (0x04) ident 9 len 8
       Destination CID: 64
       Flags: 0x0000
       Option: Maximum Transmission Unit (0x01) [mandatory]
         MTU: 672
< ACL Data TX: Handle 12 flags 0x00 dlen 18                                                             #58 [hci0] 23.850304
     L2CAP: Configure Response (0x05) ident 9 len 10
       Source CID: 64
       Flags: 0x0000
       Result: Success (0x0000)
       Option: Maximum Transmission Unit (0x01) [mandatory]
         MTU: 672
> ACL Data RX: Handle 12 flags 0x02 dlen 14                                                             #59 [hci0] 23.851630
     L2CAP: Configure Response (0x05) ident 4 len 6
       Source CID: 64
       Flags: 0x0000
       Result: Success (0x0000)
> ACL Data RX: Handle 12 flags 0x02 dlen 28                                                             #60 [hci0] 23.864259
     Channel: 64 len 24 [PSM 25 mode 0] {chan 0}
     AVDTP: Reserved (0x00) Response Accept (0x02) type 0x04 label 0 nosp 0
       00 13 35 03 19 11 0b 02 90 35 09 09 00 01 09 00  ..5......5......
       04 09 00 09 00                                   .....          
< ACL Data TX: Handle 12 flags 0x00 dlen 58                                                             #61 [hci0] 23.864590
     Channel: 64 len 54 [PSM 1 mode 0] {chan 1}
     SDP: Service Search Attribute Response (0x07) tid 0 len 49
       Attribute bytes: 46
         Attribute list: [len 42] {position 0}
           Attribute: Service Class ID List (0x0001) [len 2]
             UUID (3) with 2 bytes [0 extra bits] len 3
               Audio Sink (0x110b)
           Attribute: Protocol Descriptor List (0x0004) [len 2]
             Sequence (6) with 6 bytes [8 extra bits] len 8
               UUID (3) with 2 bytes [0 extra bits] len 3
                 L2CAP (0x0100)
               Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                 0x0019
             Sequence (6) with 6 bytes [8 extra bits] len 8
               UUID (3) with 2 bytes [0 extra bits] len 3
                 AVDTP (0x0019)
               Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                 0x0103
           Attribute: Bluetooth Profile Descriptor List (0x0009) [len 2]
             Sequence (6) with 6 bytes [8 extra bits] len 8
               UUID (3) with 2 bytes [0 extra bits] len 3
                 Advanced Audio Distribution (0x110d)
               Unsigned Integer (1) with 2 bytes [0 extra bits] len 3
                 0x0103
       Continuation state: 0
> HCI Event: Number of Completed Packets (0x13) plen 5                                                  #62 [hci0] 23.867255
       Num handles: 1
       Handle: 12
       Count: 2
> ACL Data RX: Handle 12 flags 0x02 dlen 12                                                             #63 [hci0] 23.876884
     L2CAP: Disconnection Request (0x06) ident 10 len 4
       Destination CID: 64
       Source CID: 64
< ACL Data TX: Handle 12 flags 0x00 dlen 12                                                             #64 [hci0] 23.876940
     L2CAP: Disconnection Response (0x07) ident 10 len 4
       Destination CID: 64
       Source CID: 64
> ACL Data RX: Handle 12 flags 0x02 dlen 12                                                             #65 [hci0] 23.899506
     L2CAP: Connection Request (0x02) ident 11 len 4
       PSM: 25 (0x0019)
       Source CID: 79
< ACL Data TX: Handle 12 flags 0x00 dlen 16                                                             #66 [hci0] 23.899581
     L2CAP: Connection Response (0x03) ident 11 len 8
       Destination CID: 64
       Source CID: 79
       Result: Connection pending (0x0001)
       Status: Authorization pending (0x0002)
= bluetoothd: Authentication attempt without agent                                                          [hci0] 23.900391
= bluetoothd: Access denied: org.bluez.Error.Rejected                                                              23.900421
< ACL Data TX: Handle 12 flags 0x00 dlen 16                                                             #67 [hci0] 23.899993
     L2CAP: Connection Response (0x03) ident 11 len 8
       Destination CID: 64
       Source CID: 79
       Result: Connection refused - security block (0x0003)
       Status: No further information available (0x0000)
> HCI Event: Number of Completed Packets (0x13) plen 5                                                  #68 [hci0] 23.917258
       Num handles: 1
       Handle: 12
       Count: 2
> HCI Event: Number of Completed Packets (0x13) plen 5                                                  #69 [hci0] 24.076255
       Num handles: 1
       Handle: 12
       Count: 1
< HCI Command: Disconnect (0x01|0x0006) plen 3                                                          #70 [hci0] 27.928665
       Handle: 12
       Reason: Remote User Terminated Connection (0x13)
> HCI Event: Command Status (0x0f) plen 4                                                               #71 [hci0] 27.930255
     Disconnect (0x01|0x0006) ncmd 1
       Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4                                                          #72 [hci0] 28.077252
       Status: Success (0x00)
       Handle: 12
       Reason: Connection Terminated By Local Host (0x16)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                  {0x0002} [hci0] 28.077289
       BR/EDR Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Reason: Connection terminated by local host (0x02)
@ MGMT Event: Device Disconnected (0x000c) plen 8                                                  {0x0001} [hci0] 28.077289
       BR/EDR Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Reason: Connection terminated by local host (0x02)
pi@moode:~ $

If I connect to the OnePlus from the Moode BlueZ config page, it succeeds and I get this output: (truncated so as not to exceed post length):

Code:
Bluetooth monitor ver 5.49
= Note: Linux version 4.14.54-v7+ (armv7l)                             0.167740
= Note: Bluetooth subsystem version 2.22                               0.167747
= New Index: 5C:F3:70:8E:5D:5E (Primary,USB,hci0)               [hci0] 0.167750
= Open Index: 5C:F3:70:8E:5D:5E                                 [hci0] 0.167752
= Index Info: 5C:F3:70:8E:5D:5E (Broadcom Corporation)          [hci0] 0.167753
@ MGMT Open: bluetoothd (privileged) version 1.14             {0x0001} 0.167757
@ MGMT Open: btmon (privileged) version 1.14                  {0x0002} 0.167931
< HCI Command: Create Connection (0x01|0x0005) plen 13       #1 [hci0] 2.952253
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Packet type: 0xcc18
         DM1 may be used
         DH1 may be used
         DM3 may be used
         DH3 may be used
         DM5 may be used
         DH5 may be used
       Page scan repetition mode: R1 (0x01)
       Page scan mode: Mandatory (0x00)
       Clock offset: 0x8da1
       Role switch: Allow slave (0x01)
> HCI Event: Command Status (0x0f) plen 4                    #2 [hci0] 2.953469
     Create Connection (0x01|0x0005) ncmd 1
       Status: Success (0x00)
> HCI Event: Connect Complete (0x03) plen 11                 #3 [hci0] 3.432476
       Status: Success (0x00)
       Handle: 11
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Link type: ACL (0x01)
       Encryption: Disabled (0x00)
< HCI Command: Read Remote Supported.. (0x01|0x001b) plen 2  #4 [hci0] 3.432714
       Handle: 11
> HCI Event: Command Status (0x0f) plen 4                    #5 [hci0] 3.433470
     Read Remote Supported Features (0x01|0x001b) ncmd 1
       Status: Success (0x00)
> HCI Event: Max Slots Change (0x1b) plen 3                  #6 [hci0] 3.461474
       Handle: 11
       Max slots: 5
> HCI Event: Page Scan Repetition Mode Change (0x20) plen 7  #7 [hci0] 3.472462
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Page scan repetition mode: R1 (0x01)
> ACL Data RX: Handle 11 flags 0x02 dlen 10                  #8 [hci0] 3.479964
     L2CAP: Information Request (0x0a) ident 2 len 2
       Type: Extended features supported (0x0002)
> HCI Event: Read Remote Supported Features (0x0b) plen 11   #9 [hci0] 3.485458
       Status: Success (0x00)
       Handle: 11
       Features: 0xff 0xfe 0x8f 0xfe 0xd8 0x3f 0x5b 0x87
         3 slot packets
         5 slot packets
         Encryption
         Slot offset
         Timing accuracy
         Role switch
         Hold mode
         Sniff mode
         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
         Broadcast Encryption
         Enhanced Data Rate ACL 2 Mbps mode
         Enhanced Data Rate ACL 3 Mbps mode
         Enhanced inquiry scan
         Interlaced inquiry scan
         Interlaced page scan
         RSSI with inquiry results
         Extended SCO link (EV3 packets)
         AFH capable slave
         AFH classification slave
         LE Supported (Controller)
         3-slot Enhanced Data Rate ACL packets
         5-slot Enhanced Data Rate ACL packets
         Sniff subrating
         Pause encryption
         AFH capable master
         AFH classification master
         Enhanced Data Rate eSCO 2 Mbps mode
         Extended Inquiry Response
         Simultaneous LE and BR/EDR (Controller)
         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.. (0x01|0x001c) plen 3  #10 [hci0] 3.485491
       Handle: 11
       Page: 1
> HCI Event: Command Status (0x0f) plen 4                   #11 [hci0] 3.486458
     Read Remote Extended Features (0x01|0x001c) ncmd 1
       Status: Success (0x00)
> HCI Event: Read Remote Extended Features (0x23) plen 13   #12 [hci0] 3.489458
       Status: Success (0x00)
       Handle: 11
       Page: 1/1
       Features: 0x0f 0x00 0x00 0x00 0x00 0x00 0x00 0x00
         Secure Simple Pairing (Host Support)
         LE Supported (Host)
         Simultaneous LE and BR/EDR (Host)
         Secure Connections (Host Support)
< HCI Command: Remote Name Request (0x01|0x0019) plen 10    #13 [hci0] 3.489490
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Page scan repetition mode: R2 (0x02)
       Page scan mode: Mandatory (0x00)
       Clock offset: 0x0000
> HCI Event: Command Status (0x0f) plen 4                   #14 [hci0] 3.490458
     Remote Name Request (0x01|0x0019) ncmd 1
       Status: Success (0x00)
> HCI Event: Remote Name Req Complete (0x07) plen 255       #15 [hci0] 3.510456
       Status: Success (0x00)
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Name: Rohan
@ MGMT Event: Device Connected (0x000b) plen 25        {0x0002} [hci0] 3.510480
       BR/EDR Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Flags: 0x00000000
       Data length: 12
       Name (complete): Rohan
       Class: 0x5a020c
         Major class: Phone (cellular, cordless, payphone, modem)
         Minor class: Smart phone
         Networking (LAN, Ad hoc)
         Capturing (Scanner, Microphone)
         Object Transfer (v-Inbox, v-Folder)
         Telephony (Cordless telephony, Modem, Headset)
@ MGMT Event: Device Connected (0x000b) plen 25        {0x0001} [hci0] 3.510480
       BR/EDR Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Flags: 0x00000000
       Data length: 12
       Name (complete): Rohan
       Class: 0x5a020c
         Major class: Phone (cellular, cordless, payphone, modem)
         Minor class: Smart phone
         Networking (LAN, Ad hoc)
         Capturing (Scanner, Microphone)
         Object Transfer (v-Inbox, v-Folder)
         Telephony (Cordless telephony, Modem, Headset)
< HCI Command: Authentication Reque.. (0x01|0x0011) plen 2  #16 [hci0] 3.510506
       Handle: 11
> HCI Event: Command Status (0x0f) plen 4                   #17 [hci0] 3.511471
     Authentication Requested (0x01|0x0011) ncmd 1
       Status: Success (0x00)
> HCI Event: Link Key Request (0x17) plen 6                 #18 [hci0] 3.512465
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
< HCI Command: Link Key Request Re.. (0x01|0x000b) plen 22  #19 [hci0] 3.512502
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
       Link key: b131b449f891d5dda259d7e6d89f64f4
> HCI Event: Command Complete (0x0e) plen 10                #20 [hci0] 3.514459
     Link Key Request Reply (0x01|0x000b) ncmd 1
       Status: Success (0x00)
       Address: C0:EE:FB:D7:F3:FE (OnePlus Tech (Shenzhen) Ltd)
> HCI Event: Auth Complete (0x06) plen 3                    #21 [hci0] 3.526474
       Status: Success (0x00)
       Handle: 11
< HCI Command: Set Connection Encry.. (0x01|0x0013) plen 3  #22 [hci0] 3.526526
       Handle: 11
       Encryption: Enabled (0x01)
> HCI Event: Command Status (0x0f) plen 4                   #23 [hci0] 3.527459
     Set Connection Encryption (0x01|0x0013) ncmd 1
       Status: Success (0x00)
> HCI Event: Encryption Change (0x08) plen 4                #24 [hci0] 3.568465
       Status: Success (0x00)
       Handle: 11
       Encryption: Enabled with E0 (0x01)
< HCI Command: Read Encryption Key... (0x05|0x0008) plen 2  #25 [hci0] 3.568510
       Handle: 11
> HCI Event: Command Complete (0x0e) plen 7                 #26 [hci0] 3.569459
     Read Encryption Key Size (0x05|0x0008) ncmd 1
       Status: Success (0x00)
       Handle: 11
       Key size: 16
< ACL Data TX: Handle 11 flags 0x00 dlen 10                 #27 [hci0] 3.569510
     L2CAP: Information Request (0x0a) ident 1 len 2
       Type: Extended features supported (0x0002)
< ACL Data TX: Handle 11 flags 0x00 dlen 16                 #28 [hci0] 3.569536
     L2CAP: Information Response (0x0b) ident 2 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      #29 [hci0] 3.573458
       Num handles: 1
       Handle: 11
       Count: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 16                 #30 [hci0] 3.576340
     L2CAP: Information Response (0x0b) ident 1 len 8
       Type: Extended features supported (0x0002)
       Result: Success (0x0000)
       Features: 0x000000b8
         Enhanced Retransmission Mode
         Streaming Mode
         FCS Option
         Fixed Channels
< ACL Data TX: Handle 11 flags 0x00 dlen 10                 #31 [hci0] 3.576368
     L2CAP: Information Request (0x0a) ident 2 len 2
       Type: Fixed channels supported (0x0003)
> ACL Data RX: Handle 11 flags 0x02 dlen 10                 #32 [hci0] 3.578961
     L2CAP: Information Request (0x0a) ident 3 len 2
       Type: Fixed channels supported (0x0003)
< ACL Data TX: Handle 11 flags 0x00 dlen 20                 #33 [hci0] 3.578989
     L2CAP: Information Response (0x0b) ident 3 len 12
       Type: Fixed channels supported (0x0003)
       Result: Success (0x0000)
       Channels: 0x0000000000000006
         L2CAP Signaling (BR/EDR)
         Connectionless reception
> HCI Event: Number of Completed Packets (0x13) plen 5      #34 [hci0] 3.582458
       Num handles: 1
       Handle: 11
       Count: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 20                 #35 [hci0] 3.585340
     L2CAP: Information Response (0x0b) ident 2 len 12
       Type: Fixed channels supported (0x0003)
       Result: Success (0x0000)
       Channels: 0x0000000000000082
         L2CAP Signaling (BR/EDR)
         Security Manager (BR/EDR)
< ACL Data TX: Handle 11 flags 0x00 dlen 12                 #36 [hci0] 3.585372
     L2CAP: Connection Request (0x02) ident 3 len 4
       PSM: 25 (0x0019)
       Source CID: 64
> ACL Data RX: Handle 11 flags 0x02 dlen 16                 #37 [hci0] 3.617962
     L2CAP: Connection Response (0x03) ident 3 len 8
       Destination CID: 75
       Source CID: 64
       Result: Connection successful (0x0000)
       Status: No further information available (0x0000)
< ACL Data TX: Handle 11 flags 0x00 dlen 23                 #38 [hci0] 3.617994
     L2CAP: Configure Request (0x04) ident 4 len 15
       Destination CID: 75
       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
> ACL Data RX: Handle 11 flags 0x02 dlen 16                 #39 [hci0] 3.618088
     L2CAP: Configure Request (0x04) ident 4 len 8
       Destination CID: 64
       Flags: 0x0000
       Option: Maximum Transmission Unit (0x01) [mandatory]
         MTU: 672
< ACL Data TX: Handle 11 flags 0x00 dlen 18                 #40 [hci0] 3.618124
     L2CAP: Configure Response (0x05) ident 4 len 10
       Source CID: 75
       Flags: 0x0000
       Result: Success (0x0000)
       Option: Maximum Transmission Unit (0x01) [mandatory]
         MTU: 672
> HCI Event: Number of Completed Packets (0x13) plen 5      #41 [hci0] 3.621459
       Num handles: 1
       Handle: 11
       Count: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 14                 #42 [hci0] 3.625836
     L2CAP: Configure Response (0x05) ident 4 len 6
       Source CID: 64
       Flags: 0x0000
       Result: Success (0x0000)
< ACL Data TX: Handle 11 flags 0x00 dlen 6                  #43 [hci0] 3.626024
     Channel: 75 len 2 [PSM 25 mode 0] {chan 0}
     AVDTP: Discover (0x01) Command (0x00) type 0x00 label 3 nosp 0
> HCI Event: Number of Completed Packets (0x13) plen 5      #44 [hci0] 3.629459
       Num handles: 1
       Handle: 11
       Count: 2
> HCI Event: Encryption Key Refresh Complete (0x30) plen 3  #45 [hci0] 3.949473
       Status: Success (0x00)
       Handle: 11
> ACL Data RX: Handle 11 flags 0x02 dlen 16                 #46 [hci0] 3.954717
     Channel: 64 len 12 [PSM 25 mode 0] {chan 0}
     AVDTP: Discover (0x01) Response Accept (0x02) type 0x00 label 3 nosp 0
       ACP SEID: 1
         Media Type: Audio (0x00)
         SEP Type: SRC (0x00)
         In use: No
       ACP SEID: 2
         Media Type: Audio (0x00)
         SEP Type: SRC (0x00)
         In use: No
       ACP SEID: 3
         Media Type: Audio (0x00)
         SEP Type: SRC (0x00)
         In use: No
       ACP SEID: 4
         Media Type: Audio (0x00)
         SEP Type: SRC (0x00)
         In use: No
       ACP SEID: 5
         Media Type: Audio (0x00)
         SEP Type: SRC (0x00)
         In use: No
< ACL Data TX: Handle 11 flags 0x00 dlen 7                  #47 [hci0] 3.954879
     Channel: 75 len 3 [PSM 25 mode 0] {chan 0}
     AVDTP: Get Capabilities (0x02) Command (0x00) type 0x00 label 4 nosp 0
       ACP SEID: 1
> HCI Event: Number of Completed Packets (0x13) plen 5      #48 [hci0] 4.190470
       Num handles: 1
       Handle: 11
       Count: 1
> HCI Event: Encryption Key Refresh Complete (0x30) plen 3  #49 [hci0] 4.273465
       Status: Success (0x00)
       Handle: 11
> ACL Data RX: Handle 11 flags 0x02 dlen 16                 #50 [hci0] 4.278593
     Channel: 64 len 12 [PSM 25 mode 0] {chan 0}
     AVDTP: Get Capabilities (0x02) Response Accept (0x02) type 0x00 label 4 nosp 0
       Service Category: Media Transport (0x01)
       Service Category: Media Codec (0x07)
         Media Type: Audio (0x00)
         Media Codec: SBC (0x00)
           Frequency: 0x20
             44100
           Channel Mode: 0x01
             Joint Stereo
           Block Length: 0x10
             16
           Subbands: 0x04
             8
           Allocation Method: 0x01
             Loudness
           Minimum Bitpool: 2
           Maximum Bitpool: 53
< ACL Data TX: Handle 11 flags 0x00 dlen 7                  #51 [hci0] 4.278741
     Channel: 75 len 3 [PSM 25 mode 0] {chan 0}
     AVDTP: Get Capabilities (0x02) Command (0x00) type 0x00 label 5 nosp 0
       ACP SEID: 2
> ACL Data RX: Handle 11 flags 0x02 dlen 18                 #52 [hci0] 4.311216
     Channel: 64 len 14 [PSM 25 mode 0] {chan 0}
     AVDTP: Get Capabilities (0x02) Response Accept (0x02) type 0x00 label 5 nosp 0
       Service Category: Media Transport (0x01)
       Service Category: Media Codec (0x07)
         Media Type: Audio (0x00)
         Media Codec: MPEG-2,4 AAC (0x02)
           Object Type: 0x80
             MPEG-2 AAC LC
           Frequency: 0x100
             44100
           Channels: 0x04
             2
           Bitrate: 320000bps
           VBR: No
Reply
#7
(07-14-2018, 03:44 PM)aknaggbaugh Wrote: I've run btmon.sh and it appears to produce the expected output - both the Samsung Galaxy and Rohan (my OnePlus) paired, but not connected. I ran btmon and then attempted to connect from the OnePlus: the output contains an error message about permissions, see below.
...

So that
Code:
= bluetoothd: Authentication attempt without agent

means the Bluez package doesn't trust your OnePlus. What do you see if you run bt.sh with the -s option?
Here's an example from my moOde installation:

Code:
pi@moode-42b3p:/var/log $ sudo /var/www/command/bt.sh -s
** Scanning for devices (20 secs)
**
** Trusted devices
** 5C:F3:70:89:11:49 T520
** FC:3F:7C:9A:D8:AF Nexus 6P
** D4:0B:1A:19:6D:C0 Nexus 9
**
** Scan complete

All my devices (T520 is my Linux laptop; not another Android device) are trusted and I can pair and connect from any of them. [1]
I don't know why your OnePlus ends up untrusted. You could try to force the trust relationship using the command-line tool bluetoothctl.
What do the command-line tools report when you try to connect from the Samsung Galaxy? is it similarly untrusted?

Regards,
Kent

[1] while horsing around with all my Nexus devices I managed to get into a state similar to what you report. All of the devices were paired, all had previously connected, but at some point I couldn't (re)connect from one. I was able to get back to a working connection by clearing the previous data and going through the pairing/connection process again. Sadly, I didn't use any of the command-line tools to gather information before I did so.
Reply
#8
That was very odd: bt.sh said that both devices were trusted. However I tried forcing them to trusted using bluetoothctl as you suggested, and now they both work perfectly. Thanks for the tip!

Maybe it would be worth including the ability to force-trust devices through the GUI, maybe even automatically just for belt and braces, into a future update?

Thanks Kent!
Reply
#9
Can someone give me a detailed explanation of how to use the command-line tool bluetoothctl  in order force moode to trust my samsung s-7 as a bluetooth device

thanks
Reply
#10
(07-18-2018, 08:49 PM)Hugh Bond Wrote: Can someone give me a detailed explanation of how to use the command-line tool bluetoothctl  in order force moode to trust my samsung s-7 as a bluetooth device

thanks

Connect to the moode system using SSH or a local keyboard/screen.
Find the MAC address of you phone's bluetooth.
enter "bluetoothctl", might need "sudo"
enter "trust "my MAC address" substituting your phone's MAC address.
Reply


Forum Jump: