Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp96993pxu; Tue, 6 Oct 2020 20:17:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTvthy+HA3zmV7oQEmCrI/EmoavUkqL6KZ5hGl88L3+A/0bz551D/FaLXShZZabTLjKiUe X-Received: by 2002:a50:c38c:: with SMTP id h12mr1354915edf.185.1602040664286; Tue, 06 Oct 2020 20:17:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602040664; cv=none; d=google.com; s=arc-20160816; b=qGbaxi01eR+jHQasV5bp21A65iv2EDljpsAHE5RWlJyWJd1DZNBrRzUNrlAc1J685l hpQOWoNS2YP7bUFRiECbnC85kllOo6khL616g55uSOiDRbMb2TPGAzevYYJXZAiLzhb8 zKpXC4BSxN1RfhlD5tzIDiL8pRixqbztquKXDSVR1Z+WPcbKbFmCHv5kS7iHSnHp79aS Y0OHIO6L1ELXlT+aZZIjEW1qK6t9xWcAp6pnSpPv+s5KAJ39K9HRI0eUSSUrigEVGh/d VczLbK3zrNsykD2cts2ompaIolaoYisiugL5gjy/fmWnG0OE+9qctybLRBqPr8X46puG Lsaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=V0qJCj9XkDH/wx4wMpnuu0GUAzrWembJIZOJ5vlztdw=; b=TI5WOMCY8f60mmgenHSpm9Fy+i2YLRsDhIJjiXxzOsGIgyGhxdWYZoIoTjo0GWfCQh wR1K3RmiMJFylCmgpHy2JJbv/lXOmKl7Kk2Ug+04JIgD/j+cUD/00EAAzaUpRC07DXGo MOhuteR60+Ks1XWYkD5fq9gdRrM63pa+nPthVkOVH6LLTMZnajqqgZxD9ccFSpQCA7rk P7aZOvHCBSiBQWXhuDG3is7oFkdKiJEfEvgKLDVKJZP/JdQmcr10D8uO+uk9JwoJiKN/ 5ufZSrDKrHgdQehfgBvlO4u5xCDDvuMNDXp3Kd7uPTA2GAalYVkw5NQhcWZiEuIgF943 QPhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FAZBdDQK; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z14si440920edr.215.2020.10.06.20.17.01; Tue, 06 Oct 2020 20:17:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FAZBdDQK; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727007AbgJGDBQ (ORCPT + 99 others); Tue, 6 Oct 2020 23:01:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726627AbgJGDBQ (ORCPT ); Tue, 6 Oct 2020 23:01:16 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABB09C061755 for ; Tue, 6 Oct 2020 20:01:14 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id bi5so409515plb.17 for ; Tue, 06 Oct 2020 20:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=V0qJCj9XkDH/wx4wMpnuu0GUAzrWembJIZOJ5vlztdw=; b=FAZBdDQKYrhQp8rtZY3jzEFpQfCe8UZhr68hgMEC8Go6S4lzbiM7sVB3VnTbznl99L UfUzcQ1xMNvRyF+N3qXUZlP1F/HaTG131WmeRMRAImeV+pcvYx/moAA5IGKRh6anH4uk tJ8MKflnC6sqPUhoCKKSGIkthK63TY7lMFXgLSATcoq9AP29tP+lngSqsB8E/kud484O iCR5r66BfL+dgfANKguBS3+A2ozOYlncf0dVKmPSflDDgvQjvNauAvUf2Hl/DSoZsruY +D1+0ujWJKubgngPozWChbeq9oxr/M+30AZB5wVDwCyRweSLUjegrFLGOhYkt7yQR0C/ 2sFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=V0qJCj9XkDH/wx4wMpnuu0GUAzrWembJIZOJ5vlztdw=; b=HdXoAQIk4pZ8wnb+iagi36otGl4iyeNv+p/ZGiTl+X5O/K5QUcTn1K9aqLqMfd3yyj o6Bs8ewrvBdggEd6BjOhhl3pkGKq3KQNY9YRf5c2UWhhbQYWHSntqnxER9F11GLj97Qn 5jYKCcmKqJl4KfST2/ayrZu4/qxTJIPoSdO9z+Y0g7HgAbVN/k/I31YAMBP0QNA9AxmP 4Syy5KjyaMCfn3mr6H3NFhBZP3+OwEdAr1CtjbHdWTohxu/Ofbd7ag5R/Kc1Jwzh2MCo NRvGfQ4zVePk/E6XriYHBGbsTTlTkquPSZANWU19GVn+Depk7N4+BL0LuERwewqfRM+r P8fQ== X-Gm-Message-State: AOAM533pXddpp3VmQWq8kx6cxXZYUp4cbTlX0bJIaR4da3CzGT4D5K0J iJn/xpxqAUudu1woGqkgVu1qKQ4H8VJHvsAdicTAOhLnapzD6BcmauR0Vvsd1GYIatviJMtphIw aHZlbi1EgdtV6YZ3zWaoPcuJuOW5Ul8xfIooOUvC7/uWAmBb8UtvJfRvfGPoUPA9OW7Hc2lFRMi r//9I+9WV/DUw= Sender: "howardchung via sendgmr" X-Received: from howardchung-p920.tpe.corp.google.com ([2401:fa00:1:10:f693:9fff:fef4:4e45]) (user=howardchung job=sendgmr) by 2002:a17:902:6b44:b029:d3:e78a:8ab6 with SMTP id g4-20020a1709026b44b02900d3e78a8ab6mr913593plt.72.1602039673890; Tue, 06 Oct 2020 20:01:13 -0700 (PDT) Date: Wed, 7 Oct 2020 11:01:06 +0800 Message-Id: <20201007110032.BlueZ.1.I09f767132567613957435203a827e5151b26a15e@changeid> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog Subject: [BlueZ PATCH] adv_monitor: parse AD type as hex value From: Howard Chung To: linux-bluetooth@vger.kernel.org Cc: apusaka@chromium.org, luiz.von.dentz@intel.com, alainm@chromium.org, mcchou@chromium.org, mmandlik@chromium.org, Howard Chung Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 --- client/adv_monitor.c | 4 ++-- client/main.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) 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 \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 \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"); } -- 2.28.0.806.g8561365e88-goog