2017-11-30 20:47:53

by Michał Hobot

[permalink] [raw]
Subject: [PATCH BlueZ] Fix parsing composition data for custom models

Custom model ids consist of model id and vendor id. Instead, vendor id =
was used twice to build model id.
---
mesh/node.c | 2 +-
mesh/prov-db.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mesh/node.c b/mesh/node.c
index 3c206dc36..b906754ae 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -432,7 +432,7 @@ bool node_parse_composition(struct mesh_node *node, =
uint8_t *data, uint16_t len)
len -=3D 2;
}
while (len >=3D 4 && v--) {
- mod_id =3D get_le16(data);
+ mod_id =3D get_le16(data + 2);
vendor_id =3D get_le16(data);
mod_id |=3D (vendor_id << 16);
if (!node_set_model(node, ele->index, mod_id))
diff --git a/mesh/prov-db.c b/mesh/prov-db.c
index a012ef865..9add3f7c3 100644
--- a/mesh/prov-db.c
+++ b/mesh/prov-db.c
@@ -676,7 +676,7 @@ bool prov_db_add_node_composition(struct mesh_node =
*node, uint8_t *data,
}
=20
while (len >=3D 4 && v--) {
- mod_id =3D get_le16(data);
+ mod_id =3D get_le16(data + 2);
vendor_id =3D get_le16(data);
mod_id |=3D (vendor_id << 16);
data +=3D 4;
--=20
2.13.6 (Apple Git-96)




2017-11-30 21:19:06

by Johan Hedberg

[permalink] [raw]
Subject: Re: [PATCH BlueZ] Fix parsing composition data for custom models

Hi Michal,

On Thu, Nov 30, 2017, Michal Hobot wrote:
> Custom model ids consist of model id and vendor id. Instead, vendor id
> was used twice to build model id.
> ---
> mesh/node.c | 2 +-
> mesh/prov-db.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)

Applied. Thanks.

Johan