linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
To: luiz.dentz@gmail.com, linux-bluetooth@vger.kernel.org
Cc: chromeos-bluetooth-upstreaming@chromium.org,
	Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Subject: [bluez PATCH 0/1] policy: Fix connection stealing with Airpods
Date: Mon,  7 Dec 2020 15:49:23 -0800	[thread overview]
Message-ID: <20201207234924.140606-1-abhishekpandit@chromium.org> (raw)


Hi Luiz,

When a2dp-sink was added to the reconnection policy, it exposed a bug in
Airpods which were incorrectly emitting Connection Timeout when
connecting to a new device. As a result, Chromebooks started
reconnecting immediately (link loss) and inadvertently "stole"
connections. See hci trace below:

> HCI Event: Disconnect Complete (0x05) plen 4                 #1680 [hci0] 62.656436
        Status: Success (0x00)
        Handle: 256
        Reason: Connection Timeout (0x08)
@ MGMT Event: Device Disconnected (0x000c) plen 8              {0x0004} [hci0] 62.656510
        BR/EDR Address: E4:90:FD:7D:E7:5F (OUI E4-90-FD)
        Reason: Connection timeout (0x01)
@ MGMT Event: Device Disconnected (0x000c) plen 8              {0x0002} [hci0] 62.656510
        BR/EDR Address: E4:90:FD:7D:E7:5F (OUI E4-90-FD)
        Reason: Connection timeout (0x01)
@ MGMT Event: Device Disconnected (0x000c) plen 8              {0x0001} [hci0] 62.656510
        BR/EDR Address: E4:90:FD:7D:E7:5F (OUI E4-90-FD)
        Reason: Connection timeout (0x01)
@ MGMT Event: Device Disconnected (0x000c) plen 8              {0x0003} [hci0] 62.656510
        BR/EDR Address: E4:90:FD:7D:E7:5F (OUI E4-90-FD)
        Reason: Connection timeout (0x01)
< HCI Command: Write Scan Enable (0x03|0x001a) plen 1          #1681 [hci0] 62.668156
        Scan enable: Page Scan (0x02)
> HCI Event: Command Complete (0x0e) plen 4                    #1682 [hci0] 62.670442
      Write Scan Enable (0x03|0x001a) ncmd 2
        Status: Success (0x00)
< HCI Command: Create Connection (0x01|0x0005) plen 13         #1683 [hci0] 64.090171
        Address: E4:90:FD:7D:E7:5F (OUI E4-90-FD)
        Packet type: 0xcc18
          DM1 may be used
          DH1 may be used
          DM3 may be used
          DH3 may be used
          DM5 may be used
          DH5 may be used
        Page scan repetition mode: R2 (0x02)
        Page scan mode: Mandatory (0x00)
        Clock offset: 0x0000
        Role switch: Allow slave (0x01)
> HCI Event: Command Status (0x0f) plen 4                      #1684 [hci0] 64.090446
      Create Connection (0x01|0x0005) ncmd 1

This patch separates the ReconnectUUIDs by adding a ReconnectResumeUUIDs
and distinguishes reconnections that occur on timeout vs. resume.

I've run the following tests:

- Check that Airpods changing to a different device doesn't cause
  a reconnection with this change.
- Check that adding a2dp-sink to ReconnectUUIDs will cause the original
  issue to be seen.
- Make sure Airpods are reconnected on resume.
- Make sure other headphones are reconnected on resume (tested Anker
  Soundcore Life Q20 and ATH-M50xBT)
- Run bluetooth_AdapterSRHealth.sr_reconnect_a2dp (ChromeOS end-to-end
  test)

Thanks
Abhishek



Abhishek Pandit-Subedi (1):
  policy: Refactor reconnect policy for resume

 plugins/policy.c | 72 ++++++++++++++++++++++++++++++++++++------------
 src/main.conf    |  9 +++++-
 2 files changed, 62 insertions(+), 19 deletions(-)

-- 
2.29.2.576.ga3fc446d84-goog


             reply	other threads:[~2020-12-07 23:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07 23:49 Abhishek Pandit-Subedi [this message]
2020-12-07 23:49 ` [bluez PATCH 1/1] policy: Refactor reconnect policy for resume Abhishek Pandit-Subedi
2020-12-08  0:36   ` Luiz Augusto von Dentz
2020-12-08  1:19     ` Abhishek Pandit-Subedi
2020-12-08  3:08       ` Luiz Augusto von Dentz
2020-12-12  0:04         ` Abhishek Pandit-Subedi
2020-12-08  1:12   ` policy: Fix connection stealing with Airpods bluez.test.bot

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=20201207234924.140606-1-abhishekpandit@chromium.org \
    --to=abhishekpandit@chromium.org \
    --cc=chromeos-bluetooth-upstreaming@chromium.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).