All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] Mesh: add 'node-reset' command
       [not found] <CGME20180319074231epcas2p40d1a1ce4df102b678bf18c95af49a4c4@epcas2p4.samsung.com>
@ 2018-03-19  7:42 ` Atul Rai
  2018-03-20 15:11   ` Stotland, Inga
  0 siblings, 1 reply; 4+ messages in thread
From: Atul Rai @ 2018-03-19  7:42 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: sachin.dev, anupam.r

This patch adds 'node-reset' command which can be used to reset a
node (other than a Provisioner) and remove it from the network.
---
 mesh/config-client.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/mesh/config-client.c b/mesh/config-client.c
index 19e617d..a6cd87e 100644
--- a/mesh/config-client.c
+++ b/mesh/config-client.c
@@ -342,6 +342,17 @@ static bool client_msg_recvd(uint16_t src, uint8_t *data,
 		bt_shell_printf("Min Hops\t%2.2x\n", data[7]);
 		bt_shell_printf("Max Hops\t%2.2x\n", data[8]);
 		break;
+
+	/* Per Mesh Profile 4.3.2.54 */
+	case OP_NODE_RESET_STATUS:
+		bt_shell_printf("Node %4.4x reset status %s\n",
+				src, mesh_status_str(data[0]));
+
+		net_release_address(node_get_primary(node),
+				(node_get_num_elements(node)));
+		/* TODO: Remove node info from database */
+		node_free(node);
+		break;
 	}
 
 	return true;
@@ -1124,6 +1135,11 @@ static void cmd_ttl_get(int argc, char *argv[])
 	cmd_default(OP_CONFIG_DEFAULT_TTL_GET);
 }
 
+static void cmd_node_reset(int argc, char *argv[])
+{
+	cmd_default(OP_NODE_RESET);
+}
+
 static const struct bt_shell_menu cfg_menu = {
 	.name = "config",
 	.desc = "Configuration Model Submenu",
@@ -1179,6 +1195,8 @@ static const struct bt_shell_menu cfg_menu = {
 				cmd_sub_add,    "Add subscription"},
 	{"sub-get", "<ele_addr> <model id>",
 				cmd_sub_get,    "Get subscription"},
+	{"node-reset",		NULL,                    cmd_node_reset,
+				"Reset a node and remove it from network"},
 	{} },
 };
 
-- 
2.7.4


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

* Re: [PATCH v3] Mesh: add 'node-reset' command
  2018-03-19  7:42 ` [PATCH v3] Mesh: add 'node-reset' command Atul Rai
@ 2018-03-20 15:11   ` Stotland, Inga
  2018-03-27 13:19     ` Atul Kumar Rai
  0 siblings, 1 reply; 4+ messages in thread
From: Stotland, Inga @ 2018-03-20 15:11 UTC (permalink / raw)
  To: a.rai@samsung.com, linux-bluetooth@vger.kernel.org
  Cc: anupam.r@samsung.com, sachin.dev@samsung.com

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

Hi Atul,

On Mon, 2018-03-19 at 13:12 +0530, Atul Rai wrote:
> This patch adds 'node-reset' command which can be used to reset a
> node (other than a Provisioner) and remove it from the network.
> ---
>  mesh/config-client.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/mesh/config-client.c b/mesh/config-client.c
> index 19e617d..a6cd87e 100644
> --- a/mesh/config-client.c
> +++ b/mesh/config-client.c
> @@ -342,6 +342,17 @@ static bool client_msg_recvd(uint16_t src,
> uint8_t *data,
>  		bt_shell_printf("Min Hops\t%2.2x\n", data[7]);
>  		bt_shell_printf("Max Hops\t%2.2x\n", data[8]);
>  		break;
> +
> +	/* Per Mesh Profile 4.3.2.54 */
> +	case OP_NODE_RESET_STATUS:
> +		bt_shell_printf("Node %4.4x reset status %s\n",
> +				src, mesh_status_str(data[0]));
> +
> +		net_release_address(node_get_primary(node),
> +				(node_get_num_elements(node)));
> +		/* TODO: Remove node info from database */
> +		node_free(node);
> +		break;
>  	}
>  
>  	return true;
> @@ -1124,6 +1135,11 @@ static void cmd_ttl_get(int argc, char
> *argv[])
>  	cmd_default(OP_CONFIG_DEFAULT_TTL_GET);
>  }
>  
> +static void cmd_node_reset(int argc, char *argv[])
> +{
> +	cmd_default(OP_NODE_RESET);
> +}
> +
>  static const struct bt_shell_menu cfg_menu = {
>  	.name = "config",
>  	.desc = "Configuration Model Submenu",
> @@ -1179,6 +1195,8 @@ static const struct bt_shell_menu cfg_menu = {
>  				cmd_sub_add,    "Add subscription"},
>  	{"sub-get", "<ele_addr> <model id>",
>  				cmd_sub_get,    "Get subscription"},
> +	{"node-reset",		NULL,                    cmd_n
> ode_reset,
> +				"Reset a node and remove it from
> network"},
>  	{} },
>  };
>  
This looks fine.
Thanks,
Inga

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

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

* Re: Re: [PATCH v3] Mesh: add 'node-reset' command
  2018-03-20 15:11   ` Stotland, Inga
