From: Andre Eikmeyer <dev@deq.rocks>
To: marcel@holtmann.org, luiz.dentz@gmail.com
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
sven@kernel.org, j@jannau.net, neal@gompa.dev,
asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
66ton99@gmail.com, josemiguelo.ochoa@gmail.com,
aditya.garg@linux.dev, Andre Eikmeyer <dev@deq.rocks>,
Yossef Osman <Yossef.Osman@proton.me>
Subject: [PATCH 2/4] Bluetooth: btbcm: clear vendor bits in LE advertising report types
Date: Wed, 4 Nov 2026 16:15:59 +0100 [thread overview]
Message-ID: <20261104151601.70493-3-dev@deq.rocks> (raw)
In-Reply-To: <20261104151601.70493-1-dev@deq.rocks>
The BCM4364B0 of the MacBookPro15,1 (UART) and the BCM4377 of the
MacBookAir9,1 (PCIe) set bits 4, 5 and 7 of the event type in LE
Advertising Report events. btmon on the 15,1 shows types 0x10, 0x13,
0x14, 0x20, 0x23, 0x24, 0x93 and 0xa0 next to plain 0x00, 0x03 and 0x04,
the same advertiser shows up as 0x13, 0x23 and 0x03. The kernel log of
the 9,1 lists 0x10 to 0x24 and 0x80, 0x83, 0x90, 0x93, 0xa0, 0xa3.
process_adv_report() drops every type above 0x04 with "Unknown
advertising packet type", so most advertisements never reach the host.
An AirDrop sender was reported as 0x23, 0x23 and 0x13 and only the
fourth report, 0x03, reached BlueZ 32 s after the first one.
Add btbcm_fixup_le_adv_report(), which clears the bits above the type,
and call it from hci_bcm on Apple machines and from hci_bcm4377 before
the event goes to the core.
Suggested-by: Jose Miguel Ochoa <josemiguelo.ochoa@gmail.com>
Tested-by: Yossef Osman <Yossef.Osman@proton.me>
Tested-by: Aditya Garg <aditya.garg@linux.dev>
Signed-off-by: Andre Eikmeyer <dev@deq.rocks>
---
drivers/bluetooth/btbcm.c | 30 ++++++++++++++++++++++++++++++
drivers/bluetooth/btbcm.h | 5 +++++
drivers/bluetooth/hci_bcm.c | 5 +++++
drivers/bluetooth/hci_bcm4377.c | 1 +
4 files changed, 41 insertions(+)
diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c
index 0facfe62333..527a5c75fd6 100644
--- a/drivers/bluetooth/btbcm.c
+++ b/drivers/bluetooth/btbcm.c
@@ -282,6 +282,36 @@ void btbcm_set_acl_priority_on_connect(struct hci_dev *hdev, struct sk_buff *skb
}
EXPORT_SYMBOL_GPL(btbcm_set_acl_priority_on_connect);
+/* The BCM4364 and BCM4377 of the T2 Macs set bits above the event type of LE
+ * Advertising Reports, 0x13 and 0x23 for ADV_NONCONN_IND for example. The
+ * core drops reports of unknown types, so clear them.
+ */
+void btbcm_fixup_le_adv_report(struct sk_buff *skb)
+{
+ struct hci_event_hdr *hdr = (void *)skb->data;
+ struct hci_ev_le_advertising_info *info;
+ u8 *p, *end;
+ u8 num;
+
+ if (hci_skb_pkt_type(skb) != HCI_EVENT_PKT ||
+ skb->len < HCI_EVENT_HDR_SIZE + 2 || hdr->evt != HCI_EV_LE_META)
+ return;
+
+ p = skb->data + HCI_EVENT_HDR_SIZE;
+ if (p[0] != HCI_EV_LE_ADVERTISING_REPORT)
+ return;
+
+ num = p[1];
+ p += 2;
+ end = skb->data + skb->len;
+ while (num-- && p + sizeof(*info) + 1 <= end) {
+ info = (void *)p;
+ info->type &= 0x0f;
+ p += sizeof(*info) + info->length + 1;
+ }
+}
+EXPORT_SYMBOL_GPL(btbcm_fixup_le_adv_report);
+
int btbcm_patchram(struct hci_dev *hdev, const struct firmware *fw)
{
const struct hci_command_hdr *cmd;
diff --git a/drivers/bluetooth/btbcm.h b/drivers/bluetooth/btbcm.h
index a4d47b242e9..56936e64b5f 100644
--- a/drivers/bluetooth/btbcm.h
+++ b/drivers/bluetooth/btbcm.h
@@ -60,6 +60,7 @@ int btbcm_write_pcm_int_params(struct hci_dev *hdev,
const struct bcm_set_pcm_int_params *params);
void btbcm_set_acl_priority_on_connect(struct hci_dev *hdev, struct sk_buff *skb);
+void btbcm_fixup_le_adv_report(struct sk_buff *skb);
int btbcm_setup_patchram(struct hci_dev *hdev);
int btbcm_setup_apple(struct hci_dev *hdev);
@@ -101,6 +102,10 @@ static inline void btbcm_set_acl_priority_on_connect(struct hci_dev *hdev,
{
}
+static inline void btbcm_fixup_le_adv_report(struct sk_buff *skb)
+{
+}
+
static inline int btbcm_setup_patchram(struct hci_dev *hdev)
{
return 0;
diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
index cf4f1455cf9..1ae9619ee1e 100644
--- a/drivers/bluetooth/hci_bcm.c
+++ b/drivers/bluetooth/hci_bcm.c
@@ -148,6 +148,7 @@ struct bcm_device {
bool no_uart_clock_set;
bool use_autobaud_mode;
bool acl_priority;
+ bool adv_type_fixup;
u8 pcm_int_params[5];
u32 max_autobaud_speed;
};
@@ -686,6 +687,9 @@ static int bcm_recv_event(struct hci_dev *hdev, struct sk_buff *skb)
struct hci_uart *hu = hci_get_drvdata(hdev);
struct bcm_data *bcm = hu->priv;
+ if (bcm->dev && bcm->dev->adv_type_fixup)
+ btbcm_fixup_le_adv_report(skb);
+
if (bcm->dev && bcm->dev->acl_priority)
btbcm_set_acl_priority_on_connect(hdev, skb);
@@ -1100,6 +1104,7 @@ static int bcm_get_resources(struct bcm_device *dev)
if (x86_apple_machine && !bcm_apple_get_resources(dev)) {
dev->acl_priority = true;
+ dev->adv_type_fixup = true;
return 0;
}
diff --git a/drivers/bluetooth/hci_bcm4377.c b/drivers/bluetooth/hci_bcm4377.c
index 30fcadfae3f..8d99a7a8f76 100644
--- a/drivers/bluetooth/hci_bcm4377.c
+++ b/drivers/bluetooth/hci_bcm4377.c
@@ -691,6 +691,7 @@ static void bcm4377_handle_event(struct bcm4377_data *bcm4377,
memcpy(skb_put(skb, len), payload, len);
hci_skb_pkt_type(skb) = type;
+ btbcm_fixup_le_adv_report(skb);
btbcm_set_acl_priority_on_connect(bcm4377->hdev, skb);
hci_recv_frame(bcm4377->hdev, skb);
next prev parent reply other threads:[~2026-11-04 15:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 15:15 [PATCH 0/4] Bluetooth: Broadcom controllers of the Apple T2 Macs Andre Eikmeyer
2026-11-04 15:15 ` [PATCH 1/4] Bluetooth: btbcm: raise ACL priority on Apple Broadcom controllers Andre Eikmeyer
2026-11-04 16:46 ` Bluetooth: Broadcom controllers of the Apple T2 Macs bluez.test.bot
2026-11-04 15:15 ` Andre Eikmeyer [this message]
2026-11-04 15:24 ` [PATCH 2/4] Bluetooth: btbcm: clear vendor bits in LE advertising report types Luiz Augusto von Dentz
2026-11-04 15:34 ` Aditya Garg
2026-11-04 15:46 ` André Eikmeyer
2026-11-04 16:29 ` Luiz Augusto von Dentz
2026-11-04 16:47 ` André Eikmeyer
2026-11-04 15:16 ` [PATCH 3/4] Revert "Bluetooth: hci_event: strip Broadcom vendor bits from legacy adv report type" Andre Eikmeyer
2026-11-04 15:16 ` [PATCH 4/4] Bluetooth: set the strict duplicate filter quirk on Apple Broadcom controllers Andre Eikmeyer
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=20261104151601.70493-3-dev@deq.rocks \
--to=dev@deq.rocks \
--cc=66ton99@gmail.com \
--cc=Yossef.Osman@proton.me \
--cc=aditya.garg@linux.dev \
--cc=asahi@lists.linux.dev \
--cc=j@jannau.net \
--cc=josemiguelo.ochoa@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=neal@gompa.dev \
--cc=sven@kernel.org \
/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