[v5,2/4] bluetooth: separate HSP and HFP

Submitted by Rodrigo Araujo on Sept. 23, 2017, 10:33 p.m.

Details

Message ID 9ef45143-6230-fb84-d4ae-5d037f35c68a@gmail.com
State New
Headers show
Series "use bluetooth HFP in pulseaudio native backend when available" ( rev: 2 ) in PulseAudio

Not browsing as part of any series.

Commit Message

Rodrigo Araujo Sept. 23, 2017, 10:33 p.m.
Hi.

First, just to say that your patches are going great. Finally I can use
the microphone of my HFP only headset (a version of a Bluedio T2+).

So far, I've only encontered one problem: the auto_switch option of
module_bluetooth_policy stops working. Dug through the code and I think
you missed a few spots were you have to hangle the new headset_handsfree
profile in module_bluetooth_policy.c

Applying the following after applying your v5 patches fixed the issue
for me, now when I start making a VOIP call the profile switches to
headset_handsfree and the mic works automatically, and when the call
finishes it reverts back to a2dp.

Thanks and best regards.

Patch hide | download patch | download mbox

--- a/src/modules/bluetooth/module-bluetooth-policy.c	2017-09-23 23:04:49.543369180 +0100
+++ b/src/modules/bluetooth/module-bluetooth-policy.c	2017-09-23 23:04:58.039286751 +0100
@@ -160,7 +160,7 @@ 
             if (!pa_streq(profile->name, "a2dp") && !pa_streq(profile->name, "a2dp_sink"))
                 continue;
         } else {
-            if (!pa_streq(profile->name, "hsp") && !pa_streq(profile->name, "headset_head_unit"))
+            if (!pa_streq(profile->name, "hsp") && !pa_streq(profile->name, "headset_head_unit") && !pa_streq(profile->name, "headset_handsfree"))
                 continue;
         }
 
@@ -195,7 +195,7 @@ 
             return;
 
         /* Skip card if does not have active hsp profile */
-        if (!pa_streq(card->active_profile->name, "hsp") && !pa_streq(card->active_profile->name, "headset_head_unit"))
+        if (!pa_streq(card->active_profile->name, "hsp") && !pa_streq(card->active_profile->name, "headset_head_unit") && !pa_streq(card->active_profile->name, "headset_handsfree"))
             return;
 
         /* Skip card if already has active a2dp profile */
@@ -207,7 +207,7 @@ 
             return;
 
         /* Skip card if already has active hsp profile */
-        if (pa_streq(card->active_profile->name, "hsp") || pa_streq(card->active_profile->name, "headset_head_unit"))
+        if (pa_streq(card->active_profile->name, "hsp") || pa_streq(card->active_profile->name, "headset_head_unit") || pa_streq(card->active_profile->name, "headset_handsfree"))
             return;
     }
 

Comments

On Sat, 2017-09-23 at 23:33 +0100, Rodrigo Araujo wrote:
> Hi.
> 
> First, just to say that your patches are going great. Finally I can
> use
> the microphone of my HFP only headset (a version of a Bluedio T2+).
> 
> So far, I've only encontered one problem: the auto_switch option of
> module_bluetooth_policy stops working. Dug through the code and I
> think
> you missed a few spots were you have to hangle the new
> headset_handsfree
> profile in module_bluetooth_policy.c
> 
> Applying the following after applying your v5 patches fixed the issue
> for me, now when I start making a VOIP call the profile switches to
> headset_handsfree and the mic works automatically, and when the call
> finishes it reverts back to a2dp.

That's great, thanks!  Sad to say I didn't think automatic profile
switching worked in pulseaudio, so I hadn't thought to investigate it.
Did you want me to merge this into patch 2 or add it as a new patch
with you as the author?

James
Hi.

On 09/25/2017 02:37 PM, James Bottomley wrote:
> On Sat, 2017-09-23 at 23:33 +0100, Rodrigo Araujo wrote:
>> Hi.
>>
>> First, just to say that your patches are going great. Finally I can
>> use
>> the microphone of my HFP only headset (a version of a Bluedio T2+).
>>
>> So far, I've only encontered one problem: the auto_switch option of
>> module_bluetooth_policy stops working. Dug through the code and I
>> think
>> you missed a few spots were you have to hangle the new
>> headset_handsfree
>> profile in module_bluetooth_policy.c
>>
>> Applying the following after applying your v5 patches fixed the issue
>> for me, now when I start making a VOIP call the profile switches to
>> headset_handsfree and the mic works automatically, and when the call
>> finishes it reverts back to a2dp.
> That's great, thanks!  Sad to say I didn't think automatic profile
> switching worked in pulseaudio, so I hadn't thought to investigate it.
> Did you want me to merge this into patch 2 or add it as a new patch
> with you as the author?
>
> James

Seems to me it makes sense to merge into patch 2. Would simplify things
also, too many patches and lots of work for you guys already ;)

If you want to mention my name as contributor in that patch, also go
ahead :)

Best regards.