2020-08-11 20:07:30

by Michał Lowas-Rzechonek

[permalink] [raw]
Subject: [PATCH BlueZ] mesh: Fix lookup of non-vendor models in node config

In commit 81a0868b082c ("mesh: Move model functionality out of node.c
to model.c"), we changed the way we handle model ids, resulting
in vendor mask not being stripped from model id before update_bindings()
calls mesh_config_model_binding_*().

This resulted in get_element_model not finding the model.
---
mesh/mesh-config-json.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mesh/mesh-config-json.c b/mesh/mesh-config-json.c
index ae1099fcb..ce8dd5cde 100644
--- a/mesh/mesh-config-json.c
+++ b/mesh/mesh-config-json.c
@@ -170,11 +170,6 @@ static json_object *get_element_model(json_object *jnode, int ele_idx,
size_t len;
char buf[9];

- if (!vendor)
- snprintf(buf, 5, "%4.4x", (uint16_t)mod_id);
- else
- snprintf(buf, 9, "%8.8x", mod_id);
-
if (!json_object_object_get_ex(jnode, "elements", &jelements))
return NULL;

@@ -190,7 +185,7 @@ static json_object *get_element_model(json_object *jnode, int ele_idx,
return NULL;

if (!vendor) {
- snprintf(buf, 5, "%4.4x", mod_id);
+ snprintf(buf, 5, "%4.4x", (uint16_t)mod_id);
len = 4;
} else {
snprintf(buf, 9, "%8.8x", mod_id);
--
2.20.1