diff mbox series

[BlueZ] adv_monitor: parse AD type as hex value

Message ID 20201007110032.BlueZ.1.I09f767132567613957435203a827e5151b26a15e@changeid (mailing list archive)
State New, archived
Headers show
Series [BlueZ] adv_monitor: parse AD type as hex value | expand

Commit Message

Howard Chung Oct. 7, 2020, 3:01 a.m. UTC
Currently bluetoothctl parse pattern as a decimal string, but the
Bluetooth SIG website uses hex value instead.
(https://www.bluetooth.com/specifications/assigned-numbers/generic-access-
profile/)

Reviewed-by: Manish Mandlik <mmandlik@chromium.org>
---

 client/adv_monitor.c | 4 ++--
 client/main.c        | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com Oct. 7, 2020, 3:33 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=360615

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/client/adv_monitor.c b/client/adv_monitor.c
index 90ab0be093d2..74f19d2d93e4 100644
--- a/client/adv_monitor.c
+++ b/client/adv_monitor.c
@@ -435,7 +435,7 @@  static struct pattern *parse_pattern(char *parameter_list[])
 	}
 
 	pat->start_pos = atoi(parameter_list[0]);
-	pat->ad_data_type = atoi(parameter_list[1]);
+	pat->ad_data_type = strtol(parameter_list[1], NULL, 16);
 	pat->content_len = str2bytearray(parameter_list[2], pat->content);
 	if (pat->content_len == 0) {
 		free_pattern(pat);
@@ -542,7 +542,7 @@  static void print_adv_monitor(struct adv_monitor *adv_monitor)
 			bt_shell_printf("\tpattern %d:\n", idx);
 			bt_shell_printf("\t\tstart position: %hhu\n",
 							pattern->start_pos);
-			bt_shell_printf("\t\tAD data type: %hhu\n",
+			bt_shell_printf("\t\tAD data type: 0x%02x\n",
 							pattern->ad_data_type);
 			print_bytearray("\t\tcontent: ", pattern->content,
 							pattern->content_len);
diff --git a/client/main.c b/client/main.c
index 60f1eb86e26a..16cb0234c48e 100644
--- a/client/main.c
+++ b/client/main.c
@@ -2724,6 +2724,8 @@  static void print_add_or_pattern_with_rssi_usage(void)
 						RSSI_DEFAULT_HIGH_TIMEOUT);
 	bt_shell_printf("pattern format:\n"
 			"\t<start_position> <ad_data_type> <content_of_pattern>\n");
+	bt_shell_printf("Note: both ad_data_type and content_of_pattern are "
+			"hex string\n");
 	bt_shell_printf("e.g.\n"
 			"\tadd-or-pattern-rssi -10, ,10 1 2 01ab55\n");
 	bt_shell_printf("or\n"
@@ -2734,6 +2736,8 @@  static void print_add_or_pattern_usage(void)
 {
 	bt_shell_printf("pattern format:\n"
 			"\t<start_position> <ad_data_type> <content_of_pattern>\n");
+	bt_shell_printf("Note: both ad_data_type and content_of_pattern are "
+			"hex string\n");
 	bt_shell_printf("e.g.\n"
 			"\tadd-or-pattern 1 2 01ab55 3 4 23cd66\n");
 }