public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Archie Pusaka <apusaka@google.com>
To: linux-bluetooth <linux-bluetooth@vger.kernel.org>,
	 Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: CrosBT Upstreaming <chromeos-bluetooth-upstreaming@chromium.org>,
	 Archie Pusaka <apusaka@chromium.org>
Subject: [PATCH Bluez 2/2] monitor: Set msft_opcode on read_local_version_rsp
Date: Tue, 14 Apr 2026 19:11:11 +0800	[thread overview]
Message-ID: <20260414111307.3725821-2-apusaka@google.com> (raw)
In-Reply-To: <20260414111307.3725821-1-apusaka@google.com>

From: Archie Pusaka <apusaka@chromium.org>

Aside from INDEX_INFO, we can also receive manufacturer company ID
when receiving read_local_version_rsp, so we should also try setting
the msft_opcode there.
---

 monitor/packet.c | 68 +++++++++++++++++-------------------------------
 1 file changed, 24 insertions(+), 44 deletions(-)

diff --git a/monitor/packet.c b/monitor/packet.c
index 30cab1a2f..ff0b1cac2 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -4359,6 +4359,24 @@ static int addr2str(const uint8_t *addr, char *str)
 			addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
 }
 
+static int get_msft_opcode(uint16_t manufacturer) {
+	switch (manufacturer) {
+	case COMPANY_ID_INTEL:
+		return 0xFC1E;
+	case COMPANY_ID_QUALCOMM:
+		return 0xFD70;
+	case COMPANY_ID_MEDIATEK:
+		return 0xFD30;
+	case COMPANY_ID_REALTEK:
+		return 0xFCF0;
+	case COMPANY_ID_LINUX:
+		return 0xFC1E;
+	default:
+		return BT_HCI_CMD_NOP;
+	}
+
+}
+
 void packet_monitor(struct timeval *tv, struct ucred *cred,
 					uint16_t index, uint16_t opcode,
 					const void *data, uint16_t size)
@@ -4451,50 +4469,8 @@ void packet_monitor(struct timeval *tv, struct ucred *cred,
 		if (index < MAX_INDEX) {
 			memcpy(index_list[index].bdaddr, ii->bdaddr, 6);
 			index_list[index].manufacturer = manufacturer;
-
-			switch (manufacturer) {
-			case COMPANY_ID_INTEL:
-				/*
-				 * Intel controllers that support the
-				 * Microsoft vendor extension are using
-				 * 0xFC1E for VsMsftOpCode.
-				 */
-				index_list[index].msft_opcode = 0xFC1E;
-				break;
-			case COMPANY_ID_QUALCOMM:
-				/*
-				 * Qualcomm controllers that support the
-				 * Microsoft vendor extensions are using
-				 * 0xFD70 for VsMsftOpCode.
-				 */
-				index_list[index].msft_opcode = 0xFD70;
-				break;
-			case COMPANY_ID_MEDIATEK:
-				/*
-				 * Mediatek controllers that support the
-				 * Microsoft vendor extensions are using
-				 * 0xFD30 for VsMsftOpCode.
-				 */
-				index_list[index].msft_opcode = 0xFD30;
-				break;
-			case COMPANY_ID_REALTEK:
-				/*
-				 * Realtek controllers that support the
-				 * Microsoft vendor extensions are using
-				 * 0xFCF0 for VsMsftOpCode.
-				 */
-				index_list[index].msft_opcode = 0xFCF0;
-				break;
-			case COMPANY_ID_LINUX:
-				/*
-				 * Emulator controllers use Linux Foundation as
-				 * manufacturer and support the
-				 * Microsoft vendor extensions using
-				 * 0xFC1E for VsMsftOpCode.
-				 */
-				index_list[index].msft_opcode = 0xFC1E;
-				break;
-			}
+			index_list[index].msft_opcode =
+				get_msft_opcode(manufacturer);
 		}
 
 		addr2str(ii->bdaddr, str);
@@ -6530,6 +6506,10 @@ static void read_local_version_rsp(uint16_t index, const void *data,
 		}
 
 		index_list[index_current].manufacturer = manufacturer;
+		if (index_list[index_current].msft_opcode == BT_HCI_CMD_NOP) {
+			index_list[index_current].msft_opcode =
+				get_msft_opcode(manufacturer);
+		}
 	}
 
 	print_manufacturer(rsp->manufacturer);
-- 
2.54.0.rc1.513.gad8abe7a5a-goog


  reply	other threads:[~2026-04-14 11:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14 11:11 [PATCH Bluez 1/2] monitor: define manufacturer company IDs Archie Pusaka
2026-04-14 11:11 ` Archie Pusaka [this message]
2026-04-14 12:24 ` [Bluez,1/2] " bluez.test.bot
2026-04-14 21:00 ` [PATCH Bluez 1/2] " patchwork-bot+bluetooth

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=20260414111307.3725821-2-apusaka@google.com \
    --to=apusaka@google.com \
    --cc=apusaka@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