0

I'd like to use my Raspberry Pi Zero 2W as a Bluetooth headset to connect with my Android phone with an HSP profile. The speaker and microphone are connected via an external USB soundcard.

After following a few guides, nothing seems to be working for me. I have tried the process below with various versions of Pulseaudio and Ofono with no luck either. I'm running Raspberry Pi OS Bullseye.

Any advice would be greatly appreciated!

Followed Steps (reproducible error):

  1. Initial Setup of the Pi

    • Sudo raspi-config
    • Set localization settings
    • Enable and Setup Wifi
    • Enable SSH
  2. Make Speaker Default? : /lib/modprobe.d/aliases.conf and comment out the line options snd-usb-audio index=-2

    • sudo nano /lib/modprobe.d/aliases.conf
  3. Test Speaker:

    • aplay /usr/share/sounds/alsa/Front_Center.wav
  4. Install Ofono

    • sudo apt-get install pi-bluetooth ofono
  5. Change Ofono dbus policy:

    • sudo nano /etc/dbus-1/system.d/ofono.conf
    • change deny send_destination="org.ofono" to allow send_destination="org.ofono
  6. Install Git:

    • sudo apt-get install git
  7. Fetch Pulseaudio:

    • git clone git://anongit.freedesktop.org/pulseaudio/pulseaudio
  8. change src/modules/bluetooth/backend-native.c and src/modules/bluetooth/backend-ofono.c:

    • sudo nano on each
    • modified *imtu = xx; to *imtu = 60;
      • Done to ensure the HSP SCO is the same as android
  9. Install Pulseaudio Dependencies:

    • sudo apt-get build-dep pulseaudio
  10. Compile Pulseaudio:

    • meson build
    • ninja -C build
    • sudo ninja -C build install
    • sudo ldconfig
  11. Force HSP in Pulseaudio:

    • sudo nano /etc/pulse/default.pa
      • Add headset=ofono
      • .ifexists module-bluetooth-discover.so
        
         load-module module-bluetooth-discover headset=ofono
        
         .endif
        
  12. Connect Bluetooth:

    • bluetoothctl
    • power on
    • scan on
    • pair XX:XX:XX:XX:XX:XX
    • trust XX:XX:XX:XX:XX:XX
    • connect XX:XX:XX:XX:XX:XX
  13. Testing:

    • Called a number on the connected Android phone
    • The Raspberry Pi device's bluetooth status became 'active' on the phone
    • Bluetooth appeared as an option inside the call
    • When the Bluetooth menu option is selected, the app immediately reverts back to the phone's speaker

Note: This question from a few years ago had a different issue but the same goal: Pi as Bluetooth headset

4
  • If you do bluetoothctl show what profiles/UUIDs are shown as available on the RPi? The ArchLinux wiki is often a good source of advice: wiki.archlinux.org/title/Bluetooth_headset#Headset_via_Bluez5/…
    – ukBaz
    Commented Jun 10, 2023 at 6:32
  • Pulseaudio uses the system logger; you should check that for messages and errors. Also double check ldd (which pulseaudio).
    – goldilocks
    Commented Jun 10, 2023 at 14:49
  • nothing seems to be working for me ... are you saying that all 13 steps fail?
    – jsotola
    Commented Jun 10, 2023 at 17:52
  • 1
    Hi @ukBaz! The page you linked me to was very helpful and after a bit of testing I got my audio to work via Pipewire. Not only does the final result work, but it is also much easier to setup than Pulseaudio!
    – Matt B
    Commented Jun 11, 2023 at 18:13

1 Answer 1

1

For anyone else having the same issue, I solved it by replacing both Pulseaudio and Ofono with Pipewire. Thank you to @ukBaz for the link. The exact steps I took are below:

Replacement for steps 4-11 above:

  1. Install Pipewire:
  2. Reboot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.