All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] mesh: Correctly initialize node's vendor models
@ 2019-03-21  7:32 Inga Stotland
  2019-03-21 21:26 ` Gix, Brian
  0 siblings, 1 reply; 2+ messages in thread
From: Inga Stotland @ 2019-03-21  7:32 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, johan.hedberg, luiz.dentz, Inga Stotland

This fixes vendor model initialization based on node properties
collected during Join() method call.
---
 mesh/node.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/mesh/node.c b/mesh/node.c
index 761a67af4..999d3b8c0 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -1177,17 +1177,20 @@ static void add_model_from_properties(struct node_element *ele,
 static void add_vendor_model_from_properties(struct node_element *ele,
 					struct l_dbus_message_iter *property)
 {
-	struct {
-		uint16_t v;
-		uint16_t m;
-	} id_pair;
+	struct l_dbus_message_iter ids;
+	uint16_t v;
+	uint16_t m;
 
 	if (!ele->models)
 		ele->models = l_queue_new();
 
-	while (l_dbus_message_iter_next_entry(property, &id_pair)) {
+	if (!l_dbus_message_iter_get_variant(property, "a(qq)", &ids))
+		return;
+
+	while (l_dbus_message_iter_next_entry(&ids, &v, &m)) {
 		struct mesh_model *mod;
-		mod = mesh_model_vendor_new(ele->idx, id_pair.v, id_pair.m);
+
+		mod = mesh_model_vendor_new(ele->idx, v, m);
 		l_queue_push_tail(ele->models, mod);
 	}
 }
-- 
2.17.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH BlueZ] mesh: Correctly initialize node's vendor models
  2019-03-21  7:32 [PATCH BlueZ] mesh: Correctly initialize node's vendor models Inga Stotland
@ 2019-03-21 21:26 ` Gix, Brian
  0 siblings, 0 replies; 2+ messages in thread
From: Gix, Brian @ 2019-03-21 21:26 UTC (permalink / raw)
  To: linux-bluetooth, Stotland, Inga; +Cc: luiz.dentz, johan.hedberg

Critical patch applied

On Thu, 2019-03-21 at 00:32 -0700, Inga Stotland wrote:
> This fixes vendor model initialization based on node properties
> collected during Join() method call.
> ---
>  mesh/node.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/mesh/node.c b/mesh/node.c
> index 761a67af4..999d3b8c0 100644
> --- a/mesh/node.c
> +++ b/mesh/node.c
> @@ -1177,17 +1177,20 @@ static void add_model_from_properties(struct node_element *ele,
>  static void add_vendor_model_from_properties(struct node_element *ele,
>  					struct l_dbus_message_iter *property)
>  {
> -	struct {
> -		uint16_t v;
> -		uint16_t m;
> -	} id_pair;
> +	struct l_dbus_message_iter ids;
> +	uint16_t v;
> +	uint16_t m;
>  
>  	if (!ele->models)
>  		ele->models = l_queue_new();
>  
> -	while (l_dbus_message_iter_next_entry(property, &id_pair)) {
> +	if (!l_dbus_message_iter_get_variant(property, "a(qq)", &ids))
> +		return;
> +
> +	while (l_dbus_message_iter_next_entry(&ids, &v, &m)) {
>  		struct mesh_model *mod;
> -		mod = mesh_model_vendor_new(ele->idx, id_pair.v, id_pair.m);
> +
> +		mod = mesh_model_vendor_new(ele->idx, v, m);
>  		l_queue_push_tail(ele->models, mod);
>  	}
>  }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-21 21:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21  7:32 [PATCH BlueZ] mesh: Correctly initialize node's vendor models Inga Stotland
2019-03-21 21:26 ` Gix, Brian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.