linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] mesh: Fix D-Bus node path
@ 2019-06-28  8:27 Michał Lowas-Rzechonek
  2019-06-28  8:27 ` [PATCH BlueZ 2/2] mesh: Register D-Bus management interface Michał Lowas-Rzechonek
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michał Lowas-Rzechonek @ 2019-06-28  8:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Inga Stotland

According to doc/mesh-api.txt, node object should be located at
/org/bluez/mesh/node.
---
 mesh/node.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mesh/node.c b/mesh/node.c
index c2feaee52..45383b7d5 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -47,7 +47,6 @@
 #define MIN_COMP_SIZE 14
 
 #define MESH_NODE_PATH_PREFIX "/node"
-#define MESH_ELEMENT_PATH_PREFIX "/ele"
 
 /* Default values for a new locally created node */
 #define DEFAULT_NEW_UNICAST 0x0001
@@ -1021,7 +1020,8 @@ static bool register_node_object(struct mesh_node *node)
 	if (!hex2str(node->uuid, sizeof(node->uuid), uuid, sizeof(uuid)))
 		return false;
 
-	node->path = l_strdup_printf(MESH_NODE_PATH_PREFIX "%s", uuid);
+	node->path = l_strdup_printf(BLUEZ_MESH_PATH MESH_NODE_PATH_PREFIX
+								"%s", uuid);
 
 	if (!l_dbus_object_add_interface(dbus_get_bus(), node->path,
 					MESH_NODE_INTERFACE, node))
-- 
2.19.1


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

* [PATCH BlueZ 2/2] mesh: Register D-Bus management interface
  2019-06-28  8:27 [PATCH BlueZ 1/2] mesh: Fix D-Bus node path Michał Lowas-Rzechonek
@ 2019-06-28  8:27 ` Michał Lowas-Rzechonek
  2019-07-01 19:39   ` Michał Lowas-Rzechonek
  2019-07-01 19:44   ` Gix, Brian
  2019-07-01  6:07 ` [PATCH BlueZ 1/2] mesh: Fix D-Bus node path Stotland, Inga
  2019-07-01 16:34 ` Gix, Brian
  2 siblings, 2 replies; 6+ messages in thread
From: Michał Lowas-Rzechonek @ 2019-06-28  8:27 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Inga Stotland

When application Attach()es itself, start exposing both Node1 and
Management1 D-Bus interfaces.
---
 mesh/node.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/mesh/node.c b/mesh/node.c
index 45383b7d5..a2ac747a1 100644
--- a/mesh/node.c
+++ b/mesh/node.c
@@ -259,9 +259,14 @@ static void free_node_resources(void *data)
 	if (node->disc_watch)
 		l_dbus_remove_watch(dbus_get_bus(), node->disc_watch);
 
-	if (node->path)
+	if (node->path) {
 		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
 							MESH_NODE_INTERFACE);
+
+		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
+					       MESH_MANAGEMENT_INTERFACE);
+	}
+
 	l_free(node->path);
 
 	l_free(node);
@@ -434,6 +439,7 @@ void node_cleanup_all(void)
 {
 	l_queue_destroy(nodes, cleanup_node);
 	l_dbus_unregister_interface(dbus_get_bus(), MESH_NODE_INTERFACE);
+	l_dbus_unregister_interface(dbus_get_bus(), MESH_MANAGEMENT_INTERFACE);
 }
 
 bool node_is_provisioned(struct mesh_node *node)
@@ -1024,7 +1030,11 @@ static bool register_node_object(struct mesh_node *node)
 								"%s", uuid);
 
 	if (!l_dbus_object_add_interface(dbus_get_bus(), node->path,
-					MESH_NODE_INTERFACE, node))
+						MESH_NODE_INTERFACE, node))
+		return false;
+
+	if (!l_dbus_object_add_interface(dbus_get_bus(), node->path,
+					MESH_MANAGEMENT_INTERFACE, node))
 		return false;
 
 	return true;
@@ -1046,6 +1056,9 @@ static void app_disc_cb(struct l_dbus *bus, void *user_data)
 	if (node->path) {
 		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
 							MESH_NODE_INTERFACE);
+
+		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
+						MESH_MANAGEMENT_INTERFACE);
 		l_free(node->app_path);
 		node->app_path = NULL;
 	}
-- 
2.19.1


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

