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):
Initial Setup of the Pi
- Sudo raspi-config
- Set localization settings
- Enable and Setup Wifi
- Enable SSH
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
Test Speaker:
aplay /usr/share/sounds/alsa/Front_Center.wav
Install Ofono
sudo apt-get install pi-bluetooth ofono
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
Install Git:
sudo apt-get install git
Fetch Pulseaudio:
git clone git://anongit.freedesktop.org/pulseaudio/pulseaudio
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
Install Pulseaudio Dependencies:
sudo apt-get build-dep pulseaudio
Compile Pulseaudio:
meson build
ninja -C build
sudo ninja -C build install
sudo ldconfig
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
- Add
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
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