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

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
luciano
Tux's lil' helper
Tux's lil' helper


Joined: 18 Nov 2004
Posts: 130

PostPosted: Sun Apr 13, 2014 12:16 pm    Post subject: bluetooth telephony HFP profile using bluez5/pulseaudio5 Reply with quote

Since upgrading to bluez5/pulseaudio5, I no longer have a 'telephony' profile for my bluetooth headset, and am unable to use it as a mic to speak via skype.

This page explains that HFP support was dropped from bluez5, and mentions ofono as a way to get this working:
http://www.freedesktop.org/wiki/Software/PulseAudio/Notes/5.0/

I tried installing ofono and turning it on, but doesn't seem to make any difference. Anybody know how to get this fixed (short of downgrading to bluez4, as the page suggests?)
Back to top
View user's profile Send private message
luciano
Tux's lil' helper
Tux's lil' helper


Joined: 18 Nov 2004
Posts: 130

PostPosted: Fri Apr 18, 2014 9:44 am    Post subject: Reply with quote

Am I really the only one who uses bluetooth for video-conferencing ... ?
Back to top
View user's profile Send private message
luciano
Tux's lil' helper
Tux's lil' helper


Joined: 18 Nov 2004
Posts: 130

PostPosted: Sun Aug 03, 2014 12:35 pm    Post subject: Reply with quote

This has been raised, and is currently under development:

https://bugs.freedesktop.org/show_bug.cgi?id=73325
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1405
Location: Montréal

PostPosted: Sun Aug 03, 2014 1:12 pm    Post subject: Reply with quote

I compiled pulseaudio-jprvita-git from AUR in ArchLinux. It haven't been able to use the microphone of my bluetooth headset yet with Bluez5. I would like Ofono to do it to replace the new unsupported HFP by Buez5. I have to understand and play with Ofono to see if I can do it or not.

Pavucontrol give an HFP choice for my headset, but it do not work as it is said in the comments of pulseaudio-jprvita-git.
_________________
Paul
Back to top
View user's profile Send private message
luciano
Tux's lil' helper
Tux's lil' helper


Joined: 18 Nov 2004
Posts: 130

PostPosted: Sat Nov 15, 2014 11:04 am    Post subject: Reply with quote

Maybe Pulseaudio 6 will be the solution ; http://www.phoronix.com/scan.php?page=news_item&px=MTgyNzA
Back to top
View user's profile Send private message
robsta23
n00b
n00b


Joined: 21 Oct 2006
Posts: 15
Location: Dresden, Germany

PostPosted: Tue Aug 27, 2019 6:35 am    Post subject: Has this been adressed? Reply with quote

Hi there,

just wondering if there is a way to get HFP-headsets (no HSP) to use there mics by now. A2DP is working well.

The guides I found were fine to get my JBL Reflect Mini2 working on Arch, but not on my favourite gentoo machine:
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/Bluetooth/#index5h2
https://www.reddit.com/r/archlinux/comments/5ssgck/anyone_have_hsphfp_sourcesink_working_under_bluez5/

I recognize that this might be another systemd-only-feature, but I don't want to leave beloved openrc, only to find that not fixing the issue.

Has anybody found a solution (preferably with OPENRC, but any are welcome).

Regards,
Robert
Back to top
View user's profile Send private message
kvaster
n00b
n00b


Joined: 21 Mar 2020
Posts: 1

PostPosted: Sat Mar 21, 2020 5:24 pm    Post subject: Reply with quote

I've enabled both HSP and HFP sucessfully at my place:

