1

how can I use hfp on my ubuntu linux with iphone 5s? I have bluetoooth, all bluez packages and ofono installed.

For ofono I need a modem. From what I understood from bluetooth core, protocoll and profile specification, rfcomm and spp of bluetooth can be used to emulate a modem. How does this work with bluez? Do the bluetoothd and ofonod dbus-services already handle incoming connections to hfp oder do I have to write my own listener?

EDIT:

The program is running. I implemented it according to the test-scripts. But I am experiencing audio issues, as I don't have any sound when performing calls. The sound is not muted.

pa log (translated):

Sep 26 13:57:47 ubu2 pulseaudio[2524]: [alsa-sink-Intel ICH] alsa-sink.c: ALSA woke us up to write new Data on the Device but there was nothing to write!
Sep 26 13:57:47 ubu2 pulseaudio[2524]: [alsa-sink-Intel ICH] alsa-sink.c: This is most probably an Error of the ALSA-Driver 'snd_intel8x0'. Please send this error to the ALSA-Developers.
Sep 26 13:57:47 ubu2 pulseaudio[2524]: [alsa-sink-Intel ICH] alsa-sink.c: We have been woken up by the POLLOUT-Set, but a following call of snd_pcm_avail() returned the value 0 or another value smaller than min_avail.

How can I see if ALSA has encountered some errors? I found no log.

When connecting the a2dp-Profile so that my computer are the speakers of the iPhone I also have no sound.

EDIT 2:

To solve this error, this is recommended:
File: /etc/pulse/default.pa
Add tsched=0 to the following line:
load-module module-detect
from post #21 https://bugs.launchpad.net/ubuntu/+source/linux/+bug/374002

But it does not solve my issue. I try force-loading the also modules too.

progo
  • 91
  • 2
  • 7
  • HFP profile has 2 roles, from your comment, are you looking for HF role(like headsets) on your ubuntu PC? – ashish Jul 31 '14 at 11:27

2 Answers2

3

Having ofono and bluez should be enough.

However, latest version of bluez/ofono and pulseaudio don't support HSP and HFP profiles. Pulseaudio release notes say that only A2DP is supported with bluez5.x. If you are using bluez4.x, ofono and pulseaudio 4.x/5.x you might still get this working without a problem.

http://www.freedesktop.org/wiki/Software/PulseAudio/Notes/5.0/

ofono will treat your iPhone 5s as your modem. Once you get the iPhone paired and connected through bluetoothctl or any alternative GUI, you could run the following ofono tests to see if ofono picked it up right. Try running ofonod using ofonod -n -d on a terminal to monitor the debug log and probably run pulseaudio in verbose too (pulseaudio -k && pulseaudio -v)

bash$ cd */ofono-1.x/test

This directory contains sample dbus scripts to test the ofono functionalities.

bash$ ./list-modems

[ /hfp/org/bluez/hci0/dev_94_94_26_88_XX_XX ]
    Type = hfp
    Interfaces = org.ofono.Siri org.ofono.VoiceCallManager org.ofono.CallVolume org.ofono.Handsfree org.ofono.NetworkRegistration 
    Features = net 
    Serial = 94:94:26:88:XX:XX
    Online = 1
    Powered = 1
    Lockdown = 0
    Emergency = 0
    Name = XXXXXX’s iPhone
    [ org.ofono.Siri ]
        EyesFreeMode = disabled
        Enabled = 1
    [ org.ofono.VoiceCallManager ]
        EmergencyNumbers = 08 000 999 110 112 911 118 119 
    [ org.ofono.CallVolume ]
        Muted = 0
        SpeakerVolume = 50
        MicrophoneVolume = 50
    [ org.ofono.Handsfree ]
        VoiceRecognition = 0
        InbandRinging = 1
        Features = three-way-calling echo-canceling-and-noise-reduction voice-recognition release-all-held release-specified-active-call private-chat create-multiparty 
        BatteryChargeLevel = 4
        SubscriberNumbers = +XXXXXXXXXXXX
        EchoCancelingNoiseReduction = 1
    [ org.ofono.NetworkRegistration ]
        Status = registered
        Name = XXX XXXXXX
        Mode = auto-only
        Strength = 60

