diff mbox series

[BlueZ] monitor: Fix incorrect vendor name for vendor cmd and evt

Message ID 20221014020246.1035012-1-hj.tedd.an@gmail.com (mailing list archive)
State Superseded
Headers show
Series [BlueZ] monitor: Fix incorrect vendor name for vendor cmd and evt | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/setupell success Setup ELL PASS
tedd_an/buildprep success Build Prep PASS
tedd_an/build success Build Configuration PASS
tedd_an/makecheck fail Make Check FAIL: monitor/packet.c: In function ‘current_vendor_evt’: monitor/packet.c:9881:25: error: variable ‘msft_opcode’ set but not used [-Werror=unused-but-set-variable] 9881 | uint16_t manufacturer, msft_opcode; | ^~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7490: monitor/packet.o] Error 1 make: *** [Makefile:11587: check] Error 2
tedd_an/makecheckvalgrind fail Make FAIL: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12514:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12514 | int main(int argc, char *argv[]) | ^~~~ monitor/packet.c: In function ‘current_vendor_evt’: monitor/packet.c:9881:25: error: variable ‘msft_opcode’ set but not used [-Werror=unused-but-set-variable] 9881 | uint16_t manufacturer, msft_opcode; | ^~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7490: monitor/packet.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4450: all] Error 2
tedd_an/makedistcheck success Make Distcheck PASS
tedd_an/build_extell success Build External ELL PASS
tedd_an/build_extell_make fail Build Make with External ELL FAIL: monitor/packet.c: In function ‘current_vendor_evt’: monitor/packet.c:9881:25: error: variable ‘msft_opcode’ set but not used [-Werror=unused-but-set-variable] 9881 | uint16_t manufacturer, msft_opcode; | ^~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7490: monitor/packet.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4450: all] Error 2
tedd_an/scan_build fail Scan Build w/patched FAIL: monitor/packet.c: In function ‘current_vendor_evt’: monitor/packet.c:9881:25: error: variable ‘msft_opcode’ set but not used [-Werror=unused-but-set-variable] 9881 | uint16_t manufacturer, msft_opcode; | ^~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7490: monitor/packet.o] Error 1 make: *** [Makefile:4450: all] Error 2

Commit Message

Tedd Ho-Jeong An Oct. 14, 2022, 2:02 a.m. UTC
From: Tedd Ho-Jeong An <tedd.an@intel.com>

This patch fixes the issue that the vendor name for all vendor HCI
command and event are display as Microsoft.
---
 monitor/packet.c | 37 ++++++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 9 deletions(-)

Comments

bluez.test.bot@gmail.com Oct. 14, 2022, 3:27 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=685253

---Test result---

Test Summary:
CheckPatch                    PASS      1.06 seconds
GitLint                       PASS      0.74 seconds
Prep - Setup ELL              PASS      26.18 seconds
Build - Prep                  PASS      0.67 seconds
Build - Configure             PASS      8.13 seconds
Build - Make                  FAIL      145.92 seconds
Make Check                    FAIL      12.59 seconds
Make Check w/Valgrind         FAIL      111.94 seconds
Make Distcheck                PASS      233.42 seconds
Build w/ext ELL - Configure   PASS      8.18 seconds
Build w/ext ELL - Make        FAIL      54.77 seconds
Incremental Build w/ patches  PASS      0.00 seconds
Scan Build                    FAIL      472.04 seconds

Details
##############################
Test: Build - Make - FAIL
Desc: Build the BlueZ source tree
Output:
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12514:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12514 | int main(int argc, char *argv[])
      |     ^~~~
monitor/packet.c: In function ‘current_vendor_evt’:
monitor/packet.c:9881:25: error: variable ‘msft_opcode’ set but not used [-Werror=unused-but-set-variable]
 9881 |  uint16_t manufacturer, msft_opcode;
      |                         ^~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7490: monitor/packet.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4450: all] Error 2


##############################
Test: Make Check - FAIL
Desc: Run 'make check'
Output:
monitor/packet.c: In function ‘current_vendor_evt’:
monitor/packet.c:9881:25: error: variable ‘msft_opcode’ set but not used [-Werror=unused-but-set-variable]
 9881 |  uint16_t manufacturer, msft_opcode;
      |                         ^~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7490: monitor/packet.o] Error 1
make: *** [Makefile:11587: check] Error 2


##############################
Test: Make Check w/Valgrind - FAIL
Desc: Run 'make check' with Valgrind
Output:
tools/mgmt-tester.c: In function ‘main’:
tools/mgmt-tester.c:12514:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
12514 | int main(int argc, char *argv[])
      |     ^~~~
monitor/packet.c: In function ‘current_vendor_evt’:
monitor/packet.c:9881:25: error: variable ‘msft_opcode’ set but not used [-Werror=unused-but-set-variable]
 9881 |  uint16_t manufacturer, msft_opcode;
      |                         ^~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7490: monitor/packet.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4450: all] Error 2