* Re: [PATCH BlueZ 1/2] mesh: Fix D-Bus node path
  2019-06-28  8:27 [PATCH BlueZ 1/2] mesh: Fix D-Bus node path Michał Lowas-Rzechonek
  2019-06-28  8:27 ` [PATCH BlueZ 2/2] mesh: Register D-Bus management interface Michał Lowas-Rzechonek
@ 2019-07-01  6:07 ` Stotland, Inga
  2019-07-01 16:34 ` Gix, Brian
  2 siblings, 0 replies; 6+ messages in thread
From: Stotland, Inga @ 2019-07-01  6:07 UTC (permalink / raw)
  To: michal.lowas-rzechonek@silvair.com, Gix, Brian
  Cc: linux-bluetooth@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]

Hi Michal,

On Fri, 2019-06-28 at 10:27 +0200, Michał Lowas-Rzechonek wrote:
> According to doc/mesh-api.txt, node object should be located at
> /org/bluez/mesh/node.
> ---
>  mesh/node.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mesh/node.c b/mesh/node.c
> index c2feaee52..45383b7d5 100644
> --- a/mesh/node.c
> +++ b/mesh/node.c
> @@ -47,7 +47,6 @@
>  #define MIN_COMP_SIZE 14
>  
>  #define MESH_NODE_PATH_PREFIX "/node"
> -#define MESH_ELEMENT_PATH_PREFIX "/ele"
>  
>  /* Default values for a new locally created node */
>  #define DEFAULT_NEW_UNICAST 0x0001
> @@ -1021,7 +1020,8 @@ static bool register_node_object(struct
> mesh_node *node)
>  	if (!hex2str(node->uuid, sizeof(node->uuid), uuid,
> sizeof(uuid)))
>  		return false;
>  
> -	node->path = l_strdup_printf(MESH_NODE_PATH_PREFIX "%s", uuid);
> +	node->path = l_strdup_printf(BLUEZ_MESH_PATH
> MESH_NODE_PATH_PREFIX
> +								"%s",
> uuid);
>  
>  	if (!l_dbus_object_add_interface(dbus_get_bus(), node->path,
>  					MESH_NODE_INTERFACE, node))

Good catch.

Brian, coud you please apply?

Thanks,
Inga

[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 3265 bytes --]

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

* Re: [PATCH BlueZ 1/2] mesh: Fix D-Bus node path
  2019-06-28  8:27 [PATCH BlueZ 1/2] mesh: Fix D-Bus node path Michał Lowas-Rzechonek
  2019-06-28  8:27 ` [PATCH BlueZ 2/2] mesh: Register D-Bus management interface Michał Lowas-Rzechonek
  2019-07-01  6:07 ` [PATCH BlueZ 1/2] mesh: Fix D-Bus node path Stotland, Inga
@ 2019-07-01 16:34 ` Gix, Brian
  2 siblings, 0 replies; 6+ messages in thread
From: Gix, Brian @ 2019-07-01 16:34 UTC (permalink / raw)
  To: michal.lowas-rzechonek@silvair.com,
	linux-bluetooth@vger.kernel.org
  Cc: Stotland, Inga

Patch Applied

On Fri, 2019-06-28 at 10:27 +0200, Michał Lowas-Rzechonek wrote:
> According to doc/mesh-api.txt, node object should be located at
> /org/bluez/mesh/node.
> ---
>  mesh/node.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mesh/node.c b/mesh/node.c
> index c2feaee52..45383b7d5 100644
> --- a/mesh/node.c
> +++ b/mesh/node.c
> @@ -47,7 +47,6 @@
>  #define MIN_COMP_SIZE 14
>  
>  #define MESH_NODE_PATH_PREFIX "/node"
> -#define MESH_ELEMENT_PATH_PREFIX "/ele"
>  
>  /* Default values for a new locally created node */
>  #define DEFAULT_NEW_UNICAST 0x0001
> @@ -1021,7 +1020,8 @@ static bool register_node_object(struct mesh_node *node)
>  	if (!hex2str(node->uuid, sizeof(node->uuid), uuid, sizeof(uuid)))
>  		return false;
>  
> -	node->path = l_strdup_printf(MESH_NODE_PATH_PREFIX "%s", uuid);
> +	node->path = l_strdup_printf(BLUEZ_MESH_PATH MESH_NODE_PATH_PREFIX
> +								"%s", uuid);
>  
>  	if (!l_dbus_object_add_interface(dbus_get_bus(), node->path,
>  					MESH_NODE_INTERFACE, node))

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

