Hi @robple11 , on multimedia bsp, you can use bluez-alsa instead of pulseaudio to make BT HFP work. The bluez-alsa recipe from Yocto Project needs to be replaced by this one. After the new image is built and installed, add bluealsa policy to /etc/dbus-1/system.d/bluetooth.conf
on the device.
<busconfig>
...
<policy user="bluealsa">
<allow send_destination="org.bluez"/>
</policy>
</busconfig>
Modify /lib/systemd/system/bluez-alsa.service
and reboot.
[Service]
Type=simple
-ExecStart=/usr/bin/bluealsa
+ExecStart=/usr/bin/bluealsa -p hfp-ofono -p a2dp-sink -p a2dp-source
[Install]
WantedBy=multi-user.target
check if the bluetooth device is either hardware or software blocked:
# rfkill list
0: phy0: Wireless LAN
Soft blocked: yes
Hard blocked: no
1: hci0: Bluetooth
Soft blocked: yes
Hard blocked: no
If it is, unblock it.
# rfkill unblock 1
# rfkill list
0: phy0: Wireless LAN
Soft blocked: yes
Hard blocked: no
1: hci0: Bluetooth
Soft blocked: no
Hard blocked: no
Use bluetoothctl
to discover and connect the Bluetooth device by its MAC address.
# bluetoothctl
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# scan on
Discovery started
[CHG] Controller 00:E9:3A:D6:4F:30 Discovering: yes
[bluetooth]# devices
[NEW] Device F4:4E:FD:DE:4A:59 XMFHZ02
[bluetooth]# connect F4:4E:FD:DE:4A:59
Attempting to connect to F4:4E:FD:DE:4A:59
[CHG] Device F4:4E:FD:DE:4A:59 Connected: yes
[CHG] Device F4:4E:FD:DE:4A:59 UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device F4:4E:FD:DE:4A:59 UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device F4:4E:FD:DE:4A:59 UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device F4:4E:FD:DE:4A:59 UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device F4:4E:FD:DE:4A:59 ServicesResolved: yes
Request confirmation
[agent] Confirm passkey 220288 (yes/no): yes
[CHG] Device F4:4E:FD:DE:4A:59 Paired: yes
Connection successful
[XMFHZ02]# exit
Now you will find the audio device and play the sound file.
# bluealsa-aplay -L
bluealsa:SRV=org.bluealsa,DEV=F4:4E:FD:DE:4A:59,PROFILE=a2dp
XMFHZ02, audio-card, playback
A2DP (SBC): S16_LE 2 channels 48000 Hz
# aplay -D bluealsa:SRV=org.bluealsa,DEV=F4:4E:FD:DE:4A:59,PROFILE=a2dp ~/sound/Gong.
If you would like to loop devices, alsaloop
is the tool. This is the example.