Moode Forum
Bluetooth - Paired but can't connect - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: Bluetooth - Paired but can't connect (/showthread.php?tid=3943)

Pages: 1 2 3 4 5


RE: Bluetooth - Paired but can't connect - daveozzz - 10-09-2021

(09-23-2021, 01:56 PM)TheOldPresbyope Wrote:
(09-23-2021, 09:29 AM)Hobbes Wrote: Hi!

I just wanted to add that I have the same problem.
RPi 4 (4GB) freshly set up with Moode 7.3.
Trying to connect from Pixel 3a. Pairing works, but it never connects.

Hopefully, I'll find some time to hack around this weekend.


You'll need to provide more information.

My Pixel 3a (up-to-date Android 11) connects without any issues. 

I did the following steps with a fresh install of moOde 7.3 and using the internal Bluetooth transceiver (this on an RPi3A which was handy but I've never seen any difference on a RPi4B).

In moOde's Audio Config screen

1) enabled Bluetooth renderer
2) enabled Pairing agent

On my Pixel 3a

1) settings -> Connected devices -> "+ Pair new device"
2) selected my moOde player Bluetooth renderer when it showed up
3) in the "Pair with..." popup, selected "Pair" without allowing access to contacts and call history.


Now in the Pixel 3a Connected devices screen I see my moOde player marked as Active under "MEDIA DEVICES". As well, the moOde UI now displays a "Bluetooth active: Pixel 3a"  overlay.

Code:
pi@moode73-3a:~ $ sudo /var/www/command/bt.sh -p
** Paired devices
**
** 58:CB:52:90:F0:74 Pixel 3a
**
pi@moode73-3a:~ $ sudo /var/www/command/bt.sh -c
** Connected devices
**
** 58:CB:52:90:F0:74 Pixel 3a
**

Regards,
Kent

I'd really like this to work reliably so had another go.
I "forgot" all devices from the BlueZ menu turned, off pairing agent, turned off bluetooth, and "forgot" Moode Audio device on my phone (Mi A2)

Then I followed the 5 steps you describe... and it worked perfectly... great.

But, I don't keep my Pi4 powered on all the time, so after a period of it being turned off, I powered on and tried to connect to Moode Audio again from the phone... now back to the phone just ignoring me - it shows connected on the phone for a moment then drops off the Connected list.

The syslog is showing the following entries when this is happening:

Oct  9 15:09:37 moode bluetoothd[2073]: Authentication attempt without agent
Oct  9 15:09:37 moode bluetoothd[2073]: Access denied: org.bluez.Error.Rejected

If anyone can describe the additional information that would help, I'll try to get it.

If I stop the Bluetooth Controller, then manually start it and the pairing agent again, the phone will let me repair and it works again. Needless to say, it's a bit of a faff...


RE: Bluetooth - Paired but can't connect - TheOldPresbyope - 10-09-2021

@daveozzz

Sorry, I can't repro your experience. I can re-establish the Bluetooth connection from my Pixel 3A without issue when I powercycle my moOde player.

One curious thing is the error message

Code:
Oct  9 15:09:37 moode bluetoothd[2073]: Authentication attempt without agent

You could try making bluetoothd "trust" your phone. Something like

Code:
pi@moode:~$ sudo bluetoothctl
[bluetooth] trust xx.xx.xx.xx
[bluetooth] exit

where xx.xx.xx.xx is the MAC address of your phone's bluetooth controller.

Note that this is not necessary for my Pixel 3A. I have no non-Google Android devices to test with.

Regards,
Kent


RE: Bluetooth - Paired but can't connect - daveozzz - 10-09-2021

Thanks Kent,

Doing what you suggested (trust xx:xx:xx:xx:xx) worked a couple of times but was fairly flaky after a restart.

I think this is possibly quite a low-level problem with pi4's bluetooth controller as discussed in this thread: 
https://forums.raspberrypi.com/viewtopic.php?t=306920

Certainly it appears for me that after startup, I can't connect. If I do a further "systemctl restart bluetooth", the Controller MAC address changes ("sudo bluetoothctl" then "show"), then I can connect from the phone again.

I haven't had time to properly digest the raspberrypi thread (and possible fixes therein) yet but thought I'd post here in case anyone else wants a look.

Cheers again for the help


RE: Bluetooth - Paired but can't connect - Tim Curtis - 10-09-2021

This symptom below suggests breakage in your image because the controller MAC address should never change after its initially assigned when bluetooth is first started.

Code:
"If I do a further "systemctl restart bluetooth", the Controller MAC address changes"

Try a fresh r741 image and remember to leave the pairing agent on.


RE: Bluetooth - Paired but can't connect - TheOldPresbyope - 10-09-2021

IIR there was mention of a similar change in reported MAC address in the referenced thread but to me that thread looks a lot like the proverbial blind men feeling the elephant. 

[As an aside, various posts in that thread mention "pi400", "pulseaudio", and connecting to speakers/headphones, none of which seem relevant to the issue here.]

What stood out for me in the referenced thread was the reply in May from jamesh (a long-time RPF engineer) "We have had a few reports on this, but have not been able to replicate in house."

That's the same situation I'm in. I've now tried all the mobile devices I have at hand: Google Pixel 3A phone, Apple iPhone SE, Apple iPad 9.7, even <gasp> a Facebook Portal, and all work as I expect them to against the moOde 7.4.1 BT Renderer on an RPi4B.

At this point there's not enough actionable information for me to want to seek out other BT sources.

Good hunting.

Regards,
Kent


RE: Bluetooth - Paired but can't connect - Tim Curtis - 10-09-2021

Right but the controller MAC should not change and if it does then things won't work.


