You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2021/05/27 08:20:50 UTC

[mynewt-nimble] 23/31: Revert "mesh: Fix provisioner provisioning"

This is an automated email from the ASF dual-hosted git repository.

naraj pushed a commit to branch revert-958-mesh_sync_march21
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 8c52bd2ac159fcda1ee785b33aa788fb2fc68ae0
Author: MichaƂ Narajowski <mi...@codecoup.pl>
AuthorDate: Thu May 27 10:20:19 2021 +0200

    Revert "mesh: Fix provisioner provisioning"
    
    This reverts commit 9f396bca302c892a43f79c01b96fdaa1cc417040.
---
 nimble/host/mesh/src/prov.c        |  4 ++--
 nimble/host/mesh/src/provisioner.c | 18 ++++++++----------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/nimble/host/mesh/src/prov.c b/nimble/host/mesh/src/prov.c
index 170fc1d..ba514dd 100644
--- a/nimble/host/mesh/src/prov.c
+++ b/nimble/host/mesh/src/prov.c
@@ -40,7 +40,7 @@ int bt_mesh_prov_reset_state(void (*func)(const uint8_t key[64]))
 
 	int err;
 	static struct bt_pub_key_cb pub_key_cb;
-	const size_t offset = offsetof(struct bt_mesh_prov_link, auth);
+	const size_t offset = offsetof(struct bt_mesh_prov_link, dhkey);
 
 	pub_key_cb.func = func ? func : pub_key_ready;
 
@@ -257,7 +257,7 @@ static void prov_recv(const struct prov_bearer *bearer, void *cb_data,
 
 	if (type >= ARRAY_SIZE(bt_mesh_prov_link.role->op)) {
 		BT_ERR("Unknown provisioning PDU type 0x%02x", type);
-		bt_mesh_prov_link.role->error(PROV_ERR_NVAL_PDU);
+		bt_mesh_prov_link.role->error(PROV_ERR_NVAL_FMT);
 		return;
 	}
 
diff --git a/nimble/host/mesh/src/provisioner.c b/nimble/host/mesh/src/provisioner.c
index e26efe7..d69aa66 100644
--- a/nimble/host/mesh/src/provisioner.c
+++ b/nimble/host/mesh/src/provisioner.c
@@ -168,9 +168,9 @@ static bool prov_check_method(struct bt_mesh_dev_capabilities *caps)
 		}
 
 		if (!(BIT(bt_mesh_prov_link.oob_action) & caps->input_actions)) {
-			BT_WARN("The required input action (0x%04x) "
+			BT_WARN("The required input action (0x%02x) "
 				"not supported by the device (0x%02x)",
-				(uint16_t)BIT(bt_mesh_prov_link.oob_action), caps->input_actions);
+				bt_mesh_prov_link.oob_action, caps->input_actions);
 			return false;
 		}
 
@@ -194,9 +194,9 @@ static bool prov_check_method(struct bt_mesh_dev_capabilities *caps)
 		}
 
 		if (!(BIT(bt_mesh_prov_link.oob_action) & caps->output_actions)) {
-			BT_WARN("The required output action (0x%04x) "
+			BT_WARN("The required output action (0x%02x) "
 				"not supported by the device (0x%02x)",
-				(uint16_t)BIT(bt_mesh_prov_link.oob_action), caps->output_actions);
+				bt_mesh_prov_link.oob_action, caps->output_actions);
 			return false;
 		}
 
@@ -226,11 +226,9 @@ static void prov_capabilities(const uint8_t *data)
 	BT_DBG("Static OOB Type:   0x%02x", caps.static_oob);
 	BT_DBG("Output OOB Size:   %u", caps.output_size);
 
-	caps.output_actions = (bt_mesh_output_action_t)
-		(sys_get_be16(&data[6]));
+	caps.output_actions = (bt_mesh_output_action_t)data[6];
 	caps.input_size = data[8];
-	caps.input_actions = (bt_mesh_input_action_t)
-		(sys_get_be16(&data[9]));
+	caps.input_actions = (bt_mesh_input_action_t)data[9];
 	BT_DBG("Output OOB Action: 0x%04x", caps.output_actions);
 	BT_DBG("Input OOB Size:    %u", caps.input_size);
 	BT_DBG("Input OOB Action:  0x%04x", caps.input_actions);
@@ -326,6 +324,8 @@ static void public_key_sent(int err, void *cb_data)
 		prov_dh_key_gen();
 		return;
 	}
+
+	bt_mesh_prov_link.expect = PROV_PUB_KEY;
 }
 
 static void send_pub_key(void)
@@ -355,8 +355,6 @@ static void send_pub_key(void)
 		BT_ERR("Failed to send Public Key");
 		return;
 	}
-
-	bt_mesh_prov_link.expect = PROV_PUB_KEY;
 }
 
 static void prov_dh_key_cb(const uint8_t dhkey[32])