Return-Path: From: sbrown@cortland.com To: linux-bluetooth@vger.kernel.org Cc: Steve Brown Subject: [PATCH V3 9/9] mesh: meshctl: Add Company ID parameter to pub-set and pub-get Date: Fri, 15 Dec 2017 06:46:06 +0000 Message-Id: <20171215064606.15051-10-sbrown@cortland.com> In-Reply-To: <20171215064606.15051-1-sbrown@cortland.com> References: <20171215064606.15051-1-sbrown@cortland.com> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: From: Steve Brown Add a CID parameter to both commands similar to bind. Correct the prior assumption that a model id > 0xffff was a vendor model. pub-set 0100 c000 1 0 0 1000 03 0001 00c0 01 00 ff 00 00 0010 pub-set 0100 c000 1 0 0 1000 1 03 0001 00c0 01 00 ff 00 00 0100 0010 --- mesh/config-client.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/mesh/config-client.c b/mesh/config-client.c index 0118b1853..0f197e322 100644 --- a/mesh/config-client.c +++ b/mesh/config-client.c @@ -780,7 +780,7 @@ static void cmd_set_pub(int argc, char *argv[]) n = mesh_opcode_set(OP_CONFIG_MODEL_PUB_SET, msg); parm_cnt = read_input_parameters(argc, argv); - if (parm_cnt != 6) { + if (parm_cnt != 6 && parm_cnt != 7) { bt_shell_printf("Bad arguments\n"); return; } @@ -800,8 +800,8 @@ static void cmd_set_pub(int argc, char *argv[]) /* Publish retransmit count & interval steps */ msg[n++] = parms[4]; /* Model Id */ - if (parms[5] > 0xffff) { - put_le16(parms[5] >> 16, msg + n); + if (parm_cnt == 7) { + put_le16(parms[6], msg + n); put_le16(parms[5], msg + n + 2); n += 4; } else { @@ -827,7 +827,7 @@ static void cmd_get_pub(int argc, char *argv[]) n = mesh_opcode_set(OP_CONFIG_MODEL_PUB_GET, msg); parm_cnt = read_input_parameters(argc, argv); - if (parm_cnt != 2) { + if (parm_cnt != 2 && parm_cnt != 3) { bt_shell_printf("Bad arguments: %s\n", argv[1]); return; } @@ -836,8 +836,8 @@ static void cmd_get_pub(int argc, char *argv[]) put_le16(parms[0], msg + n); n += 2; /* Model Id */ - if (parms[1] > 0xffff) { - put_le16(parms[1] >> 16, msg + n); + if (parm_cnt == 3) { + put_le16(parms[2], msg + n); put_le16(parms[1], msg + n + 2); n += 4; } else { @@ -1012,8 +1012,11 @@ static const struct bt_shell_menu cfg_menu = { {"ttl-get", NULL, cmd_get_ttl, "Get default TTL"}, {"pub-set", " " - " ", - cmd_set_pub, "Set publication"}, + " " + "[cid]", + cmd_set_pub, "\n\t\t\t\t\t\t Set publication"}, + {"pub-get", " [cid]", cmd_get_pub, + "Get publication"}, {"proxy-set", "", cmd_set_proxy, "Set proxy state"}, {"proxy-get", NULL, cmd_get_proxy, @@ -1027,8 +1030,6 @@ static const struct bt_shell_menu cfg_menu = { "Set relay"}, {"relay-get", NULL, cmd_get_relay, "Get relay"}, - {"pub-get", " ", cmd_get_pub, - "Get publication"}, {"hb-pub-set", " ", cmd_set_hb, "Set heartbeati publish"}, {"sub-add", " ", -- 2.11.0