From nobody Mon Sep 28 11:38:58 2026 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61D423C1D70 for ; Sat, 22 Aug 2026 14:12:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787407959; cv=none; b=pdkGPZ6gauvbnU+0Ow4tkOD8+c0QuUI6IRCaMXHxuJrM25ZDkwCq0DmB2gVcwsN4EU5hXet2hd6nruU46FXJLC67rZYI8S2kFvrJUKHq3JlC2iHk8PSxMJmDaBJbv4ih/03On3MBVMR1mEh8l9+qoJiYylAP/4TQYhaeBhPMVK4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787407959; c=relaxed/simple; bh=u2led2iM95H40jffR0sjXQKAm5+lVuIahsaSzLeQ8Ao=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mq5d/yzPZlYddENFUq6sVXw8gKn/6NTtFsOmNVb6KVSQvEME/IcpFDtpUfnJsMdT9HciSBe9PxKsakRVORZ5aZh6dDZzKaqidoynIOv11IUIo1W+PNHBgTht8nw+wvS/ii7lPuZyHzAAb9prxh6r5RvBZNj3kBVVGExnn2w+an4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EWTCC4fQ; arc=none smtp.client-ip=209.85.218.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EWTCC4fQ" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-c15d111ca99so229981066b.0 for ; Sat, 22 Aug 2026 07:12:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787407954; x=1788012754; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AACxzMxh8D3+74R+fCgOyXG6KrSSQBlsUGYlirSS7iA=; b=EWTCC4fQMPSBJqRBqe65Xc1yo3aX/LU+O5aPqvfnA7uRCA6+uHISKIJOYWcvJn2jeB 69T8SOtozWI4MCK7N2wv6NL/2JVZZOj8F+RydSmmFVweQhbW/hHzU6gh5iJsXpwha3S9 w+WYOsjqOSYDYZM+VHoaPPIZdQL0hfUXsHSMAkHGyX0I1E3dGdKM0UKJHB7rU50K6nW+ jdjd5xwHBW1GApDv47EwyC+CKfzi7g1Ip891vmTCA0NRHyk9BveQQxO3WL8WoVJSDAvJ eA4kn1kN4y8fBxPdU4o5/ZLoy2SVbuhtEifQMKVbmJ7HCT/QaPjwprKt1OGm06WVGdsD U/8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787407954; x=1788012754; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=AACxzMxh8D3+74R+fCgOyXG6KrSSQBlsUGYlirSS7iA=; b=CvwnwR+ipaIbOXG1wf5Ctid0dEIfc2tFZRkiIwy6MAwfzxuc6xuSvjq5+QePoL+K9f WK8c3re+rbRt128fuCBv57sCcyHrfZnfUN49M9TOavd5cuz9uINLKhYwMkK71dTcgzOH CDg+y864E6W0VzCg4Dv91ivpz5rP0/uh6wjNPXAl4ebrVknsUXvEpdF/rwe+KnPKjnkI tGnA1quQq572kQM8Wtb5muzapKWFuaU8fGr26MZkcpt6caFJMQO7HblTmEzu6NUOcnGy 5k6feh9JeOodXeoRrdZdGG1xSm9s5vLZG8DhIbJiV3WxUWMikZxBvHYcRxQDeG9D8auj 0JJw== X-Forwarded-Encrypted: i=1; AHgh+Rre4cJMEE2/0bXi6jRPoGpwNXZp7Ke9Omw0s/pC0zhgAX146FHM3EbVwU8MWIt5U1U+IjPKfjYrkl2cpLg=@vger.kernel.org X-Gm-Message-State: AFuF++nrDKp9c36l2yBvE90q+qGaufCIxid0Qgv8lKYsq/KyZP+16T7E yKvtZcLeCJrgEnQlj772A8+7w7BRxne6yjJidW1FaUAdEX70nQfEDw0v X-Gm-Gg: AR+sD131mfAExS/glEg/xl1gFxYbT3ZnVOXosLRtR9j5gJJDy6JtapBxqi1EEiKs5uo M49yiBOp0EQow1mnX/g4/6pOG6I4aC0OJyb7c6KdCfaa8PwCLa8HYTENBNdxx7IBT015hUlni27 YSj1duU+7Tr3nDwXFwWRCRDZXApwpogb1TZn6E2XOaTFUEn1Bw87fkopLSN/MlYcjfZ8462glo/ tYZjvDEJ4LlB5218AY5v9CzYl8XYyHWloORBFZ5rdkFKA7tIoqVVxnV/t27BAlDTZ1kMCss2NjT 0AcEpkEveIUdq5anXVgBBvvkMgXQsY+f4mm0eaadEeOFRfe4z5J8tVoOP/PxDObDEng/UZkX5C1 K7HRmHOypEPQmkcuzeBbMPVOx+T7rTtHRO+4qefOEbEj/getRIqXhtQSyH+UDeyULImRCk8ghjt DTDgWvWvr+5Pf31AhP0sMgo7dqpp80jxc9wxmn+TxJBKltXXL+hnLXl8o0qCRsS8e+Kpvhl6+/W v0B8Azc130DjxpfgqlChYSLlchP0lAJSYjK+C2IH9lDqLVix5Tg8WzUcvyzodH2jBvmrX4QyGz0 51oVNoA= X-Received: by 2002:a17:907:3fa0:b0:c16:16b9:98fa with SMTP id a640c23a62f3a-c249257b3abmr609543266b.5.1787407954349; Sat, 22 Aug 2026 07:12:34 -0700 (PDT) Received: from bobo (d163-170.icpnet.pl. [109.173.163.170]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2496734bfcsm340625266b.43.2026.08.22.07.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Aug 2026 07:12:34 -0700 (PDT) From: Kamil Serwus To: linux-bluetooth@vger.kernel.org Cc: Alexej Sidorenko , Luiz Augusto von Dentz , Marcel Holtmann , regressions@lists.linux.dev, linux-kernel@vger.kernel.org, Kamil Serwus Subject: [RFC PATCH 1/2] Bluetooth: hci_sync: latch broken ext scan on Command Disallowed Date: Sat, 22 Aug 2026 16:11:14 +0200 Message-ID: <20260822141115.58815-2-kserwus@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260822141115.58815-1-kserwus@gmail.com> References: <20260822141115.58815-1-kserwus@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" HCI_QUIRK_BROKEN_EXT_SCAN exists for controllers that "erroneously claim to support extended scanning". Today every user of it has to be recognised up front - by chip id or USB id - which means a controller is only handled once somebody has owned one, hit the bug and sent a patch. Recognising them by behaviour instead is both simpler and complete: a controller that advertises the extended scan commands in its supported commands bitmap but answers Command Disallowed is exactly the class of device the quirk describes, and it says so itself on the first attempt. Latch the quirk there, so every later scan uses the legacy commands. The cost for an affected controller is one rejected scan round per power cycle instead of a permanent stream of failures; for everyone else nothing changes. Signed-off-by: Kamil Serwus --- include/net/bluetooth/hci.h | 4 ++-- net/bluetooth/hci_sync.c | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 50f0eef71..5cee010f2 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -276,8 +276,8 @@ enum { * disabled. This is required for some Broadcom controllers which * erroneously claim to support extended scanning. * - * This quirk can be set before hci_register_dev is called or - * during the hdev->setup vendor callback. + * This quirk can be set before hci_register_dev is called, during the + * hdev->setup vendor callback, or at runtime on Command Disallowed. */ HCI_QUIRK_BROKEN_EXT_SCAN, =20 diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index c8d14128c..eb711f454 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -2265,6 +2265,7 @@ static int hci_le_set_ext_scan_enable_sync(struct hci= _dev *hdev, u8 val, u8 filter_dup) { struct hci_cp_le_set_ext_scan_enable cp; + int err; =20 memset(&cp, 0, sizeof(cp)); cp.enable =3D val; @@ -2274,8 +2275,18 @@ static int hci_le_set_ext_scan_enable_sync(struct hc= i_dev *hdev, u8 val, else cp.filter_dup =3D filter_dup; =20 - return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_EXT_SCAN_ENABLE, - sizeof(cp), &cp, HCI_CMD_TIMEOUT); + err =3D __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_EXT_SCAN_ENABLE, + sizeof(cp), &cp, HCI_CMD_TIMEOUT); + + /* The controller claims extended scan support but rejects it. Latch + * the quirk so that every later scan uses the legacy commands. + */ + if (err =3D=3D -EBUSY) { + bt_dev_warn(hdev, "extended scan rejected, using legacy scan"); + hci_set_quirk(hdev, HCI_QUIRK_BROKEN_EXT_SCAN); + } + + return err; } =20 static int hci_le_set_scan_enable_sync(struct hci_dev *hdev, u8 val, --=20 2.55.0 From nobody Mon Sep 28 11:38:58 2026 Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33EFB3AFD02 for ; Sat, 22 Aug 2026 14:12:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787407960; cv=none; b=Y4RrTY9lcXgQXjpzm5g17aGJeeSy7W6DfQ22kiagGk5x1d5Fje0vliFfUhvO6pO+RO0NGDwTE4bLPP+w9fCcq/Isv3DaDjYOebMhnEkXQyit2hwAdcx401HdVtpgCoR/6blZJznsn++Iur0JgQGRhKoyqbOXP8OQP7czIXp6MM0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787407960; c=relaxed/simple; bh=a/Zen0w90tMij5iqhPeoVzR8LiXYaB3RDaflEiW67OI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bpWN2WAMPn9qPLhdDqv+uWTnsZKMJGfyAUvL8TN/QVF3Spp9L9vlbL61M2HW5m0zAEPAQGfeyh25ehaQTSLyBEVOsrjEPnIOaCL3RMRNmO5+kssVW3D5IsQgujsRhb5pKB3SL+/ojCu4FuCcSswkee8hRstI9UKMGN/VmrnBrMk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MOYB5Iyi; arc=none smtp.client-ip=209.85.208.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MOYB5Iyi" Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-6a18840e2abso3615858a12.0 for ; Sat, 22 Aug 2026 07:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787407957; x=1788012757; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rtlvMLrP2jUPQduDljPzGOvdFkacvebUJpx+3lFSi1E=; b=MOYB5Iyiuvr8kjUTiD2ipGJ4JZUxHmAg3tmAo9rVLcvJTNrJJ7nCt6Dzz+m78HHYl4 ZHjRBslE9Gt+vVYPSnIda/evhFtXQvgKqnBR4Ow2qfG5sGZN3xSAMkztxtmYMMPxennr Tf5myLURuTXuiQ9h3kRnJe/k9D7tOstOvBSUyFB1v0E5fTYK9a+XYeIzC5qpIUaoH6tj yxaIyO8ib7ofm58m95YjVIL+DaWg9ps5jtYUSPspJdBi9Dib8rrGqCvUixZJ+Gtmhcbb 3j7HXkRrglg7mNOIoezubDchKaWMvw8+1+IXJRAUpZm4Xmqrl2uWUOncXGkFC5j+hR4I WS/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787407957; x=1788012757; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=rtlvMLrP2jUPQduDljPzGOvdFkacvebUJpx+3lFSi1E=; b=nAr2nYNqIicWas5pR/1t4Jjl/kTRNmOqj+wcoiaR2wWCfsTQrM0Z7Rj3tav//63WMw Kcr2syb/MhSyaVesNdbrFPdh1jKrhzBoq6BNuYapK4f1ha1eiuzUU9CgoHQT7X+S/Nad VmHiejHVqlTkb3Q2oAkZBDv/PG9k4HB0SHHBG0XaAgyWSYEUpMACsfz0K7ekK97HIFXf ecvj09v+Uxhb1zixhm5b0t336eFzs0Uj+UD9IvEbCT+njbfLIQpmg65nL+gzhhju3W8i D0O+M8AJQmh0sujEblIPIr1ZphEHNPj2L8UXCVfKU/v0IlOUZ6XGx4p260+oi184ml05 lQ1w== X-Forwarded-Encrypted: i=1; AHgh+Rp6TtqVHsYX1lf3C1qNBOt96z1iEbQz+ayOw7Ra9cZ+des88rbbIs3/td6axDDrqRo03KXHlWIu7E582qA=@vger.kernel.org X-Gm-Message-State: AFuF++m63uZdZ5yts7UzGANeo+yYuo4uC8RZg+KyiXjCYcp3CTZf0m89 ALo+nwUFUA+i6fCGb51A0HWE4hkey2cKfpVDBu2I7qXdtzYlyqpx5JxO X-Gm-Gg: AR+sD13d5xeOYsiAexShsrrtkR9gcVN5KAcOaNVYtSIPMe46MTMbM5qNambM6AXxCZr ohYZKvjtGOqafZGr4Gpdko6R6fhCdaqCg1JhMb4/fzpIMKOsu2oe0lILF+m4jwJjM5y9BEmKC1i 6Ri+J1iWB2A6bTEGrvf5jLcx/H3/kYjQy6ynDwo5dIS+Cxy/4+AKv/ZwEV4vUF0Y8EzHe3597O0 /Eo6R+oP4SGq8vyLC9O4xymbOu4cuNydhC6qWdxrtlGGUJW4S+mMGvb6vjrFRhzo4a89SC/9ePa Xn3+SrQ2gvfBrBVY9r1J1Kfeu56b4U1UOVgcUFYfdnn0vpZpX43lN8F7zE477SZ55JbX15JGZzJ R9gpkBv+6vQBqetHpKOozCVru8ST7yl1sZhAcdWQV+gQ0CmS2cZ67t4JzLur0KvK6Vq426HWif1 V1XljDasyQaVZ1PQ9JbrRW00rSYAvyiikN4ojlaDUNO2WSMme4JqJsHocXO0Jwzcpnco8zCRlKU joyaAxgTCp8gmghVxnK5Oa54T9jjKjslz652lkRCGKx42/c22eQl/qelyA1cBS+mXvUPBEvQFgH XgI0M991KRubwOPlCg== X-Received: by 2002:a17:907:d78a:b0:c20:899:b8bc with SMTP id a640c23a62f3a-c2491c836e7mr564736266b.6.1787407957178; Sat, 22 Aug 2026 07:12:37 -0700 (PDT) Received: from bobo (d163-170.icpnet.pl. [109.173.163.170]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2496734bfcsm340625266b.43.2026.08.22.07.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Aug 2026 07:12:36 -0700 (PDT) From: Kamil Serwus To: linux-bluetooth@vger.kernel.org Cc: Alexej Sidorenko , Luiz Augusto von Dentz , Marcel Holtmann , regressions@lists.linux.dev, linux-kernel@vger.kernel.org, Kamil Serwus Subject: [RFC PATCH 2/2] Bluetooth: btrtl: drop the blanket RTL8761B extended scan quirk Date: Sat, 22 Aug 2026 16:11:15 +0200 Message-ID: <20260822141115.58815-3-kserwus@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260822141115.58815-1-kserwus@gmail.com> References: <20260822141115.58815-1-kserwus@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit 5ead2063611ae5 ("Bluetooth: btrtl: fix RTL8761B/BU broken LE extended scan") sets HCI_QUIRK_BROKEN_EXT_SCAN for every CHIP_ID_8761B. It was validated on one dongle, USB 0bda:a728, and it regresses others that share the chip id but not the firmware bug. On USB 0bda:8771 (fw 0xdfc6d922) extended scan works flawlessly, while the legacy scan-disable command the quirk forces makes the controller stop answering entirely: Bluetooth: hci0: command 0x200c tx timeout Bluetooth: hci0: Opcode 0x200c failed: -110 Bluetooth: hci0: Unable to disable scanning: -110 Bluetooth: hci0: Resetting usb device. btusb then resets the device, it re-enumerates (hci0 -> hci1 -> hci2) and every connected BLE device is dropped - here a Kensington SlimBlade Pro trackball and a Keychron Q8 Max keyboard. Linux 7.1.x, without the quirk, drives the same dongle with the same firmware for hours without a single scan error. Nothing in btrtl can tell the two apart: same project_id, same ic_id_table entry, same rtl8761bu_fw.bin. They differ only by USB id, which btrtl_set_quirks() cannot see, and both take their driver_info from the same generic Realtek entry in btusb's quirks_table, so driver_info cannot separate them either. With the previous patch the 0bda:a728 dongle recognises itself on its first rejected extended scan, so the static guess is no longer needed. Fixes: 5ead2063611ae ("Bluetooth: btrtl: fix RTL8761B/BU broken LE extended= scan") Signed-off-by: Kamil Serwus --- drivers/bluetooth/btrtl.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c index 7f54d2d2d..03fa9409e 100644 --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c @@ -1343,19 +1343,6 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct b= trtl_device_info *btrtl_dev) if (!btrtl_dev->ic_info) return; =20 - switch (btrtl_dev->project_id) { - case CHIP_ID_8761B: - /* RTL8761B/BU reports HCI version 5.1 but does not support - * the LE Extended Scan commands (Opcode 0x2042), causing - * repeated -EBUSY failures when BlueZ attempts extended - * scanning while a connection is active. - */ - hci_set_quirk(hdev, HCI_QUIRK_BROKEN_EXT_SCAN); - break; - default: - break; - } - switch (btrtl_dev->ic_info->lmp_subver) { case RTL_ROM_LMP_8703B: /* 8723CS reports two pages for local ext features, --=20 2.55.0