02-22-2024, 01:05 AM
(02-21-2024, 10:39 PM)TheOldPresbyope Wrote: Thanks, @the_bertrum
I'll look at the webUI fail later if Tim doesn't beat me to it.![]()
Meanwhile, here's what works for me to pair and connect with a remote device from the RaspbiOS command line so I can feed audio via Bluetooth from the device to my moOde player.
Test rig: 32-bit moOde 8.3.8 on RPi Zero W connecting to Apple iPad, iPhone SE, and Google Pixel 3a devices; audio sources on these devices were Amazon Music and random podcasts.
1. on the Pi2. on the remote device
- in the moOde Renderer view, enable the Bluetooth controller.
- open a terminal session (I use SSH from my laptop but moOde's Web SSH terminal will do) and invoke bluetoothctl (it starts up in interactive mode)
3. on the Pi
- open the system's Bluetooth device pairing/connecting service. After a short while it should discover your moOde player. Try to pair with it (details of this step depend somewhat on the remote device's OS).
4. on the remote device
- bluetoothctl should show the remote device and ask to confirm a passkey (a random number). Enter "yes"
5. on the Pi
- the same passkey should be displayed in a popup asking if you wish to pair. Accept the offer (again, the exact dialogue depends on the device's OS).
6. on the remote device
- bluetoothctl will ask to authorize service <UUID>.. Enter "yes". (There will be a vomiting forth of nerdiness which can be ignored if you're not working on your nerd first-class badge). You may need to enter "yes" more than once depending on the remote device.
- tell bluetoothctl to trust the MAC address of the connected remote device (trust XX:XX:XX:XX:XX:XX)
- exit bluetoothctl and the terminal session
You can now connect and disconnect as you wish from the remote device; moOde and its webUI will reflect the current state (when you refresh the display, that is). Similarly, you can connect and disconnect as you wish from moOde's Bluetooth Control view. The knowledge of trusted devices will persist over reboots
- exit from the Connected devices panel
You can repeat as you wish to add other trusted Bluetooth devices to moOde/RaspiOS.
Here's an annotated bluetoothctl dialogue when connecting my Pixel 6a (edited to obscure my MACs)
Code:pi@ZeroTest:~ $ bluetoothctl
Agent registered
[CHG] Controller B8:27:EB:XX:XX:XX Pairable: yes
[NEW] Device 0C:C4:13:XX:XX:XX Pixel 6a <--- when I chose "Pair new device" from the Pixel 6a
Request confirmation
[agent] Confirm passkey 478140 (yes/no): yes <--- responded "yes"
<at this point also clicked "Pair" in the Pixel's popup which shows the same passkey/pairing code>
[CHG] Device 0C:C4:13:XX:XX:XX Modalias: bluetooth:v00E0p1200d1436
[CHG] Device 0C:C4:13:XX:XX:XX UUIDs: 00001105-0000-1000-8000-00805f9b34fb
...16 similar lines...
[CHG] Device 0C:C4:13:XX:XX:XX Paired: yes
Authorize service
[agent] Authorize service 0000110d-0000-1000-8000-00805f9b34fb (yes/no): yes <--- responded "yes"
[CHG] Device 0C:C4:13:XX:XX:XX UUIDs: 00001105-0000-1000-8000-00805f9b34fb
...16 more similar lines...
[Pixel 6a]# trust 0C:C4:13:XX:XX:XX <--- tells RaspiOS to remember the Pixel 6a
[CHG] Device 0C:C4:13:XX:XX:XX Trusted: yes
Changing 0C:C4:13:XX:XX:XX trust succeeded
[Pixel 6a]# exit <--- note that the bluetoothctl prompt has changed to show it's connected to the Pixel
I think I managed to catch all the details needed. Let me know if this doesn't work for you.
Notes:
I randomly ran into situations where it seemed like I had to close the existing web browser tab and open moOde's webUI in a new tab. Dunno yet what that was about. May be related to the original problem.
Similarly it seemed like depending on the sequence in which I was doing things where the remote device began playing to its own speaker instead of the the moOde player. Going back to the device's system setttings and clicking on moOde's Bluetooth entry fixed the problem. Again, dunno yet what that was about.
Regards,
Kent
PS - ISTR that by trusting the device first it's possible to avoid the whole passkey thing, but I chose to do this the old-fashioned way. Will check later.
Great!
That worked.
I had a slightly different display tought.
I was never asked this part:
- bluetoothctl will ask to authorize service <UUID>.. Enter "yes". (There will be a vomiting forth of nerdiness which can be ignored if you're not working on your nerd first-class badge). You may need to enter "yes" more than once depending on the remote device.
Code:
[bluetooth]#
[bluetooth]#
[CHG] Device DC:44:B6:XX:XX:XX Connected: yes
Request confirmation
[agent] Confirm passkey 669154 (yes/no): yes
[CHG] Device DC:44:B6:XX:XX:XXConnected: no
[bluetooth]#
[CHG] Device DC:44:B6:XX:XX:XXConnected: yes
Request confirmation
[agent] Confirm passkey 375049 (yes/no): yes
[Galaxy S8+]# trust DC:44:B6:XX:XX:XX
Changing DC:44:B6:XX:XX:XX trust succeeded
[Galaxy S8+]# exit
That was a quick fix!
Thx!
Now I can enjoy my own music! (and no my neighbor's ahaha)