Thank you for your donation!


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


Problem: Moode 9 bluetooth PIN code issue
#1
Hi,

The just released ~pre4 moode 9 code contains a new Bluetooth feature that supports PIN code authentication but currently it is not working correctly.

Help needed :-)

   

The symptom is that after entering the PIN code on the client the pairing appears to work (shows up as paired in Bluetooth Control screen) but the connection fails and thus bluealsa-aplay is not launched.

Here are the pieces

/etc/bluetooth/pin.conf
/usr/bin/bt-agent
/etc/systemd/system/bt-agent.service
/var/www/daemon/worker.php, job=bt_pin_code

PIN code=None
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
ExecStartPost=/bin/sleep 1
ExecStartPost=/bin/hciconfig hci0 sspmode 1

PIN code = 123456
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput -p /etc/bluetooth/pin.conf
ExecStartPost=/bin/sleep 1
ExecStartPost=/bin/hciconfig hci0 sspmode 0

Note: sspmode (Secure Simple Pairing Mode) 

Links:
https://github.com/khvzak/bluez-tools
https://forums.raspberrypi.com/viewtopic.php?t=235519
https://stackoverflow.com/questions/5152...ng-pairing
https://stackoverflow.com/questions/5214...matching-p

I also tried PIN code auth with the existing /var/www/daemon/blu_agent.py script and no success.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#2
Hum.

On a Pi 5B, having gone through the Bluetooth Controller ON/RESTART cycle I just mentioned in https://moodeaudio.org/forum/showthread....0#pid53730

I deleted all known paired devices, then turned OFF the Controller, set a 6-digit PIN code and turned the controller back ON.

I can pair from my Pixel 6a using the PIN code. Seemed like it first connected and then immediately disconnected(but I wasn't paying attention). Connected again and now I'm playing music from the phone via BT to the moOde ~pre4 player with Audio output device: my Creative Tech USB-BT adapter to my headphones.

ETA I’m having no luck pairing either an iPad or an iPhone SE to the same player using the 6-digit PIN.

Regards,
Kent
Reply
#3
Thats interesting; Android works, IOS does not.

Here's a btmon trace of my iPhone attempting to connect. The pairing is successful and it does connect for a bit then abruptly disconnects. 

The trace at the end suggests the iPhone initiates the disconnection request. Maybe IOS does not support fixed PIN code auth or something like that ??

Code:
< HCI Command: Disconnect (0x01|0x0006) plen 3                                                                                     #137 [hci0] 59.736444
       Handle: 12 Address: IPHONE_BT_MAC_ADDR (Apple, Inc.)
       Reason: Remote User Terminated Connection (0x13)

Full trace (attached zip)


Attached Files
.zip   btmon1.txt.zip (Size: 10.87 KB / Downloads: 2)
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#4
Holy, Moley, Bluetooth is chatty. Your trace is 2000+ lines. I just took a btmon trace of my own---Pixel 6a pairing with ~pre4 from scratch---and it's 1100+ lines.

I clearly see now how my first-time pairing results in a connection closely followed by a disconnection initiated by the Pixel, just as you saw

Code:
< HCI Command: Disconnect (0x01|0x0006) plen 3                                                                                                #108 [hci0] 27.788052
       Handle: 12 Address: 0C:C4:13:D6:3A:36 (Google, Inc.)
       Reason: Remote User Terminated Connection (0x13)

The difference is that I can now connect and stay connected with the Pixel?!?

I've replicated your btmon trace while trying to pair and connect my iPad. One thing I notice is that when the first connection is dropped, the iPad reverts to asking for a PIN code again whereas my Pixel silently connects.

I'm really out of my depth here and so far Internet searches have been frustrating. The 0x13 return code is pretty generic.

One whiff I caught is this response to a sensor developer on a TI forum "My suspicion here is that the Android stack is terminating the link because it doesn't like something about the notification that you sent." ... or not Tongue

Regards,
Kent
Reply
#5
lol, only 1/10th as chatty as UPnP :-0

Maybe try turning off the pairing agent in the WebUI and then running it sudo from the command line with the "DisplayYesNo" option to see if interactive PIN code processing works. Might need to also remove the -p part.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#6
I'm baffled. I spent several hours playing with various settings and the result was always the same: my Android device pairs and (finally) connects, the iOS devices don't.

Did you notice the tail-end comment in your third link https://stackoverflow.com/questions/5152...ng-pairing

Don't know how true it is and it still has 0 votes.

Regards,
Kent
Reply
#7
The main challenge with the PIN code feature is that there is no good explanation (that I could find) of what to expect.

For example should we assume that fixed PIN code pairing using SSP is supposed work on both IOS and Android? And if not then is it just a matter of settings and config?

Maybe examining other blueZ agent implementations that provide fixed PIN code pairing would provide some insight.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: