hifiberry-os icon indicating copy to clipboard operation
hifiberry-os copied to clipboard

Bluetooth: after unpairing a device, I cannot pair it again

Open pmts opened this issue 1 year ago • 7 comments

Describe the bug The first time I connect my phone to Hifiberry via bluetooth, it works correctly. However, if I remove the pair on my phone and try to pair it again, this results in the following error: "Failed to connect to HiFiBerry. The PIN or pair code is incorrect". The only way I found to restore that phone's ability to connect to the Hifiberry is to ssh to it and use the bluetoothctl command to manually remove the device:

# bluetoothctl
Agent registered
[bluetooth]# remove C8:9B:D7:08:0F:6C
[DEL] Device C8:9B:D7:08:0F:6C realme 9 Pro+
Device has been removed
[bluetooth]#

After this, I can pair my device again, but only once.

I reproduced this behaviour on 2 different android phones (Realme and Xiaomi) and on Windows 10, so it's not device dependent.

HiFiBerryOS version 20230404

HiFiBerry sound card DAC + DSP

To Reproduce

  1. Enable bluetooth and start pairing on Hifiberry
  2. Pair a device
  3. Unpair the device
  4. Try to pair the same device again
  5. The pairing fails

Expected behavior The device pairs succesfully

Browser (if applicable)

Additional context

pmts avatar Dec 29 '23 14:12 pmts

I have experienced a similar issue with the 20230404 release on a Raspberry Pi4 with DAC2 Pro.

In addition, when attempting to connect via my Intel Macbook Pro laptop, it asks for a pin code.

jonathanota avatar Jan 04 '24 23:01 jonathanota

I have the same issue with my Raspberry Pi4, I'm pretty sure this problem exists on every device and this needs to be addressed. Until then there is a temporary solution:

  1. connect to your Raspberry Pi via ssh
  2. find all paired bluetooth devices with bluetoothctl paired-devices and copy the MAC-Adress of the device you are trying to reconnect.
  3. remove this device with bluetoothctl remove XX:XX:XX:XX:XX:XX (replace the X's with your actual MAC-Adress)
  4. restart the bluetooth service service bluetooth restart (it shouldn't be necessary but won't hurt)

Weidav avatar Mar 18 '24 16:03 Weidav

@Weidav Thank you for your workaround.

While we will be looking into some way to address this, this is not very high on our priority list. If somebody wants to look into this, we're happy to integrate contributions.

hifiberry avatar Mar 19 '24 09:03 hifiberry

I'd like to look into this and see how far I can get. The contribution guidelines link here isn't working. Are there any guidelines I need to have a look at?

Weidav avatar Mar 21 '24 09:03 Weidav

We're talking about a contribution to the GUI code - right?

In this case, base it on the "development" branch of https://github.com/hifiberry/create

hifiberry avatar Mar 21 '24 09:03 hifiberry

Yes, I think a component that displays the content from my workaround should do the job.

Weidav avatar Mar 21 '24 10:03 Weidav

The discussion on https://support.hifiberry.com/hc/en-us/community/posts/4410009712657-Cannot-connect-Bluetooth-to-hifiberryOS sounds related...

RavanH avatar Jul 08 '24 00:07 RavanH