RE: Bluetooth - Paired but can't connect - daveozzz - 10-10-2021

Quote:Update: I tried upgrading the pi-bluetooth package to 0.1.18 ("apt-get update; apt-get install pi-bluetooth". That changed things. The MAC address appears stable now. But I still could not connect from the phone initially. I *could* however connect from bluethoothctl using the "connect xx:xx:xx:xx:xx" command though... and after I did that the first time, I could subsequently connect and reconnect from the phone even after Pi reboots... so it's better.
Not sure if the upgrade will cause me other problems though. Will report back.


I started again from a new image... appears to have the same problem. Initial controller MAC address changes after a bluetooth restart.
Slightly abridged transcript below starting from an initial boot...

I suppose I could trigger an additional bluetooth restart at the end of the boot process but that seems a bit hacky.

Code:
$ ssh pi@192.168.178.42
pi@192.168.178.42's password:
RaspiOS 10.6 | 5.4.77-v7l+ #1371 | armv7l (32-bit)
Hardware: Pi-4B 1.4 2GB

                     ____     __        ____
         __ _  ___  / __ \___/ /__     /_  /
        /  ' \/ _ \/ /_/ / _  / -_)     / /
       /_/_/_/\___/\____/\_,_/\__/     /_/

                moOde audio player
             Release 7.4.1 2021-10-02
               (C) 2014 Tim Curtis


The programs included with moOde are free software; the
exact distribution terms for each program are described
in the individual files in /usr/share/doc/*/copyright.
Moode comes with absolutely no warranties expressed or
implied, or any other guarantees.

Last login: Sun Oct 10 11:49:50 2021 from 192.168.178.31
pi@moode:~ $ sudo bluetoothctl
Agent registered
[CHG] Controller E4:5F:01:16:C7:B3 Powered: yes
[CHG] Controller E4:5F:01:16:C7:B3 Alias: Moode Bluetooth
[CHG] Controller E4:5F:01:16:C7:B3 Pairable: yes
[CHG] Controller E4:5F:01:16:C7:B3 Discoverable: yes
[CHG] Controller E4:5F:01:16:C7:B3 Powered: no
[CHG] Controller E4:5F:01:16:C7:B3 Discovering: no
[CHG] Controller E4:5F:01:16:C7:B3 Powered: yes
[CHG] Controller E4:5F:01:16:C7:B3 Powered: no
[CHG] Controller E4:5F:01:16:C7:B3 Discovering: no
[CHG] Controller E4:5F:01:16:C7:B3 Powered: yes
[bluetooth]# show
Controller E4:5F:01:16:C7:B3 (public)
       Name: Moode Bluetooth
       Alias: Moode Bluetooth
       Class: 0x000c041c
       Powered: yes
       Discoverable: yes
       Pairable: yes
       UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
       UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
       UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
       UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
       UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
       Modalias: usb:v1D6Bp0246d0532
       Discovering: no
[CHG] Device 48:2C:A0:1C:67:3A Connected: yes
[CHG] Device 48:2C:A0:1C:67:3A Connected: no

<<<<attempted to pair from phone and failed at this point>>>>

[bluetooth]# exit
pi@moode:~ $ sudo systemctl restart bluetooth
pi@moode:~ $ sudo bluetoothctl
Agent registered
[bluetooth]# show
Controller B8:27:EB:D6:E3:FA (public)
       Name: Moode Bluetooth
       Alias: Moode Bluetooth
       Class: 0x000c041c
       Powered: yes
       Discoverable: yes
       Pairable: yes
       UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
       UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
       UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
       UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
       UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
       Modalias: usb:v1D6Bp0246d0532
       Discovering: no
[CHG] Device 48:2C:A0:1C:67:3A Connected: yes

<<<<Connected successfully from phone here>>>>



RE: Bluetooth - Paired but can't connect - Tim Curtis - 10-10-2021

I'm not able to repro "Initial controller MAC address changes after a bluetooth restart."

Starting with a fresh 741 image and after turning Bluetooth ON in Audio Config the controller is assigned the MAC address B8:27:EB:3A:14:F1 as shown below which remains after reboot, power off/on or Restart Bluetooth from Audio Config.

Code:
pi@moode:~ $ sudo ls -l /var/lib/bluetooth
total 4
drwx------ 2 root root 4096 Oct 10 10:45 B8:27:EB:3A:14:F1
pi@moode:~ $ hciconfig
hci0:   Type: Primary  Bus: UART
        BD Address: B8:27:EB:3A:14:F1  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING PSCAN ISCAN 
        RX bytes:2440 acl:0 sco:0 events:158 errors:0
        TX bytes:5685 acl:0 sco:0 commands:158 errors:0

pi@moode:~ $ sudo bluetoothctl
Agent registered
[bluetooth]# show
Controller B8:27:EB:3A:14:F1 (public)



RE: Bluetooth - Paired but can't connect - TheOldPresbyope - 10-10-2021

I think it’s time to move this issue to somewhere in the Raspberry Pi Forum. Whatever is happening is taking place in the hardware/firmware/OS layers and should be solved there.

Just my two cents worth.

Regards,
Kent


RE: Bluetooth - Paired but can't connect - daveozzz - 10-10-2021

Quote:I think it’s time to move this issue to somewhere in the Raspberry Pi Forum. Whatever is happening is taking place in the hardware/firmware/OS layers and should be solved there.

Yes I've got that.

I suspect there may be little traction on diagnosing a problem which appears to be fixed a later version of pi-bluetooth though.
Some unlucky interaction between the pi-bluetooth version 0.1.15 that ships with Moode audio and certain models of Pi4.