Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
bluetooth telephony HFP profile using bluez5/pulseaudio5
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 267

PostPosted: Fri Jan 29, 2021 4:12 pm    Post subject: Reply with quote

equaeghe wrote:
devsk wrote:
So, what is the state here? Can we get the mic on the bluetooth headsets working in Linux or not?

I haven't succeeded yet. The fiddling with phonesim/ofono does make the headset bluetooth profiles better detected, but successfully activating them is not something I've managed to do. There are reports here and there of other people that have succeeded with their headset. I still think it is in principle possible, but that just we haven't gathered all the necessary pieces to make it work.


Already tried this secret sauce after making sure ofono has phonesim in conf and both ofonod and phonesim running?

Code:
dbus-send --print-reply --system --dest=org.ofono /phonesim org.ofono.Modem.SetProperty string:"Powered" variant:boolean:true
Back to top
View user's profile Send private message
rburcham
Apprentice
Apprentice


Joined: 20 Mar 2003
Posts: 249

PostPosted: Tue Feb 09, 2021 2:09 am    Post subject: Reply with quote

Etal wrote:

# wget https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/288.patch -O /etc/portage/patches/media-sound/pulseaudio/hsphfp.patch


You were lucky to get the patch while you could @Etal. It seems the kids couldn't play nice on github and Pali took his ball and went home. You wouldn't happen to still have that patch handy would you? Did anyone get and preserve the patch? I would love to try it.
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 267

PostPosted: Tue Feb 09, 2021 6:02 am    Post subject: Reply with quote

Please try this instead https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491
Back to top
View user's profile Send private message
rburcham
Apprentice
Apprentice


Joined: 20 Mar 2003
Posts: 249

PostPosted: Tue Feb 09, 2021 7:00 pm    Post subject: Reply with quote

garrison wrote:
Please try this instead https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/491


I've pulled that patch and applied it to stock pulseaudio. I've managed to build it and install. Now I am attempting to compile and configure ofono/phonesim, which I believe is still required? I'll pull a 9999 ebuild from this thread and build it, but it's unclear how and when to run it, and even if this is the right thing to be doing overall. I'm really not a fan of the ofono & phonesim solution approach. It really seems super hacky, and may not even provide the quality we want after all?

I'll see what I can get out of this thread and the 491 patch.
Back to top
View user's profile Send private message
rburcham
Apprentice
Apprentice


Joined: 20 Mar 2003
Posts: 249

PostPosted: Wed Feb 10, 2021 1:08 am    Post subject: Reply with quote

I got the patched pulseaudio working with ofono/phonesim. I have Airpods 1, and they come up A2DP. I can manually pavucontrol them over to HFP and they "work" in zoom/teams/etc. I'm sure with a little more effort I can set up a trigger for pacmd to automatically flip them to HFP.

But either way after about 5 minutes the audio starts getting choppy and riddled with artifacts. We'll let this bake for a while I think.
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


Joined: 24 Oct 2003
Posts: 3003
Location: Bay Area, CA

PostPosted: Wed Feb 10, 2021 2:51 am    Post subject: Reply with quote

Why is this ofono business needed? Isn't pulseaudio already a service, a daemon running in the background? Why do we need another daemon just to support a different audio profile?
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1932

PostPosted: Wed Feb 10, 2021 3:18 am    Post subject: Reply with quote

rburcham wrote:
Etal wrote:

# wget https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/288.patch -O /etc/portage/patches/media-sound/pulseaudio/hsphfp.patch


You were lucky to get the patch while you could @Etal. It seems the kids couldn't play nice on github and Pali took his ball and went home. You wouldn't happen to still have that patch handy would you? Did anyone get and preserve the patch? I would love to try it.