@ 2018-03-27 13:19     ` Atul Kumar Rai
  2018-03-27 14:08       ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 4+ messages in thread
From: Atul Kumar Rai @ 2018-03-27 13:19 UTC (permalink / raw)
  To: linux-bluetooth@vger.kernel.org, Stotland, Inga
  Cc: Anupam Roy, SACHIN DEV SHARMA

Ping.

>=C2=A0Hi=C2=A0Atul,=0D=0A>=0D=0A>=C2=A0On=C2=A0Mon,=C2=A02018-03-19=C2=A0a=
t=C2=A013:12=C2=A0+0530,=C2=A0Atul=C2=A0Rai=C2=A0wrote:=0D=0A>>=C2=A0This=
=C2=A0patch=C2=A0adds=C2=A0'node-reset'=C2=A0command=C2=A0which=C2=A0can=C2=
=A0be=C2=A0used=C2=A0to=C2=A0reset=C2=A0a=0D=0A>>=C2=A0node=C2=A0(other=C2=
=A0than=C2=A0a=C2=A0Provisioner)=C2=A0and=C2=A0remove=C2=A0it=C2=A0from=C2=
=A0the=C2=A0network.=0D=0A>>=C2=A0---=0D=0A>>=C2=A0=C2=A0mesh/config-client=
.c=C2=A0=7C=C2=A018=C2=A0++++++++++++++++++=0D=0A>>=C2=A0=C2=A01=C2=A0file=
=C2=A0changed,=C2=A018=C2=A0insertions(+)=0D=0A>>=C2=A0=0D=0A>>=C2=A0diff=
=C2=A0--git=C2=A0a/mesh/config-client.c=C2=A0b/mesh/config-client.c=0D=0A>>=
=C2=A0index=C2=A019e617d..a6cd87e=C2=A0100644=0D=0A>>=C2=A0---=C2=A0a/mesh/=
config-client.c=0D=0A>>=C2=A0+++=C2=A0b/mesh/config-client.c=0D=0A>>=C2=A0=
=40=40=C2=A0-342,6=C2=A0+342,17=C2=A0=40=40=C2=A0static=C2=A0bool=C2=A0clie=
nt_msg_recvd(uint16_t=C2=A0src,=0D=0A>>=C2=A0uint8_t=C2=A0*data,=0D=0A>>=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0bt_shell_printf(=22Min=C2=A0Hops=5Ct%2.2x=5Cn=
=22,=C2=A0data=5B7=5D);=0D=0A>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0bt_shell_=
printf(=22Max=C2=A0Hops=5Ct%2.2x=5Cn=22,=C2=A0data=5B8=5D);=0D=0A>>=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0break;=0D=0A>>=C2=A0+=0D=0A>>=C2=A0+=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0/*=C2=A0Per=C2=A0Mesh=C2=A0Profile=C2=
=A04.3.2.54=C2=A0*/=0D=0A>>=C2=A0+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0case=C2=A0OP_NODE_RESET_STATUS:=0D=0A>>=C2=A0+=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0bt_shell_printf(=22Node=C2=A0%4.4x=C2=A0reset=C2=A0status=C2=A0%s=5Cn=22=
,=0D=0A>>=C2=A0+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0src,=C2=A0mesh_=
status_str(data=5B0=5D));=0D=0A>>=C2=A0+=0D=0A>>=C2=A0+=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0net_release_address(node_get_primary(node),=0D=0A>>=C2=A0+=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0(node_get_num_elements(node)));=0D=0A>>=C2=A0=
+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0/*=C2=A0TODO:=C2=A0Remove=C2=A0node=C2=A0info=C2=A0=
from=C2=A0database=C2=A0*/=0D=0A>>=C2=A0+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0node_free(no=
de);=0D=0A>>=C2=A0+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0break;=0D=0A>>=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=7D=0D=0A>>=C2=A0=C2=A0=0D=0A>>=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0return=C2=A0tru=
e;=0D=0A>>=C2=A0=40=40=C2=A0-1124,6=C2=A0+1135,11=C2=A0=40=40=C2=A0static=
=C2=A0void=C2=A0cmd_ttl_get(int=C2=A0argc,=C2=A0char=0D=0A>>=C2=A0*argv=5B=
=5D)=0D=0A>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0cmd=
_default(OP_CONFIG_DEFAULT_TTL_GET);=0D=0A>>=C2=A0=C2=A0=7D=0D=0A>>=C2=A0=
=C2=A0=0D=0A>>=C2=A0+static=C2=A0void=C2=A0cmd_node_reset(int=C2=A0argc,=C2=
=A0char=C2=A0*argv=5B=5D)=0D=0A>>=C2=A0+=7B=0D=0A>>=C2=A0+=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0cmd_default(OP_NODE_RESET);=0D=0A>>=C2=A0+=
=7D=0D=0A>>=C2=A0+=0D=0A>>=C2=A0=C2=A0static=C2=A0const=C2=A0struct=C2=A0bt=
_shell_menu=C2=A0cfg_menu=C2=A0=3D=C2=A0=7B=0D=0A>>=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0.name=C2=A0=3D=C2=A0=22config=22,=0D=0A=
>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0.desc=C2=A0=
=3D=C2=A0=22Configuration=C2=A0Model=C2=A0Submenu=22,=0D=0A>>=C2=A0=40=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=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0cmd_n=
=0D=0A>>=C2=A0ode_reset,=0D=0A>>=C2=A0+=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=22Reset=C2=A0a=C2=A0node=C2=A0and=C2=A0remove=C2=A0it=C2=A0from=0D=
=0A>>=C2=A0network=22=7D,=0D=0A>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=7B=7D=C2=A0=7D,=0D=0A>>=C2=A0=C2=A0=7D;=0D=0A>>=C2=A0=C2=
=A0=0D=0A>=C2=A0This=C2=A0looks=C2=A0fine.=0D=0A>=C2=A0Thanks,=0D=0A>=C2=A0=
Inga

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

* Re: Re: [PATCH v3] Mesh: add 'node-reset' command
  2018-03-27 13:19     ` Atul Kumar Rai