If you see output similar to above, enable the modem and try dialling using the following command and observe ofono debug log if SCO socket is created or rejected. And, of course, see if the audio is routed to Ubuntu.

bash$ ./enable-modem

bash$ ./dial-number +XXXXXXXXXXXX
...

Similarly, try calling up your iPhone and observe the ofono, pulseaudio logs. bash$ ./answer-calls

Looks like folks at pulseaudio are trying to get this working with bluez5.x and ofono but there doesn't seem to be a patch available publicly yet. The bug is being tracked here: https://bugs.freedesktop.org/show_bug.cgi?id=73325

Hamid Rouhani
  • 2,309
  • 2
  • 31
  • 45
Prathyush
  • 31
  • 2
  • Thanks for you answer! I actually got it running on 2nd of august by installing blueZ 5.21 from the sources and starting the new bluetooth daemon. ofono 1.5 is just compatible to bluez 5.x it seems as dbus interfaces have been renamed. A pity bluez 5.21 is not in pkg-repo for Ubuntu. – progo Aug 07 '14 at 10:06
  • Cool. Did you get the audio re-routing to work through Ubuntu? – Prathyush Aug 09 '14 at 04:56
  • Actually I had to invest my time in A2DP first and could not continue with HFP. When I try to use my laptop as a speaker the audio seems to be routed away from my phone to my pc, but there is no output. Do you have the same issue with HFP? Maybe I should check pulseaudio version or something, as I use bluez 5.21 now. – progo Aug 20 '14 at 11:22
  • Yes - I have the same problem. I had to force load alsa-sink and alsa-source modules to get audio working on Ubuntu. What sort of messages does the PA's debug log throw up in your case ?. I'm using PA from https://gitorious.org/pulseaudio/vudentzs-mainline (branch: hfp-ofono-5.0) - which seems to be latest at the moment. – Prathyush Sep 11 '14 at 06:52
  • I figured out, that I can use ofono with bluez4 when I use configure option --enable-bluez4 and then compile it on my machine. Doing so it also worked fine, but still I have no output. I can see the Phone in my audio options and when I list input-sinks and output-sources there is a loopback module. I added the pa logs to my post. – progo Sep 26 '14 at 12:05
  • What is the command to force-load alsa-source? the one commented in the default.pa does not work. Do I have to use the `SCORouting=PCM` option in `/etc/bluetooth/audio.conf`? – progo Sep 26 '14 at 13:14
1

HFP for Linux is a Bluetooth Hands-Free Profile server.

It allows your Linux system to act as a speakerphone for your mobile phone. It aims to be a compliant Bluetooth HFP 1.5 Hands Free implementation, supporting all required commands and notifications, as well as streaming audio.

http://nohands.sourceforge.net/

user1990
  • 536
  • 3
  • 13
  • So just having ofono and bluez is not enough? Before I found out about ofono, I wanted to use nohands, but could not compile the release. It seems methods named Invoke in event.h were not called correctly. Furthermore it tries to get a pointer to a temp object (e.g. BDADDR_ANY) which is not allowed. After googling for alternatives I found out that hfp is supported in cooperation of ofono and bluez and I thought that using both of these would be enough as described here: http://padovan.org/blog/2010/02/handsfree-profile-into-bluez-and-ofono/ – progo Jul 30 '14 at 12:36
  • As SPP is the basis fpr HFP, this might be an issue: http://stackoverflow.com/questions/10973797/is-there-any-supported-bluetooth-profile-which-is-used-in-ios-except-6-profiles Or is bluez etc. MFI certified? – progo Jul 30 '14 at 12:42