Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp1616870lkv; Wed, 19 May 2021 14:09:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz24a7+Xo/OEOxWh+eOkfMF4+Hd6q6swrs3hLjzeqA73xIcLhgBdwDB/f9Pxv/IXDjqSxNw X-Received: by 2002:a05:6638:2a1:: with SMTP id d1mr1394083jaq.52.1621458566514; Wed, 19 May 2021 14:09:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621458566; cv=none; d=google.com; s=arc-20160816; b=NdoBw+FOf8323G9N/mmbxkq+aRv4uJhhx0ghSXbjXBqZFVypCxwpZXUW7XYBd/3lPS 0Qow/vmHKr/sR1kbd4UWerYqBT2bpXKqFlNShw4LfxgTbDhwE5EGCgx2qWdYIMLP2qP0 gn1aIVU9lHj4dpfR5uBlmoUxtFbOWeGEm4tYd1MUfeGm43cDYmOol81DxLdD+8C/qttx DoFomMh2ft2DLN1FoiZ8GStpeyCJnE6KpQg3PFWDUidyyXsuNHTIjByR2S3eDpcfFQT7 DrKJDT12Z5ElLZ0FOSmjBE4r7ohrmad/93/ZXkxq+KKuWXL+0qludXbc3QOG8Bvam/ub vIGA== 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=Ua6vIE7xpk88jpmUjLziNfhNAUBE60AaPFXmvWNwTZo=; b=WCEkShJcjz0hfuQJdDqGb8CqhhCYOkVX+y9xgoa+iooiqOnxSGl1EQY7Xk/H2cxSP3 7DYB4WaXrwC6jFkGTH3ahGj2fBZeT9ih+++MAu7M0cZyY0EBFZvS4wYQZAxmI1nTcThq +FD5Uq/VKgb0bK5qWAVRPEOvgSWl7V4K7oaUr2M91Ytd7+G4pZ04nWkQBfdGrTAyjEA0 pkRE09zUp6oU+keBXnpVAkF6bSiZJMb/b2mosyGeUZmWVuzk8hrP02eGUIaWKZZAZyUM Is+OSZ209lyMXAHHhdn+yqobEe9vvmulR5hrOKGQpDukwqRQrV4V8e/rc8dRaq7yVYAx T/vQ== 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 g16si528600jat.43.2021.05.19.14.09.12; Wed, 19 May 2021 14:09:26 -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 S233546AbhESALz (ORCPT + 99 others); Tue, 18 May 2021 20:11:55 -0400 Received: from mga18.intel.com ([134.134.136.126]:12937 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231947AbhESALz (ORCPT ); Tue, 18 May 2021 20:11:55 -0400 IronPort-SDR: WAd+CI4Y159IvF5OLDpZ0+imCFtYqZBIjEH2YdrvcV6qHxd3Kv1irxoLSE8qg86OO15ZZvTcDQ HUPRQrH8tRiA== X-IronPort-AV: E=McAfee;i="6200,9189,9988"; a="188263489" X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="188263489" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 17:10:36 -0700 IronPort-SDR: eWtAkOFJROeYMkHvA0TMkJ4MnSSlKF3Y5F/qWcJwYE8KVaz2X8CfTyzKOkei3C0CjKnZFJ4s8D ZxV/CYb23dUw== X-IronPort-AV: E=Sophos;i="5.82,310,1613462400"; d="scan'208";a="439707715" Received: from bgi1-mobl2.amr.corp.intel.com ([10.209.0.202]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2021 17:10:34 -0700 From: Brian Gix To: linux-bluetooth@vger.kernel.org Cc: inga.stotland@intel.com, brian.gix@intel.com Subject: [PATCH BlueZ 3/4] tools/mesh: Add all supported OOB methods to cfgclient Date: Tue, 18 May 2021 17:10:26 -0700 Message-Id: <20210519001027.1540720-4-brian.gix@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20210519001027.1540720-1-brian.gix@intel.com> References: <20210519001027.1540720-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..fd859a606 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 *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