@@ -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);
@@ -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");
}
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(-)