Yikes :(

Yep, I have the patch:
/etc/portage/patches/media-sound/pulseaudio/hsphfp.patch : https://pastebin.ubuntu.com/p/bhCBMkFpQz/

Here's the hsphfpd revision I'm using. It's still up.

Code:
/var/cache/distfiles/git3-src/pali_hsphfpd-prototype.git $ git log -1
commit 601bf8f7bf2da97257aa6f786ec4cbb69b0ecbc8
Author: pali <7141871+pali@users.noreply.github.com>
Date:   Sun Oct 25 13:13:16 2020 +0100

    add checks for registering DBus and SCO socket
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 267

PostPosted: Wed Feb 10, 2021 6:24 am    Post subject: Reply with quote

rburcham wrote:
I got the patched pulseaudio working with ofono/phonesim. I have Airpods 1, and they come up A2DP. I can manually pavucontrol them over to HFP and they "work" in zoom/teams/etc. I'm sure with a little more effort I can set up a trigger for pacmd to automatically flip them to HFP.

But either way after about 5 minutes the audio starts getting choppy and riddled with artifacts. We'll let this bake for a while I think.


With that 491 change you do not need oFono/phonesim, as pa would implement HFP HF natively, so do *not* use 'headset=ofono' option to module-bluetooth-discover as well and probably make sure you stopped oFono before testing it.

Please provide feedback in that merge request, as I do not get notifications from forum posts here for some reason. I'm trying to push for that to be merged sooner so we can get a stub at wideband speech.

Fwiw I have both oFono and native HFP HF working without issues here, but making oFono work is not for the faint in the heart, which was primary motivation for that 491 change.
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 267

PostPosted: Wed Feb 10, 2021 6:31 am    Post subject: Reply with quote

devsk wrote:
Why is this ofono business needed? Isn't pulseaudio already a service, a daemon running in the background? Why do we need another daemon just to support a different audio profile?

This is due to how bluetooth machinery is implemented, you get bluez daemon handling basic stuff, and then it hands over headset profile connection handling to whatever agent is registered with bluetoothd for that. It used to be only oFono registering for HFP HF profile handling so you had to use that if your headset does not support the less featured headset HSP HS profile. Then comes work on hsphfpd which is really a replacement for oFono machinery + more usability changes, and now there is also an option for pulseaudio to register for HFP HF handling natively with that 491 change.

Check your (connected) headset with 'bluetoothctl info' - if you do not see UUID: Headset (00001108-...) then you cannot use original pulseaudio native backend for HSP HS; in this case you probably have UUID: Handsfree (0000111e-...) which is HFP HF and the above applies.
Back to top
View user's profile Send private message
rburcham
Apprentice
Apprentice


Joined: 20 Mar 2003
Posts: 249

PostPosted: Wed Feb 10, 2021 3:37 pm    Post subject: Reply with quote

garrison wrote:
rburcham wrote:
I got the patched pulseaudio working with ofono/phonesim. I have Airpods 1, and they come up A2DP. I can manually pavucontrol them over to HFP and they "work" in zoom/teams/etc. I'm sure with a little more effort I can set up a trigger for pacmd to automatically flip them to HFP.

But either way after about 5 minutes the audio starts getting choppy and riddled with artifacts. We'll let this bake for a while I think.


With that 491 change you do not need oFono/phonesim, as pa would implement HFP HF natively, so do *not* use 'headset=ofono' option to module-bluetooth-discover as well and probably make sure you stopped oFono before testing it.

Please provide feedback in that merge request, as I do not get notifications from forum posts here for some reason. I'm trying to push for that to be merged sooner so we can get a stub at wideband speech.

Fwiw I have both oFono and native HFP HF working without issues here, but making oFono work is not for the faint in the heart, which was primary motivation for that 491 change.


@garrison I got that impression (use native-headset, it will be default so use auto) from the patch thread, and I have built pulseaudio that way. My load-module:

Code:
load-module module-bluetooth-discover headset=auto enable_native_hfp_hf=true


With this config, pavucontrol marked HFP as "unavailable" and I got an error in /var/log/messages when I selected it. Confused, I set up ofono/phonesim and restarted pulseaudio. Then pavucontrol no longer showed HFP as unavailable. Selecting it, I got good tone and levels in zoom/etc. No autoswitching though. And after a few minutes the audio quality becomes horribly chopped and artifact laden.

So I'd welcome pointers on how to get HFP with native only (no ofono/phonesim), and autoswitching too :)
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 267

PostPosted: Wed Feb 10, 2021 3:59 pm    Post subject: Reply with quote

rburcham wrote:

Code:
load-module module-bluetooth-discover headset=auto enable_native_hfp_hf=true


With this config, pavucontrol marked HFP as "unavailable" and I got an error in /var/log/messages when I selected it. Confused, I set up ofono/phonesim and restarted pulseaudio. Then pavucontrol no longer showed HFP as unavailable. Selecting it, I got good tone and levels in zoom/etc. No autoswitching though. And after a few minutes the audio quality becomes horribly chopped and artifact laden.

So I'd welcome pointers on how to get HFP with native only (no ofono/phonesim), and autoswitching too :)


Alright, so in case headset=auto you get the behavior you see if ofonod was running but not configured for phonesim or just without phonesim, so like running but not actually working.

If you configure pa like this, i.e. omit the params:
Code:
load-module module-bluetooth-discover

it should use the default (which would be headset=native) and show HFP available, and otherwise behave automagically working.
If it does not, stop ofonod and try again as ofonod might have registered with bluetoothd in your previous run and is just sitting there and preventing magic from doing it's stuff.
Back to top
View user's profile Send private message
rburcham
Apprentice
Apprentice


Joined: 20 Mar 2003
Posts: 249

PostPosted: Wed Feb 10, 2021 6:31 pm    Post subject: Reply with quote

garrison wrote:
rburcham wrote:

Code:
load-module module-bluetooth-discover headset=auto enable_native_hfp_hf=true

If it does not, stop ofonod and try again as ofonod might have registered with bluetoothd in your previous run and is just sitting there and preventing magic from doing it's stuff.


Ok I think this was it. I restarted bluetooth and (491-patched) pulseaudio, and yes, the Airpods 1 are driven natively without ofono/phonesim. I did not change my load-module line, so the default native behavior seems to be working. The configuration in pavucontrol no longer shows the HFP option with "unavailable". I can switch back and forth between A2DP and HFP using pavucontrol, even while actively playing audio through the device, and I can hear the change in quality.

Auto switching though, still not yet expected with this revision? I ask because there doesn't seem to be any event associated with it or facility for it.

I'll do more experimentation with zoom/etc to see if the choppy/artifact audio arises.


Last edited by rburcham on Wed Feb 10, 2021 8:07 pm; edited 1 time in total
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 267

PostPosted: Wed Feb 10, 2021 7:02 pm    Post subject: Reply with quote

rburcham wrote:

Auto switching though, still not yet expected with this revision? I ask because there doesn't seem to be any event associated with it or facility for it.

I'll do more experimentation with zoom/etc to see if the choppy/artifact audio arises.

I only have skype here and it does indeed automatically switch to HFP in a call and back out of call.

Zoom looks to be a bit problematic, not sure where is the root cause but starting point for more info on Zoom issue is here https://github.com/NixOS/nixpkgs/issues/80042
It may be that it does not pretend to be in call mode but that is yet to be investigated I guess, until that is ironed out can use pavucontrol to manually change bt profile.
Back to top
View user's profile Send private message
rburcham
Apprentice
Apprentice


Joined: 20 Mar 2003
Posts: 249

PostPosted: Wed Feb 10, 2021 8:12 pm    Post subject: Reply with quote

Did you really start using gentoo 1 day before me?

I read through the zoom thread (and researched some others) and I think you're right. They're passively reading device state and offering options in the UI based on that, rather than querying profile availability and asking for specific profiles. If you pavucontrol (or pacmd) a change to the device config then that is reflected in the zoom UI options.

Edit -

The horrible choppy audio and noise artifact problem does return. It only took a couple minutes. I suspect it might have something to do with a usb bus reset caused by a doc I have connected. The events seem to coincide, so it might just be me.
Back to top
View user's profile Send private message
nathanlkoch
Apprentice
Apprentice


Joined: 31 Jan 2021
Posts: 163
Location: Earth / Sol

PostPosted: Sat Feb 13, 2021 12:22 am    Post subject: Reply with quote

Similar issue. media-audio/pulseuadio bluetooth native-headset ofono... "failed to change profile to headset_head_unit"

https://imgur.com/7wteYQG.png

phonesim -p 12345 /usr/share/phonesim/default.xml load, apparently i built ofono with phonesim support but i don't have phonesim installed...?
Downloaded the git, How do i go about configuring it and make install?
Back to top
View user's profile Send private message
Dekan
n00b
n00b


Joined: 30 May 2002
Posts: 7

PostPosted: Sat Feb 13, 2021 6:47 pm    Post subject: Reply with quote

rburcham wrote:
The horrible choppy audio and noise artifact problem does return. It only took a couple minutes. I suspect it might have something to do with a usb bus reset caused by a doc I have connected. The events seem to coincide, so it might just be me.

Has anyone had issues with just getting the mic input to be picked up from a headset, even after successfully selecting HFP?

I have had success with my Airpods getting to the point I can select HFP, but pulseaudio/apps don't seem to be picking up any mic input. I've using the 491 patch, and have tried different options for load-module module-bluetooth-discover to no avail. I have no issues getting audio output, though, with the other audio profiles.
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 267

PostPosted: Sun Feb 14, 2021 5:58 am    Post subject: Reply with quote

Dekan wrote:
rburcham wrote:
The horrible choppy audio and noise artifact problem does return. It only took a couple minutes. I suspect it might have something to do with a usb bus reset caused by a doc I have connected. The events seem to coincide, so it might just be me.

Has anyone had issues with just getting the mic input to be picked up from a headset, even after successfully selecting HFP?

I have had success with my Airpods getting to the point I can select HFP, but pulseaudio/apps don't seem to be picking up any mic input. I've using the 491 patch, and have tried different options for load-module module-bluetooth-discover to no avail. I have no issues getting audio output, though, with the other audio profiles.

Do you have headset mic input indicating there is sound in pavucontrol "Input Devices" tab? Try changing volume there. As far as I can see Airpods support HFP HF profile so should work with default discovery settings; make sure before testing 491 change to stop ofono and restart bluetooth service, then start pulseaudio. It may be required to pair airpods again to update bluez cache.

There are reports that Airpods work with ofono backend, so if you are willing to debug this it may be worth joining #pulseaudio on freenode irc to have quick debug session with ofono and phonesim to see what is maybe happening differently with 491 change. I do not have airpods so cannot test it myself.
Back to top
View user's profile Send private message
genterminl
Guru
Guru


Joined: 12 Feb 2005
Posts: 527
Location: Connecticut, USA

PostPosted: Fri Feb 19, 2021 10:50 pm    Post subject: Reply with quote

Has there been any progress on this? I can compile phonesim from the 9999 ebuild referred to above, but running it just sits there, not doing anything detectable, and list-modems returns nothing.
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 267

PostPosted: Sat Feb 20, 2021 5:48 am    Post subject: Reply with quote

genterminl wrote:
Has there been any progress on this? I can compile phonesim from the 9999 ebuild referred to above, but running it just sits there, not doing anything detectable, and list-modems returns nothing.
try the dbus-send command from top of this page to make modem alive
Back to top
View user's profile Send private message
genterminl
Guru
Guru


Joined: 12 Feb 2005
Posts: 527
Location: Connecticut, USA

PostPosted: Sat Feb 20, 2021 4:36 pm    Post subject: Reply with quote

Didn't work. I'm not at that PC, so I don't have the exact error message, but I think you can't enable the modem until the modem exists, and for everything I've tried with phonesim, list-modems never shows one. I don't see any errors from phonesim, but no output or log entries to suggest it's actually doing anything.
Back to top
View user's profile Send private message
genterminl
Guru
Guru


Joined: 12 Feb 2005
Posts: 527
Location: Connecticut, USA

PostPosted: Sat Feb 20, 2021 9:42 pm    Post subject: Reply with quote

Error org.freedesktop.DBus.Error.UnknownObject: Method "SetProperty" with signature "sv" on interface "org.ofono.Modem" doesn't exist

Same whether I run phonesim and/or the dbus command as myself or as root. I don't know if it matters, but I'm currently pipewire instead of pulseaudio, but it doesn't seem to have made any particular difference. In fact, with pulse, I at least saw the HSP and HFP profiles present but unavailable in pavucontrol. Now, I only see A2DP with choice of codec. I feel like I'm missing something obvious, but it's just not obvious to me.
Back to top
View user's profile Send private message
garrison
Apprentice
Apprentice


Joined: 18 Mar 2003
Posts: 267

PostPosted: Sun Feb 21, 2021 2:08 pm    Post subject: Reply with quote

genterminl wrote:
Error org.freedesktop.DBus.Error.UnknownObject: Method "SetProperty" with signature "sv" on interface "org.ofono.Modem" doesn't exist

Same whether I run phonesim and/or the dbus command as myself or as root. I don't know if it matters, but I'm currently pipewire instead of pulseaudio, but it doesn't seem to have made any particular difference. In fact, with pulse, I at least saw the HSP and HFP profiles present but unavailable in pavucontrol. Now, I only see A2DP with choice of codec. I feel like I'm missing something obvious, but it's just not obvious to me.


Well many people find ofono configuration is not easy. I followed this and was able to test HFP works with oFono in the end https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/#headsetsetup
Back to top
View user's profile Send private message
genterminl
Guru
Guru


Joined: 12 Feb 2005
Posts: 527
Location: Connecticut, USA

PostPosted: Thu Feb 25, 2021 12:43 am    Post subject: Reply with quote

I did think I had followed those directions - it's certainly possible I messed something up. Finaly, after re-installing phonesim, I can create and enable a modem. (Is enabling one required? onlineing?) However, with or without phonesim/ofono, I still get the headset showing HSP and HFP unavailable in pavucontrol, and selecting either of them has no effect - the headphones continue to play with the A2DP profile, and the headphones still don't show up under Input Devices. This is with pulseaudio 14.2 with the patch listed earlier in this thread. I "think" I've restarted all the necessary services (openrc) in the right order, but I'm not sure what actually does need to be restarted for this to work.

EDIT: of course right after I post, I find things I seem to have missed. Don't bother replying to this until I fix them and update again. Sorry.
Back to top
View user's profile Send private message
nathanlkoch
Apprentice
Apprentice


Joined: 31 Jan 2021
Posts: 163
Location: Earth / Sol

PostPosted: Thu Feb 25, 2021 10:06 pm    Post subject: Reply with quote

How do I compile and install phonesim?
Back to top
View user's profile Send private message
genterminl
Guru
Guru


Joined: 12 Feb 2005
Posts: 527
Location: Connecticut, USA

PostPosted: Thu Feb 25, 2021 10:15 pm    Post subject: Reply with quote

Use the 9999 ebuild from this link
Chain wrote:
Edit 2: There exists an ebuild! Take a look at https://gpo.zugaina.org/net-misc/phonesim
on the first page of this topic. I dont think I had to make any changes, but I'm not home now to confirm that.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum