Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2803480pxu; Mon, 7 Dec 2020 16:39:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyY4jP25EL020RTYXTo0QKTt/Q726oJhQTGIbmeHgBjKXZikXfX0JpiQX+rExosH8nUFyK+ X-Received: by 2002:a50:9354:: with SMTP id n20mr7606433eda.231.1607387946506; Mon, 07 Dec 2020 16:39:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607387946; cv=none; d=google.com; s=arc-20160816; b=uy+WcAp5jry278rk0SWs8BtOCYAWQD2qvHGk5nvSF+jaNf/YmBb35utzvDG0roySXV UytpnGTmy4mgHZ/GfarQ6k/WLL7B9OtG+RjgvEQs/zZ3wJ3dXB+hY3p/nfLgCqO/55hh VlCq3ylXtXQXYYnF6T0/sX9S6c9Kdt0gbKx4hwPw7ZHxAqCgyrd0EGFhWvvQXfODyrh9 FC3Gu+0k+kaczbaadbvnbODY0dJ7UxEUXn0pvmKQ8gfNHweY04CA6kVRobVUm5Ltlw5R DBKEKVphdRVjEGRO3rnSs+KPxicBZoHBlBTAc+8OCER3m74GRbwgiEDp4w4L/6MFQq0Z e9CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=4ZA2t8hqswIuo6uu8EztKubCmJnN0R+7r1kvJEd2dug=; b=Xpera6tJhR0eIXnMpa2bluXfn+/Z5iv8VnJaXUFcqd9l8C2ddEAG1zX2FU7KatS9ts WK3tb4phn2ZQaBqWrlKYscKzyZND6L91Vc6LS2Zzaq7Wd8nmWELDgOU2ObprdksN7ceG YcpDN/PeAa+WooqFd01UNmdTfuy8BC/ORQrOCX+6jBe3dC96hbEdJcxZs5ZsSNFG2XvB DactEYJ447Dc4NpBN5MGhj4DcnYlxjgGYvfXjiv0vFG2j5rpd79iQzIG76ACBzWdNYLc 2g4AEdTu/XHMPNMaUX8QborzCjV5VB/whzibWCZZkBVuJ14ail80aFSflnq6niJtkAZJ syxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gJw6T5Qf; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ca4si8994737edb.559.2020.12.07.16.38.22; Mon, 07 Dec 2020 16:39:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gJw6T5Qf; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726112AbgLGXuN (ORCPT + 99 others); Mon, 7 Dec 2020 18:50:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbgLGXuN (ORCPT ); Mon, 7 Dec 2020 18:50:13 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29574C061793 for ; Mon, 7 Dec 2020 15:49:33 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id q3so10512917pgr.3 for ; Mon, 07 Dec 2020 15:49:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4ZA2t8hqswIuo6uu8EztKubCmJnN0R+7r1kvJEd2dug=; b=gJw6T5Qf060s475ErPJdCCAvJ65GyWlp1RlMx9ZIVKmgQqTypkHfNackoOqnT4Y3Fd tqi24dd/BVgnOBBdvcJ1DDwR0CyG9pZ6HiZYO+YCfudPaRox81FG9104a185i+uGi9Kc Zg3lbNixfpNkXpDK6DnajA1OZIg3ink1/xcw8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=4ZA2t8hqswIuo6uu8EztKubCmJnN0R+7r1kvJEd2dug=; b=kXi0pgMX96Uy3Q0crWyRRJaUSkoq3rFiD2KegwxlZ4paRSMRl2VrXsvnOBHjTk7APp 0B/apsXSmL3jkEu+1DKI68u6dIQYuzsvBP8SogNH5fvOpt30QWulxy0QiQkDwUhOw76t ztPkizkYtISUXtXUu7F6Ww54DRjcK0t+3qoUD4QOQSDJ5NNClKAs+las7AmwMMsMjpoO mdOjGjbJF7RsBCkRBJPqwSKxxnDHeVBslFVUxpob2ue4voTOoSKkTXWaMiZB9P4wlyXg FOKVfgiO3OmCrw8FYRI7Buy8TwH0edIelQVJIi4ALmSkZxF0IuvrcsMtLv189a36IKgn hGOw== X-Gm-Message-State: AOAM531Cw/+kf4eLei4bzAXkL/QjEdHRyCyvw2UKduZ7qO6HPgtGVEcH TCKM0VhQ5ADu3wFQOgyScWZcwQ== X-Received: by 2002:a17:90a:520e:: with SMTP id v14mr1195693pjh.9.1607384972455; Mon, 07 Dec 2020 15:49:32 -0800 (PST) Received: from apsdesk.mtv.corp.google.com ([2620:15c:202:1:7220:84ff:fe09:2b94]) by smtp.gmail.com with ESMTPSA id g16sm15062041pfb.201.2020.12.07.15.49.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 15:49:31 -0800 (PST) From: Abhishek Pandit-Subedi To: luiz.dentz@gmail.com, linux-bluetooth@vger.kernel.org Cc: chromeos-bluetooth-upstreaming@chromium.org, Abhishek Pandit-Subedi Subject: [bluez PATCH 0/1] policy: Fix connection stealing with Airpods Date: Mon, 7 Dec 2020 15:49:23 -0800 Message-Id: <20201207234924.140606-1-abhishekpandit@chromium.org> X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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