@ 2018-03-27 14:08       ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2018-03-27 14:08 UTC (permalink / raw)
  To: Atul Rai
  Cc: linux-bluetooth@vger.kernel.org, Stotland, Inga, Anupam Roy,
	SACHIN DEV SHARMA

Hi Atul,

On Tue, Mar 27, 2018 at 4:19 PM, Atul Kumar Rai <a.rai@samsung.com> wrote:
> Ping.
>
>> Hi Atul,
>>
>> On Mon, 2018-03-19 at 13:12 +0530, Atul Rai wrote:
>>> This patch adds 'node-reset' command which can be used to reset a
>>> node (other than a Provisioner) and remove it from the network.
>>> ---
>>>  mesh/config-client.c | 18 ++++++++++++++++++
>>>  1 file changed, 18 insertions(+)
>>>
>>> diff --git a/mesh/config-client.c b/mesh/config-client.c
>>> index 19e617d..a6cd87e 100644
>>> --- a/mesh/config-client.c
>>> +++ b/mesh/config-client.c
>>> @@ -342,6 +342,17 @@ static bool client_msg_recvd(uint16_t src,
>>> uint8_t *data,
>>>                  bt_shell_printf("Min Hops\t%2.2x\n", data[7]);
>>>                  bt_shell_printf("Max Hops\t%2.2x\n", data[8]);
>>>                  break;
>>> +
>>> +        /* Per Mesh Profile 4.3.2.54 */
>>> +        case OP_NODE_RESET_STATUS:
>>> +                bt_shell_printf("Node %4.4x reset status %s\n",
>>> +                                src, mesh_status_str(data[0]));
>>> +
>>> +                net_release_address(node_get_primary(node),
>>> +                                (node_get_num_elements(node)));
>>> +                /* TODO: Remove node info from database */
>>> +                node_free(node);
>>> +                break;
>>>          }
>>>
>>>          return true;
>>> @@ -1124,6 +1135,11 @@ static void cmd_ttl_get(int argc, char
>>> *argv[])
>>>          cmd_default(OP_CONFIG_DEFAULT_TTL_GET);
>>>  }
>>>
>>> +static void cmd_node_reset(int argc, char *argv[])
>>> +{
>>> +        cmd_default(OP_NODE_RESET);
>>> +}
>>> +
>>>  static const struct bt_shell_menu cfg_menu = {
>>>          .name = "config",
>>>          .desc = "Configuration Model Submenu",
>>> @@ -1179,6 +1195,8 @@ static const struct bt_shell_menu cfg_menu = {
>>>                                  cmd_sub_add,    "Add subscription"},
>>>          {"sub-get", "<ele_addr> <model id>",
>>>                                  cmd_sub_get,    "Get subscription"},
>>> +        {"node-reset",                NULL,                    cmd_n
>>> ode_reset,
>>> +                                "Reset a node and remove it from
>>> network"},
>>>          {} },
>>>  };
>>>
>> This looks fine.
>> Thanks,
>> Inga

Applied, thanks.

-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2018-03-27 14:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20180319074231epcas2p40d1a1ce4df102b678bf18c95af49a4c4@epcas2p4.samsung.com>
2018-03-19  7:42 ` [PATCH v3] Mesh: add 'node-reset' command Atul Rai
2018-03-20 15:11   ` Stotland, Inga
2018-03-27 13:19     ` Atul Kumar Rai
2018-03-27 14:08       ` Luiz Augusto von Dentz

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.