1) Compile pulseaudio with native-headset and ofono-headset flags
2) Compile ofono
3) Configure phonesim plugin in ofono - /etc/ofono/phonesim.conf
[phonesim]
Address=127.0.0.1
Port=12345
4) Start (and add to autostart) ofono
5) Get sources of latest phonesim from https://git.kernel.org/pub/scm/network/ofono/phonesim.git
Compile and run:
phonesim -p 12345 src/default.xml
(by default phonesim will listen on all interfaces, so I've created patch for myself to select listen interface)

Now you can connect your HFP enabled device.
Back to top
View user's profile Send private message
_Lone_Wolf_
n00b
n00b


Joined: 25 Mar 2006
Posts: 19

PostPosted: Thu May 07, 2020 2:08 pm    Post subject: Reply with quote

I'm having trouble compiling phonesim I get the following error:

Code:

$ make
  UIC    src/ui_controlbase.h
/bin/sh: src/controlbase.ui: Permission denied
make: *** [Makefile:1066: src/ui_controlbase.h] Error 126


Any clue?
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6783

PostPosted: Thu May 07, 2020 11:58 pm    Post subject: Reply with quote

Does the one in net-misc/ofono, enabled by default, not work for you?
Back to top
View user's profile Send private message
_Lone_Wolf_
n00b
n00b


Joined: 25 Mar 2006
Posts: 19

PostPosted: Fri May 08, 2020 9:08 am    Post subject: Reply with quote

There is no phonesim binary on the ofono package.

Code:

$ equery f ofono | grep -i phonesim
/etc/ofono/phonesim.conf


Here are my use flags for ofono:
Code:

$ equery u net-misc/ofono
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for net-misc/ofono-1.16:
 U I
 + + atmodem   : ETSI AT modem support.
 + + bluetooth : Enable Bluetooth modem support using net-wireless/bluez.
 + + cdmamodem : Enable CDMA modem support.
 + + datafiles : Enable install configuration and data files.
 - - doc       : Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
 - - dundee    : Enable BlueTooth DUN deamon support.
 - - examples  : Install examples, usually source code
 + + isimodem  : Enable PhoNet/ISI modem support.
 + + phonesim  : Enable phone Simulator support
 + + provision : Enable GPRS provisioning support
 + + qmimodem  : Enable Qualcomm QMI modem support
 - - threads   : Add threads support for various packages. Usually pthreads
 - - tools     : Enable testing tools
 + + udev      : Enable virtual/udev integration (device discovery, power and storage device support, etc)
Back to top
View user's profile Send private message
oRDeX
Veteran
Veteran


Joined: 19 Oct 2003
Posts: 1309

PostPosted: Mon Aug 24, 2020 2:57 pm    Post subject: Reply with quote

kvaster wrote:
I've enabled both HSP and HFP sucessfully at my place:

1) Compile pulseaudio with native-headset and ofono-headset flags
2) Compile ofono
3) Configure phonesim plugin in ofono - /etc/ofono/phonesim.conf
[phonesim]
Address=127.0.0.1
Port=12345
4) Start (and add to autostart) ofono
5) Get sources of latest phonesim from https://git.kernel.org/pub/scm/network/ofono/phonesim.git
Compile and run:
phonesim -p 12345 src/default.xml
(by default phonesim will listen on all interfaces, so I've created patch for myself to select listen interface)

Now you can connect your HFP enabled device.


This worked for me. Thanks a lot!
The audio quality was not that good, but for that I guess there is much we can do from userspace.

Have you looked into why the phonesim binary is not provided by the ofono ebuild?
It'd be nice if it could come with ofono directly, without the need of cloning the repo.
Back to top
View user's profile Send private message
Chain
Tux's lil' helper
Tux's lil' helper


Joined: 17 Apr 2006
Posts: 111
Location: Vienna

PostPosted: Sat Aug 29, 2020 12:46 pm    Post subject: Reply with quote

phonesim seems not to be included in the ofono sources. I couldn't find it at least. It really seems that the phonesim useflag just builds the corresponding module.

However, I found that there is a phonesim.conf file, which maybe should be installed by the ebuild so we don't have to create it ourselves.

So I guess it would be more of an external phonesim ebuild that's needed here.

Edit: Just browsing one level up to https://git.kernel.org/pub/scm/network/ofono/ you will see that phonesim actually is an external project.

Edit 2: There exists an ebuild! Take a look at https://gpo.zugaina.org/net-misc/phonesim
Back to top
View user's profile Send private message
equaeghe
Guru
Guru


Joined: 22 Feb 2005
Posts: 533

PostPosted: Thu Sep 10, 2020 8:32 am    Post subject: Reply with quote

I'm having trouble installing phonesim. The ebuilds lying around do not work and I haven't been able to fix them.

I have:
Code:
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

inherit multilib

DESCRIPTION="Phone Simulator for modem testing (oFono)"
HOMEPAGE="http://ofono.org/"
SRC_URI="https://mirrors.edge.kernel.org/pub/linux/network/ofono/${P}.tar.xz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~arm ~x86"
IUSE=""

RDEPEND="
        net-misc/ofono
        dev-qt/qtcore
        dev-qt/qtdbus
        dev-qt/qtgui
        dev-qt/qtscript
"

DEPEND="
        ${RDEPEND}
        virtual/pkgconfig
"

src_install() {
        emake DESTDIR="${D}" install || die "emake install failed"
        dodoc ChangeLog AUTHORS doc/*.txt
}


But I get the message that Qt is not found:
Code:
checking for QT... no
configure: error: Qt is required


I would be grateful for any assistance and advice.
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 24814
Location: here

PostPosted: Thu Sep 10, 2020 9:18 am    Post subject: Reply with quote

This happens because phonesim 1.21 require qt4 (release date 2018-10-03), port to qt5 was made on 2019-11-06 and no release after that.
So you can create a 9999 ebuild
phonesim-9999.ebuild:
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit autotools git-r3

DESCRIPTION="Phone Simulator for modem testing (oFono)"
HOMEPAGE="http://ofono.org/"
EGIT_REPO_URI="https://git.kernel.org/pub/scm/network/ofono/${PN}.git"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE=""

RDEPEND="
        net-misc/ofono
        dev-qt/qtcore:5
        dev-qt/qtdbus:5
        dev-qt/qtgui:5
        dev-qt/qtscript:5
"

DEPEND="
        ${RDEPEND}
        virtual/pkgconfig
"

src_prepare() {
        default
        eautoreconf
}

_________________
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
equaeghe
Guru
Guru


Joined: 22 Feb 2005
Posts: 533

PostPosted: Thu Sep 10, 2020 10:23 am    Post subject: Reply with quote

I've managed to compile phonesim (locally for now; will look into @fedeliallalinea's suggestion for the ebuild). I can create a modem and power it and it does have an impact on how my headset is seen. Namely, the a2dp_sink is now listed as ‘yes’ instead of ‘unknown’. The profile I want, headset_head_unit is still listed as ‘no’:
Code:
    index: 3
        name: <bluez_card.B4_9A_95_F1_6B_2A>
        driver: <module-bluez5-device.c>
        owner module: 27
        properties:
                device.description = "JBL LIVE220BT"
                device.string = "B4:9A:95:F1:6B:2A"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "headset"
                bluez.path = "/org/bluez/hci0/dev_B4_9A_95_F1_6B_2A"
                bluez.class = "0x240404"
                bluez.alias = "JBL LIVE220BT"
                device.icon_name = "audio-headset-bluetooth"
                device.intended_roles = "phone"
        profiles:
                a2dp_sink: High Fidelity Playback (A2DP Sink) (priority 40, available: yes)
                headset_head_unit: Headset Head Unit (HSP/HFP) (priority 30, available: no)
                off: Uit (priority 0, available: yes)
        active profile: <a2dp_sink>
        sinks:
                bluez_sink.B4_9A_95_F1_6B_2A.a2dp_sink/#2: JBL LIVE220BT
        sources:
                bluez_sink.B4_9A_95_F1_6B_2A.a2dp_sink.monitor/#4: Monitor of JBL LIVE220BT
        ports:
                headset-output: Headset (priority 0, latency offset 0 usec, available: yes)
                        properties:

                headset-input: Headset (priority 0, latency offset 0 usec, available: no)
                        properties:

What I try:
Code:
pacmd set-card-profile 3 headset_head_unit
Failed to set card profile to 'headset_head_unit'.

The logs tell me:
Code:
[pulseaudio] module-bluez5-device.c: Refused to switch profile to headset_head_unit: Not connected


Any further suggestions welcome.
Back to top
View user's profile Send private message
equaeghe
Guru
Guru


Joined: 22 Feb 2005
Posts: 533

PostPosted: Sun Sep 20, 2020 7:43 pm    Post subject: Reply with quote

fedeliallalinea wrote:
This happens because phonesim 1.21 require qt4 (release date 2018-10-03), port to qt5 was made on 2019-11-06 and no release after that.
So you can create a 9999 ebuild

I've added a phonesim-9999 ebuild to my ‘equaeghe’ overlay.
I've changed the dependencies a bit, based on what I saw that was needed during a manual compile.
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


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

PostPosted: Thu Oct 29, 2020 2:54 am    Post subject: Reply with quote

So, what is the state here? Can we get the mic on the bluetooth headsets working in Linux or not?
Back to top
View user's profile Send private message
equaeghe
Guru
Guru


Joined: 22 Feb 2005
Posts: 533

PostPosted: Thu Oct 29, 2020 8:03 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1832

PostPosted: Sat Oct 31, 2020 2:33 am    Post subject: Reply with quote

I tried ofono/phonesim but couldn't get it to work.

Instead I got it to work with hsphfpd-prototype. It requires patching pulseaudio, but we're on Gentoo so it's easy :)
See here: https://github.com/pali/hsphfpd-prototype

Here's what I did:
  1. If you played with ofono, don't forget to stop and disable it.

  2. Create a pulseaudio-14 pre-release ebuild. It's the same as 13.0 except you need to disable a patch which doesn't apply:
    Code:
    # sed '/pulseaudio-11.1-disable-flat-volumes.patch/s/^/#/' pulseaudio-13.0.ebuild > pulseaudio-13.99.3.ebuild
    # ebuild pulseaudio-13.99.3.ebuild manifest


  3. Add and apply the patch. I have a feeling it won't make it into pulseaudio-14 so I put it into /etc/portage/patches rather than the ebuild (so when a newer PA reaches portage, either it applies or fails and I won't forget):
    Code:
    # mkdir -p /etc/portage/patches/media-sound/pulseaudio
    # wget https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/288.patch -O /etc/portage/patches/media-sound/pulseaudio/hsphfp.patch
    # emerge -av1 pulseaudio


  4. Install the hsphfd script. You can find an ebuild here. If you're using systemd, you can find a unit file here.

  5. Enable the hsphfd service ( systemctl enable hsphfpd -or- rc-update add hsphfpd ), start it ( systemctl start hsphfpd -or- /etc/init.d/hsphfpd start ), and as user, restart pulseaudio ( pulseaudio -k ).

  6. Connect your headset, and you should now have an HFP and an HSP profile, which will allow you to use your mic!
    (Don't mind the "(unavailable)" - it will become available once you select it)


Last edited by Etal on Sat Nov 07, 2020 6:37 pm; edited 1 time in total
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


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

PostPosted: Sat Oct 31, 2020 5:38 am    Post subject: Reply with quote

@Etal: how is the audio quality? Both for music listening and during calls

PS: I just got so tired of this whole business that I got one of those USB audio adapters which talk to Bluetooth headphones on one side and expose USB audio on other. Works very nice!
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1832

PostPosted: Sat Oct 31, 2020 1:18 pm    Post subject: Reply with quote

I got a cheap headset that could connect to both my phone and computer for phone calls and conference calls. Let's just say, for the price, it exceeded my (low) expectations :)

From my understanding, due to how bluetooth works, HSP/HFP (with mic) will always be worse quality than A2DP (no mic). The difference is significant.
Back to top
View user's profile Send private message
devsk
Advocate
Advocate


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

PostPosted: Sat Oct 31, 2020 4:13 pm    Post subject: Reply with quote

Etal wrote:
I got a cheap headset that could connect to both my phone and computer for phone calls and conference calls. Let's just say, for the price, it exceeded my (low) expectations :)

From my understanding, due to how bluetooth works, HSP/HFP (with mic) will always be worse quality than A2DP (no mic). The difference is significant.
How come none of these quality problems exist on Macbook or even Windows? Isn't the HSP/HFP profile being configured the same way on Macbooks at the hardware level? I thought these were all done to a well laid specification.

What rubbish is the following:
Quote:

Bluetooth Profiles: What Is A2DP?

A2DP (Advanced Audio Distribution Profile) is a Bluetooth protocol that enables a headset to stream high quality stereo audio wirelessly from a smartphone or other compatible device. The quality of the audio is much better, both for calls and for music playback.

If you want to buy a Bluetooth headset for listening to music from your phone, make sure that your devices specifications lists A2DP as a supported Bluetooth profile.
How does A2DP allow calls? Or why does A2DP on linux not allow calls?
Back to top
View user's profile Send private message
Etal
Veteran
Veteran


Joined: 15 Jul 2005
Posts: 1832

PostPosted: Sat Oct 31, 2020 4:52 pm    Post subject: Reply with quote

I don't own any Windows or Macs, but apparently it's the same:
Windows: https://superuser.com/questions/1101560/bluetooth-handsfree-better-quality
Mac: https://support.apple.com/en-us/HT208896

Bluetooth is a strange beast.
Back to top
View user's profile Send private message
coderanger
Apprentice
Apprentice


Joined: 19 Sep 2018
Posts: 165

PostPosted: Wed Nov 11, 2020 11:08 am    Post subject: Reply with quote

devsk wrote:
How does A2DP allow calls? Or why does A2DP on linux not allow calls?

Smartphone stops the music and switches to HSP/HFP for the moment of a call. After the call is made it returns back to A2DP and the music is resumed.
Back to top
View user's profile Send private message
dmpogo
Advocate
Advocate


Joined: 02 Sep 2004
Posts: 2923
Location: Canada

PostPosted: Wed Nov 11, 2020 6:23 pm    Post subject: Reply with quote

Etal wrote:
I don't own any Windows or Macs, but apparently it's the same:
Windows: https://superuser.com/questions/1101560/bluetooth-handsfree-better-quality
Mac: https://support.apple.com/en-us/HT208896

Bluetooth is a strange beast.


Indeed,

my daughter just got the latest Samsung Galaxy from her work, and bought a fancy set of bluetooth earbuds/mic. And the quality of conversation
went well down in comparison with her older phone/ wired set.

At the same time, in my 4 year old car, in car system switches from/to bluetooth phone rather seamlessly, and the quality of calls is pretty good.
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
Page 1 of 1

 
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