Linux-Bluetooth Archive on lore.kernel.org
 help / color / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Yu Liu <yudiliu@google.com>
Cc: "linux-bluetooth@vger.kernel.org"
	<linux-bluetooth@vger.kernel.org>,
	Hsin-Yu Chao <hychao@google.com>,
	Sonny Sasaka <sonnysasaka@chromium.org>
Subject: Re: [Bluez PATCH v1] device - If HFP is supported, ignore HSP
Date: Tue, 30 Jun 2020 17:30:44 -0700
Message-ID: <CABBYNZ+xTsRKFHZrjuxCbxR=tWYmGr79SaLsKEbscuCt3zobPw@mail.gmail.com> (raw)
In-Reply-To: <20200630154855.Bluez.v1.1.I63c3ddd54189c2ad9ca9aba2c08e0925d7f0aee3@changeid>

Hi Yu Liu,

On Tue, Jun 30, 2020 at 3:55 PM Yu Liu <yudiliu@google.com> wrote:
>
> From: Hsin-Yu Chao <hychao@google.com>
>
> For a BT headset that supports both HSP and HFP, BlueZ creates
> service instances for these two profiles and connects them.
> It's uncertain that which of HSP and HFP eventually get connected
> and being used for SCO audio. And we start observing some problem
> because of this uncertainty:
>
> - For headset that supports WBS, we need HFP connect for codec
> negotiation. If HSP connects but not HFP, WBS cannot be used.

We should probably have a way to detect when one or the other is
connected and then don't attempt to connect again since they would
likely conflict when it comes to connecting SCO, that said is your
system setting AutoConnect for both HSP and HFP?

> - For WH-1000XM3, if BlueZ ever initiated HFP connection but failed,
> headset won't have working SCO audio even HSP is connected.

Hmm I guess this will need to treated separately, not sure if we can
exclude HSP to be connected once HFP fails, but then again I think the
system should not have them both set to be Auto Connected, HSP most
likely should only be set as as a fallback if HFP is not supported.

> Fix this at when device probes services, if HFP is in the uuid list,
> don't bother create one for HSP.
>
> Reviewed-by: Sonny Sasaka <sonnysasaka@chromium.org>
> ---
>
> Changes in v1:
> - Initial change
>
>  src/device.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/device.c b/src/device.c
> index 7b0eb256e..4036bfd81 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -4370,6 +4370,11 @@ static struct btd_service *probe_service(struct btd_device *device,
>         if (!device_match_profile(device, profile, uuids))
>                 return NULL;
>
> +       /* If device supports HFP, don't bother create service for HSP. */
> +       if (g_slist_find_custom(uuids, HFP_HS_UUID, bt_uuid_strcmp) &&
> +               bt_uuid_strcmp(profile->remote_uuid, HSP_HS_UUID) == 0)
> +               return NULL;
> +
>         l = find_service_with_profile(device->services, profile);
>         if (l)
>                 return l->data;
> --
> 2.27.0.212.ge8ba1cc988-goog
>


-- 
Luiz Augusto von Dentz

  reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30 22:49 Yu Liu
2020-07-01  0:30 ` Luiz Augusto von Dentz [this message]
2020-07-03 10:15 ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABBYNZ+xTsRKFHZrjuxCbxR=tWYmGr79SaLsKEbscuCt3zobPw@mail.gmail.com' \
    --to=luiz.dentz@gmail.com \
    --cc=hychao@google.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=sonnysasaka@chromium.org \
    --cc=yudiliu@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-Bluetooth Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-bluetooth/0 linux-bluetooth/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-bluetooth linux-bluetooth/ https://lore.kernel.org/linux-bluetooth \
		linux-bluetooth@vger.kernel.org
	public-inbox-index linux-bluetooth

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-bluetooth


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git