##############################
Test: Build w/ext ELL - Make - FAIL
Desc: Build BlueZ source with '--enable-external-ell' configuration
Output:
monitor/packet.c: In function ‘current_vendor_evt’:
monitor/packet.c:9881:25: error: variable ‘msft_opcode’ set but not used [-Werror=unused-but-set-variable]
 9881 |  uint16_t manufacturer, msft_opcode;
      |                         ^~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7490: monitor/packet.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4450: all] Error 2


##############################
Test: Scan Build - FAIL
Desc: Run Scan Build with patches
Output:
monitor/packet.c: In function ‘current_vendor_evt’:
monitor/packet.c:9881:25: error: variable ‘msft_opcode’ set but not used [-Werror=unused-but-set-variable]
 9881 |  uint16_t manufacturer, msft_opcode;
      |                         ^~~~~~~~~~~
cc1: all warnings being treated as errors
make[1]: *** [Makefile:7490: monitor/packet.o] Error 1
make: *** [Makefile:4450: all] Error 2




---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/monitor/packet.c b/monitor/packet.c
index 692012029..d11d8808d 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -9821,7 +9821,7 @@  static const char *get_supported_command(int bit)
 	return NULL;
 }
 
-static const char *current_vendor_str(void)
+static const char *current_vendor_str(uint16_t ocf)
 {
 	uint16_t manufacturer, msft_opcode;
 
@@ -9833,7 +9833,8 @@  static const char *current_vendor_str(void)
 		msft_opcode = BT_HCI_CMD_NOP;
 	}
 
-	if (msft_opcode != BT_HCI_CMD_NOP)
+	if (msft_opcode != BT_HCI_CMD_NOP &&
+				cmd_opcode_ocf(msft_opcode) == ocf)
 		return "Microsoft";
 
 	switch (manufacturer) {
@@ -9891,9 +9892,6 @@  static const struct vendor_evt *current_vendor_evt(const void *data,
 		msft_opcode = BT_HCI_CMD_NOP;
 	}
 
-	if (msft_opcode != BT_HCI_CMD_NOP)
-		return NULL;
-
 	switch (manufacturer) {
 	case 2:
 		return intel_vendor_evt(data, consumed_size);
@@ -9904,6 +9902,27 @@  static const struct vendor_evt *current_vendor_evt(const void *data,
 	return NULL;
 }
 
+static const char *current_vendor_evt_str(void)
+{
+	uint16_t manufacturer;
+
+	if (index_current < MAX_INDEX)
+		manufacturer = index_list[index_current].manufacturer;
+	else
+		manufacturer = fallback_manufacturer;
+
+	switch (manufacturer) {
+	case 2:
+		return "Intel";
+	case 15:
+		return "Broadcom";
+	case 93:
+		return "Realtek";
+	}
+
+	return NULL;
+}
+
 static void inquiry_complete_evt(uint16_t index, const void *data, uint8_t size)
 {
 	const struct bt_hci_evt_inquiry_complete *evt = data;
@@ -10084,7 +10103,7 @@  static void cmd_complete_evt(uint16_t index, const void *data, uint8_t size)
 			const struct vendor_ocf *vnd = current_vendor_ocf(ocf);
 
 			if (vnd) {
-				const char *str = current_vendor_str();
+				const char *str = current_vendor_str(ocf);
 
 				if (str) {
 					snprintf(vendor_str, sizeof(vendor_str),
@@ -10176,7 +10195,7 @@  static void cmd_status_evt(uint16_t index, const void *data, uint8_t size)
 			const struct vendor_ocf *vnd = current_vendor_ocf(ocf);
 
 			if (vnd) {
-				const char *str = current_vendor_str();
+				const char *str = current_vendor_str(ocf);
 
 				if (str) {
 					snprintf(vendor_str, sizeof(vendor_str),
@@ -11618,7 +11637,7 @@  static void vendor_evt(uint16_t index, const void *data, uint8_t size)
 	const struct vendor_evt *vnd = current_vendor_evt(data, &consumed_size);
 
 	if (vnd) {
-		const char *str = current_vendor_str();
+		const char *str = current_vendor_evt_str();
 
 		if (str) {
 			snprintf(vendor_str, sizeof(vendor_str),
@@ -12020,7 +12039,7 @@  void packet_hci_command(struct timeval *tv, struct ucred *cred, uint16_t index,
 			const struct vendor_ocf *vnd = current_vendor_ocf(ocf);
 
 			if (vnd) {
-				const char *str = current_vendor_str();
+				const char *str = current_vendor_str(ocf);
 
 				if (str) {
 					snprintf(vendor_str, sizeof(vendor_str),