Enable HFP client on Android

Hello,

I’ve followed the guideline here to edit config.xml in /packages/apps/Bluetooth/res/values and mixer_paths_sbc.xml in \device\qcom\msm8916_32 to enable HFP client support in Android L (branch 1.2.4). The build completed without any error and I can flash the board and boot to the new system. However, I couldn’t find a way to test the new setup.

The BTTestApp doesn’t list the HFP (HF) profile and by the way only the PSE profile works with my iPhone. I’ve also tried to build the HFPClient available on Github but it is also missed the HFP (HF) profile. So, I would greatly appreciate if someone can help me with this issue.

Thanks,
Nuntipat

@nuntipat

Following steps will help you to enable HFP client on Android

Enabling HFP_client:

1: adb root
2: adb remount
3: adb shell
4: setprop persist.service.bt.hfp.client true
5: getprop persist.service.bt.hfp.client (this should return true now)
6: turn OFF/ON bt once.

Thank you for the information. I’ve followed the steps and everything works e.g. I can receive a call and the audio seems to be routed to the board as the phone speaker becomes silence. However, there is no sound coming out of the headphone jack on the Audio Mezzanine board or my HDMI monitor’s internal speaker.

I’ve edited mixer_path_sbc.xml according to the suggestion from @ljking in this post. However, I’ve added one XML closing tag on the line commented as it seems to be missing. Do you have any idea about what may cause this issue? Thank you.

<path name="hfp-sco">
        <ctl name="QUAT_MI2S_RX Port Mixer INTERNAL_BT_SCO_TX" value="1" />
        <ctl name="INTERNAL_BT_SCO_RX Audio Mixer MultiMedia6" value="1" />
        <ctl name="MultiMedia6 Mixer TERT_MI2S_TX" value="1" />
        <ctl name="HFP_INT_UL_HL Switch" value="1" />
        <ctl name="QUAT_MI2S_RX_DL_HL Switch" value="1" /> 
</path>   <!-- This line seems to be missing in the original post -->
<path name="hfp-sco-wb">
        <ctl name="Internal BTSCO SampleRate" value="16000" />
        <path name="hfp-sco" />
</path>

@nuntipat

please follow below steps and let me know the results.

  1. integrate below changes
  2. check volume on the board , some times volume reduced to zero . after performing the use case increase the volume by pressing volume up button

in mixers_path_sbc.xml and platfrom id :- #define HFP_PCM_RX 25 in hardware/qcom/audio/hal/msm8916/plafortform.h

Sorry for the late reply. It takes me few days as the system won’t boot after performed those edits so I need to compile the whole thing again.

On the other hand, after follow all the steps suggested again, the other side can now hear me from the headset microphone but I still can’t hear the other side through my headset or the speaker on my HDMI display. However, if I play some music from my phone (after execute setprop persist.service.bt.a2dp.sink true), I can hear the music through my headset.

Do you have any idea what could I try? Thank you again for your help.

Did you check the volume ?, sometimes it will be zero

Thank you for your suggestion, I’ve checked the volume and it has been set to the maximum value.

can you please share me serial log and logcat log

Here are the serial log and logcat log

Additional log from logcat when receiving the call (after restarting the board)

Another log from logcat when initiate the call (after restarting the board another time)

Currently, I can speak to the other side through the headset connect to the dragon board but I couldn’t hear the other side from the same headset. The other side can hear my voice and also the echo of their voice when they speak which they shouldn’t be. The headset is working correctly as I can listen to music stream to the board via Bluetooth. I believe that there are some problems with my audio routing. Do you have any idea how should I proceed? Thank you.

please try below mixer settings
To play audio through stereo connector, at adb shell prompt you need to enter the below commands:

tinymix ‘PRI_MI2S_RX Audio Mixer MultiMedia1’ 1
tinymix ‘RX1 MIX1 INP1’ ‘RX1’
tinymix ‘RX2 MIX1 INP1’ ‘RX2’
tinymix ‘RDAC2 MUX’ ‘RX2’
tinymix ‘HPHL’ ‘Switch’
tinymix ‘HPHR’ ‘Switch’
tinymix ‘MI2S_RX Channels’ ‘Two’
tinyplay /data/test.wav

Thank you very much for you help. I have tried the commands above but tinyplay seems to fail for every wave file I have. However, I can listen to music stream from my phone but I still can’t hear the other side.

Can you tell me sir your problem is solved or not if yes please can you share source code and medium where you learn hfp