Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp1585318lkv; Wed, 19 May 2021 13:23:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxpv4g92/GWGJ+1lqqXv1el0x/kJSvJoI3N+fDczWhJfDSbHYy4kk7fKOgGr0ZmiFo5gmV X-Received: by 2002:a17:906:d8cb:: with SMTP id re11mr958595ejb.482.1621455839332; Wed, 19 May 2021 13:23:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621455839; cv=none; d=google.com; s=arc-20160816; b=xpIgbJi173C06RMRydN53Sk3r2iJ9fS+SYD+xXFGrdVeL/+VN2mpNRMxrxOs+t3tiH p/wSfFmKcIYnbVExVkQZzpnk+KBjHEnq5ZUA1nN8qMwLu+ZqRd9LFlsgkZMI0Vpg7Zpj y/Ulk+hE2ty9eW1zv5uZ+coVOxMy970iC7qIscFX0r5QCSMnZdyAorvuxAnTvAJyod06 y8Uc7/Vj0InE3EyesfCYUqFvxMeybyhWjwMAZT6+yyzswft5BlVqAn0+iHNerlSu8G8R +QIe6JEftpwkr2yef/nfuoB13UANGN0yQ+RCzAH7bEtQWli6GXRwlt1A+i0g0KfFsDSc r0XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=UEfD8GkqHT2y2NCpZU0snyfqTsbKVtiPKdd+wQ3QjGo=; b=YhQcCVuw/JYzs2F44Fuuxx1CZ6lHsSUX2lBIkKJg/K56l1Sgf3eNmTXYvwCuofwFgz LnkXZ6nFELQr0jlCIPDp8G9Rw2lal4qgA51JFdqau11SZ8NI4zu76VAn/GOpTilhXqBh 0LL5NUtEx6hYJWhOrIuy/bFMTtH6YqPJ5TO0dzCO35YB/nMKBFgOjuLB6weD+iq3ytpP VHOvQd2eltlAj6YMu5Hvz+cCiaHU/Dlfs0+pd7xF7g6vnOWOzehdhI4Jl8nmdb+6retW ht48gmgSeC12IfH3Az3TYTZmgA3ObaWENEyFxNg6SLcn7xetzFHou6xpTUsFGSsrh2r/ JbEg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b11si611166ejd.10.2021.05.19.13.23.30; Wed, 19 May 2021 13:23:59 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231896AbhESTLB (ORCPT + 99 others); Wed, 19 May 2021 15:11:01 -0400 Received: from mga06.intel.com ([134.134.136.31]:6662 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231910AbhESTK7 (ORCPT ); Wed, 19 May 2021 15:10:59 -0400 IronPort-SDR: SSPFIIz1tv2CXdgyHYwIe7sWXR6aMmdfzo1MmL3SrFCrf4S2kSDxSX6hGU5MA7gRDkiasjPY4X jKcEYm44aLng== X-IronPort-AV: E=McAfee;i="6200,9189,9989"; a="262284400" X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="262284400" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2021 12:09:37 -0700 IronPort-SDR: K8JerMNp2w2M7FQxYVjyqEKlgwKsce1FG8SEz3MWt4ugZMJfnHlOxNxdmoEligYdFcdwBNMl3n AzVNoqTRS3iA== X-IronPort-AV: E=Sophos;i="5.82,313,1613462400"; d="scan'208";a="439855267" Received: from bgi1-mobl2.amr.corp.intel.com ([10.212.229.7]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 May 2021 12:09:37 -0700 From: Brian Gix To: linux-bluetooth@vger.kernel.org Cc: inga.stotland@intel.com, brian.gix@intel.com Subject: [PATCH BlueZ v3 3/6] tools/mesh: Add all supported OOB methods to cfgclient Date: Wed, 19 May 2021 12:09:22 -0700 Message-Id: <20210519190925.1723012-4-brian.gix@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210519190925.1723012-1-brian.gix@intel.com> References: <20210519190925.1723012-1-brian.gix@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org To support the widest range of mesh devices, we need to support any possible capability combinations that a remote device may request. --- tools/mesh-cfgclient.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/tools/mesh-cfgclient.c b/tools/mesh-cfgclient.c index 49069674f..a4a6f21ab 100644 --- a/tools/mesh-cfgclient.c +++ b/tools/mesh-cfgclient.c @@ -104,7 +104,17 @@ static struct model_info *cfgcli; static struct l_queue *devices; static bool prov_in_progress; -static const char *caps[] = {"static-oob", "out-numeric", "in-numeric"}; +static const char * const caps[] = {"static-oob", + "push", + "twist", + "blink", + "beep", + "vibrate", + "public-oob", + "out-alpha", + "in-alpha", + "out-numeric", + "in-numeric"}; static bool have_config; @@ -419,7 +429,7 @@ static void agent_input_done(oob_type_t type, void *buf, uint16_t len, struct l_dbus_message *reply = NULL; struct l_dbus_message_builder *builder; uint32_t val_u32; - uint8_t oob_data[16]; + uint8_t oob_data[64]; switch (type) { case NONE: @@ -435,15 +445,15 @@ static void agent_input_done(oob_type_t type, void *buf, uint16_t len, /* Fall Through */ case HEXADECIMAL: - if (len > 16) { + if (len > sizeof(oob_data)) { bt_shell_printf("Bad input length\n"); break; } - memset(oob_data, 0, 16); + memset(oob_data, 0, sizeof(oob_data)); memcpy(oob_data, buf, len); reply = l_dbus_message_new_method_return(msg); builder = l_dbus_message_builder_new(reply); - append_byte_array(builder, oob_data, 16); + append_byte_array(builder, oob_data, len); l_dbus_message_builder_finalize(builder); l_dbus_message_builder_destroy(builder); break; @@ -580,6 +590,16 @@ static struct l_dbus_message *prompt_numeric_call(struct l_dbus *dbus, return NULL; } +static struct l_dbus_message *prompt_public_call(struct l_dbus *dbus, + struct l_dbus_message *msg, + void *user_data) +{ + l_dbus_message_ref(msg); + agent_input_request(HEXADECIMAL, 64, "Enter 512 bit Public Key", + agent_input_done, msg); + return NULL; +} + static struct l_dbus_message *prompt_static_call(struct l_dbus *dbus, struct l_dbus_message *msg, void *user_data) @@ -618,6 +638,8 @@ static void setup_agent_iface(struct l_dbus_interface *iface) "u", "s", "number", "type"); l_dbus_interface_method(iface, "PromptStatic", 0, prompt_static_call, "ay", "s", "data", "type"); + l_dbus_interface_method(iface, "PublicKey", 0, prompt_public_call, + "ay", "", "data"); } static bool register_agent(void) -- 2.25.4