- 05 Apr, 2021 2 commits
-
-
The HFP protocol supports the ability to negotiate codecs if that is supported by both AG and HF. This patch adds advertising of codec negotiation support and the ability to negotiate a codec change. The only currently supported extra codec (as of HF 1.7.1) is mSBC. mSBC requires that the transmission be done over an eSCO link with Transparent Data. The linux kernel ensures the former, but we have to manually set the socket to transparent data. Signed-off-by:
James Bottomley <James.Bottomley@HansenPartnership.com> Part-of: <!507>
-
Adding processing support for the mSBC codec is somewhat problematic, because, although it is a SBC codec, the a2dp handling can't simply be reused because the codec is used on an eSCO link with transparent data, meaning the transmission unit has to be 48 bytes (fragmenting the codec packets) and reassembly and boundary detection is required to be done by the implementation. Therefore we have to implement separate render and push routines for msbc that do this fragmentation. Fragmentation is done by emulating circular buffers. The receive (push) buffer is easy, since the mSBC packet size is 60, simply have a buffer of this size in the sbc_info area where the fragments are reassembled. Once we have a full 60 bytes, decode and restart from zero. The send (render) buffer is more problematic, since the transmit must be done from contiguous memory. This means that the buffer must be the lowest common multiple of the transmission unit and the packet size. This value is 240 since 240/48 == 5 and 240/60 == 4. So the buffer pointers are reset at 240 which is a whole number of both rendered packets and eSCO transmission units. Signed-off-by:
James Bottomley <James.Bottomley@HansenPartnership.com> Part-of: <!507>
-
- 23 Feb, 2021 4 commits
-
-
Change default backend from 'auto' to 'native' so that in the usual install pulseaudio uses the native backend with HFP_HF handling. set default to false unless the backend is the native one, in which case the default becomes true. Additionally set default value of enable_native_hfp_hf to false unless the backend is the native one, in which case the default becomes true. so that we only bind the HFP_HF end point in the native case (leaving it free for ofono in the ofono backend or auto case) Signed-off-by:
James Bottomley <James.Bottomley@HansenPartnership.com> Part-of: <!491>
-
HFP 1.6 requires a stateful negotiation of AT commands. The prior version got away with initialising HFP simply by replying 'OK' to every negotiation attempt. This one actually tries to parse the state and make sure the negotiation occurs correctly Signed-off-by:
James Bottomley <James.Bottomley@HansenPartnership.com> --- v4: - Update for PA 11.0 - Finally sort out CIND negotiaton for complex headsets v3: - remove internal debugging - added comment for t->config being not null for hfp - removed unused returns from hfp_rfcomm_handle() - remove rfcomm comment - use pa_startswith - simplify negotiation Part-of: <!491>
-
When all headsets supported both HSP and HFP, life was good and we only needed to implement HSP in the native backend. Unfortunately some headsets have started supporting HFP only. Unfortuantely, we can't simply switch to HFP only because that might break older HSP only headsets meaning we need to support both HSP and HFP separately. This patch separates them from a joint profile to being two separate ones. The older one retains the headset_head_unit name, meaning any saved parameters will still select this (keeping us backward compatible). It also introduces a new headset_handsfree. For headsets that support both HSP and HFP, the two profiles will become separately visible and selectable. This will only matter once we start adding features to HFP that HSP can't support (like wideband audio). Signed-off-by: <James.Bottomley@HansenPartnership.com> --- v6: - merge profile switching fixes patch from Rodrigo Araujo v5: - rename option to enable_native_hfp_hf - don't call profile_done for HFP_HF unless it was initialised v3: - Update for PA 11.0 v2: - fold in review feedback - add global disable option for not registering HFP v3: - change parameter to enable_profile_hfp - update device_supports_profile to be aware of hfp/hsp exclusivity - change parameter to enable_profile_hfp_hf bluetooth: separate HSP and HFP (to me merged with this patch) 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. Part-of: <!491>
-
The PA_BLUETOOTH_PROFILE names should mirror the PA_BLUETOOTH_UUID names using profile_function instead of randomly made up names. Fix this with the transformation: PA_BLUETOOTH_PROFILE_HEADSET_HEAD_UNIT -> PA_BLUETOOTH_PROFILE_HSP_HS PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY -> PA_BLUETOOTH_PROFILE_HFP_AG Signed-off-by:
James Bottomley <James.Bottomley@HansenPartnership.com> --- v4: update for PA 11.0 Part-of: <!491>
-