* Re: [PATCH BlueZ 2/2] mesh: Register D-Bus management interface
  2019-06-28  8:27 ` [PATCH BlueZ 2/2] mesh: Register D-Bus management interface Michał Lowas-Rzechonek
@ 2019-07-01 19:39   ` Michał Lowas-Rzechonek
  2019-07-01 19:44   ` Gix, Brian
  1 sibling, 0 replies; 6+ messages in thread
From: Michał Lowas-Rzechonek @ 2019-07-01 19:39 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Inga Stotland, Brian Gix

Hi Inga, Brian,

On 06/28, Michał Lowas-Rzechonek wrote:
> When application Attach()es itself, start exposing both Node1 and
> Management1 D-Bus interfaces.

How about this one? It's needed if the application wants to use remote
device keys imported via ImportRemoteNode API.

regards
-- 
Michał Lowas-Rzechonek <michal.lowas-rzechonek@silvair.com>
Silvair http://silvair.com
Jasnogórska 44, 31-358 Krakow, POLAND

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

* RE: [PATCH BlueZ 2/2] mesh: Register D-Bus management interface
  2019-06-28  8:27 ` [PATCH BlueZ 2/2] mesh: Register D-Bus management interface Michał Lowas-Rzechonek
  2019-07-01 19:39   ` Michał Lowas-Rzechonek
@ 2019-07-01 19:44   ` Gix, Brian
  1 sibling, 0 replies; 6+ messages in thread
From: Gix, Brian @ 2019-07-01 19:44 UTC (permalink / raw)
  To: Michal Lowas-Rzechonek, linux-bluetooth@vger.kernel.org; +Cc: Stotland, Inga

Applied, Thanks.

> -----Original Message-----
> From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth-
> owner@vger.kernel.org] On Behalf Of Michal Lowas-Rzechonek
> Sent: Friday, June 28, 2019 1:28 AM
> To: linux-bluetooth@vger.kernel.org
> Cc: Stotland, Inga <inga.stotland@intel.com>
> Subject: [PATCH BlueZ 2/2] mesh: Register D-Bus management interface
> 
> When application Attach()es itself, start exposing both Node1 and
> Management1 D-Bus interfaces.
> ---
>  mesh/node.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/mesh/node.c b/mesh/node.c
> index 45383b7d5..a2ac747a1 100644
> --- a/mesh/node.c
> +++ b/mesh/node.c
> @@ -259,9 +259,14 @@ static void free_node_resources(void *data)
>  	if (node->disc_watch)
>  		l_dbus_remove_watch(dbus_get_bus(), node->disc_watch);
> 
> -	if (node->path)
> +	if (node->path) {
>  		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
> 
> 	MESH_NODE_INTERFACE);
> +
> +		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
> +
> MESH_MANAGEMENT_INTERFACE);
> +	}
> +
>  	l_free(node->path);
> 
>  	l_free(node);
> @@ -434,6 +439,7 @@ void node_cleanup_all(void)  {
>  	l_queue_destroy(nodes, cleanup_node);
>  	l_dbus_unregister_interface(dbus_get_bus(),
> MESH_NODE_INTERFACE);
> +	l_dbus_unregister_interface(dbus_get_bus(),
> +MESH_MANAGEMENT_INTERFACE);
>  }
> 
>  bool node_is_provisioned(struct mesh_node *node) @@ -1024,7 +1030,11
> @@ static bool register_node_object(struct mesh_node *node)
>  								"%s", uuid);
> 
>  	if (!l_dbus_object_add_interface(dbus_get_bus(), node->path,
> -					MESH_NODE_INTERFACE, node))
> +						MESH_NODE_INTERFACE,
> node))
> +		return false;
> +
> +	if (!l_dbus_object_add_interface(dbus_get_bus(), node->path,
> +					MESH_MANAGEMENT_INTERFACE,
> node))
>  		return false;
> 
>  	return true;
> @@ -1046,6 +1056,9 @@ static void app_disc_cb(struct l_dbus *bus, void
> *user_data)
>  	if (node->path) {
>  		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
> 
> 	MESH_NODE_INTERFACE);
> +
> +		l_dbus_object_remove_interface(dbus_get_bus(), node->path,
> +
> 	MESH_MANAGEMENT_INTERFACE);
>  		l_free(node->app_path);
>  		node->app_path = NULL;
>  	}
> --
> 2.19.1


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

end of thread, other threads:[~2019-07-01 19:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-28  8:27 [PATCH BlueZ 1/2] mesh: Fix D-Bus node path Michał Lowas-Rzechonek
2019-06-28  8:27 ` [PATCH BlueZ 2/2] mesh: Register D-Bus management interface Michał Lowas-Rzechonek
2019-07-01 19:39   ` Michał Lowas-Rzechonek
2019-07-01 19:44   ` Gix, Brian
2019-07-01  6:07 ` [PATCH BlueZ 1/2] mesh: Fix D-Bus node path Stotland, Inga
2019-07-01 16:34 ` Gix, Brian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).