Skip to contentSkip to conversation

mesh: meshctl add Node Identity option to connect command

PATCH Applied Steve Brown 3 participants 3 messages Dec 4, 2017 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mesh: meshctl add Node Identity option to connect command

This adds the option to connect via either Node Identity or Network ID advertisements. Adding the node unicast address selects Node Identity.

See Mesh Profile Specification 7.2.2.2 for further details.

---

mesh/main.c +14 -5
index d7e45e56b..e19b7f413 100644
@@ -1773,6 +1774,8 @@ static void cmd_connect(const char *arg)
 			rl_printf("Invalid network index %s\n", arg);
 			return;
 		}
+
+		connection.unicast = strtol(end, NULL, 16);
 	}
 
 	if (discovering)
@@ -1782,11 +1785,17 @@ static void cmd_connect(const char *arg)
 	set_scan_filter_uuids(MESH_PROXY_SVC_UUID);
 	discover_mesh = true;
 
-	connection.type = CONN_TYPE_NETWORK;
-
+	if (connection.unicast == UNASSIGNED_ADDRESS) {
+		connection.type = CONN_TYPE_NETWORK;
+		rl_printf("Looking for mesh network with net index %4.4x\n",
+				connection.net_idx);
+	} else {
+		connection.type = CONN_TYPE_IDENTITY;
+		rl_printf("Looking for node id %4.4x"
+				" on network with net index %4.4x\n",
+				connection.unicast, connection.net_idx);
+	}
 
-	rl_printf("Looking for mesh network with net index %4.4x\n",
-							connection.net_idx);
 
 	if (g_dbus_proxy_method_call(default_ctrl->proxy,
 			"StartDiscovery", NULL, start_discovery_reply,
@@ -2005,7 +2014,8 @@ static const struct menu_entry meshctl_cmd_table[] = {
 	{ "security",     "[0(low)/1(medium)/2(high)]", cmd_security,
 				"Display or change provision security level"},
 	{ "info",         "[dev]",    cmd_info, "Device information"},
-	{ "connect",      "[net_idx]",cmd_connect, "Connect to mesh network"},
+	{ "connect",      "[net_idx] [dst]",cmd_connect,
+				"Connect to mesh network or node on network"},
 	{ "discover-unprovisioned", "<on/off>", cmd_scan_unprovisioned_devices,
 					"Look for devices to provision" },
 	{ "provision",    "<uuid>",   cmd_start_prov, "Initiate provisioning"},
#1 lore raw

Hi Steve,

Quoted 66 lines · Steve Brown

This adds the option to connect via either Node Identity or Network ID
advertisements. Adding the node unicast address selects Node Identity.

See Mesh Profile Specification 7.2.2.2 for further details.

---

mesh/main.c +2 -0
index d7e45e56b..e19b7f413 100644
@@ -1773,6 +1774,8 @@ static void cmd_connect(const char *arg)
 			rl_printf("Invalid network index %s\n",
 arg);
 			return;
 		}
+
+		connection.unicast = strtol(end, NULL, 16);
 	}
 
mesh/main.c +10 -4
 	if (discovering)
@@ -1782,11 +1785,17 @@ static void cmd_connect(const char *arg)
 	set_scan_filter_uuids(MESH_PROXY_SVC_UUID);
 	discover_mesh = true;
 
-	connection.type = CONN_TYPE_NETWORK;
-
+	if (connection.unicast == UNASSIGNED_ADDRESS) {
+		connection.type = CONN_TYPE_NETWORK;
+		rl_printf("Looking for mesh network with net index
 %4.4x\n",
+				connection.net_idx);
+	} else {
+		connection.type = CONN_TYPE_IDENTITY;
+		rl_printf("Looking for node id %4.4x"
+				" on network with net index
 %4.4x\n",
+				connection.unicast,
 connection.net_idx);
+	}
 
-	rl_printf("Looking for mesh network with net index %4.4x\n",
-							connection.n

et_idx);

mesh/main.c +0 -0
 	if (g_dbus_proxy_method_call(default_ctrl->proxy,
 			"StartDiscovery", NULL,

start_discovery_reply,

mesh/main.c +0 -1
@@ -2005,7 +2014,8 @@ static const struct menu_entry
 meshctl_cmd_table[] = {
 	{ "security",     "[0(low)/1(medium)/2(high)]",
 cmd_security,
 				"Display or change provision
 security level"},
 	{ "info",         "[dev]",    cmd_info, "Device
 information"},
-	{ "connect",      "[net_idx]",cmd_connect, "Connect to mesh

network"},

mesh/main.c +2 -0
+	{ "connect",      "[net_idx] [dst]",cmd_connect,
+				"Connect to mesh network or node on

network"},
{ "discover-unprovisioned", "<on/off>",
cmd_scan_unprovisioned_devices,
"Look for devices to

Quoted 8 lines

provision" },
{ "provision", "<uuid>", cmd_start_prov, "Initiate
provisioning"},
--
To unsubscribe from this list: send the line "unsubscribe linux- bluetooth" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

This is a valid extension. The patch looks good.

Thanks,

Inga

#2 lore raw
In reply to Steve Brown

Hi Steve,

Quoted 4 lines · Steve Brown

This adds the option to connect via either Node Identity or Network ID advertisements. Adding the node unicast address selects Node Identity.

See Mesh Profile Specification 7.2.2.2 for further details.

Applied. Thanks.

Johan