All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/9] monitor: Detect string format
@ 2017-12-13 12:36 Luiz Augusto von Dentz
  2017-12-13 12:36 ` [PATCH BlueZ 2/9] shared/shell: Fix parsing of optional parameters Luiz Augusto von Dentz
                   ` (7 more replies)
  0 siblings, 8 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2017-12-13 12:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

User may enter UUID in string format other then 128 bits.
---
 monitor/uuid.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/monitor/uuid.c b/monitor/uuid.c
index 9839d03be..bc638a2f3 100644
--- a/monitor/uuid.c
+++ b/monitor/uuid.c
@@ -27,6 +27,7 @@
 #endif
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include "uuid.h"
@@ -735,12 +736,28 @@ const char *uuid32_to_str(uint32_t uuid)
 const char *uuidstr_to_str(const char *uuid)
 {
 	uint32_t val;
+	size_t len;
 	int i;
 
 	if (!uuid)
 		return NULL;
 
-	if (strlen(uuid) != 36)
+	len = strlen(uuid);
+
+	if (len < 36) {
+		char *endptr = NULL;
+
+		val = strtol(uuid, &endptr, 0);
+		if (!endptr || *endptr != '\0')
+			return NULL;
+
+		if (val > UINT16_MAX)
+			return uuid32_to_str(val);
+
+		return uuid16_to_str(val);
+	}
+
+	if (len != 36)
 		return NULL;
 
 	for (i = 0; uuid128_table[i].str; i++) {
-- 
2.13.6


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

* [PATCH BlueZ 2/9] shared/shell: Fix parsing of optional parameters
  2017-12-13 12:36 [PATCH BlueZ 1/9] monitor: Detect string format Luiz Augusto von Dentz
@ 2017-12-13 12:36 ` Luiz Augusto von Dentz
  2017-12-13 12:36 ` [PATCH BlueZ 3/9] client: Rename set-filter-uuids to uuids Luiz Augusto von Dentz
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2017-12-13 12:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Optional parameters uses "[]" delimiters.
---
 src/shared/shell.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index b4fdf7043..6cdea1c7e 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -288,9 +288,9 @@ static int cmd_exec(const struct bt_shell_menu_entry *entry,
 	opt = strdup(entry->arg + len + 1);
 
 optional:
-	if (parse_args(opt, &w, "<>", flags) < 0) {
+	if (parse_args(opt, &w, "[]", flags) < 0) {
 		print_text(COLOR_HIGHLIGHT,
-				"Unable to parse mandatory command arguments");
+				"Unable to parse optional command arguments");
 		return -EINVAL;
 	}
 
-- 
2.13.6


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

* [PATCH BlueZ 3/9] client: Rename set-filter-uuids to uuids
  2017-12-13 12:36 [PATCH BlueZ 1/9] monitor: Detect string format Luiz Augusto von Dentz
  2017-12-13 12:36 ` [PATCH BlueZ 2/9] shared/shell: Fix parsing of optional parameters Luiz Augusto von Dentz
@ 2017-12-13 12:36 ` Luiz Augusto von Dentz
  2017-12-13 12:36 ` [PATCH BlueZ 4/9] client: Rename set-filter-rssi to rssi Luiz Augusto von Dentz
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2017-12-13 12:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

All commands under scan submenu are related to set-filter so remove its
portion from it and make the command return the current value if no
parameters:

[bluetooth]# uuids 0x1820
SetDiscoveryFilter success
[bluetooth]# uuids
	UUID: Internet Protocol Support (0x1820)

Note that to filter all UUIDs user must now use "all" instead of empty
list.
---
 client/main.c | 67 ++++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 41 insertions(+), 26 deletions(-)

diff --git a/client/main.c b/client/main.c
index e5a080696..8dd92549e 100644
--- a/client/main.c
+++ b/client/main.c
@@ -325,6 +325,32 @@ static void print_property(GDBusProxy *proxy, const char *name)
 	print_iter("\t", name, &iter);
 }
 
+static void print_uuid(const char *uuid)
+{
+	const char *text;
+
+	text = uuidstr_to_str(uuid);
+	if (text) {
+		char str[26];
+		unsigned int n;
+
+		str[sizeof(str) - 1] = '\0';
+
+		n = snprintf(str, sizeof(str), "%s", text);
+		if (n > sizeof(str) - 1) {
+			str[sizeof(str) - 2] = '.';
+			str[sizeof(str) - 3] = '.';
+			if (str[sizeof(str) - 4] == ' ')
+				str[sizeof(str) - 4] = '.';
+
+			n = sizeof(str) - 1;
+		}
+
+		bt_shell_printf("\tUUID: %s%*c(%s)\n", str, 26 - n, ' ', uuid);
+	} else
+		bt_shell_printf("\tUUID: %*c(%s)\n", 26, ' ', uuid);
+}
+
 static void print_uuids(GDBusProxy *proxy)
 {
 	DBusMessageIter iter, value;
@@ -335,31 +361,11 @@ static void print_uuids(GDBusProxy *proxy)
 	dbus_message_iter_recurse(&iter, &value);
 
 	while (dbus_message_iter_get_arg_type(&value) == DBUS_TYPE_STRING) {
-		const char *uuid, *text;
+		const char *uuid;
 
 		dbus_message_iter_get_basic(&value, &uuid);
 
-		text = uuidstr_to_str(uuid);
-		if (text) {
-			char str[26];
-			unsigned int n;
-
-			str[sizeof(str) - 1] = '\0';
-
-			n = snprintf(str, sizeof(str), "%s", text);
-			if (n > sizeof(str) - 1) {
-				str[sizeof(str) - 2] = '.';
-				str[sizeof(str) - 3] = '.';
-				if (str[sizeof(str) - 4] == ' ')
-					str[sizeof(str) - 4] = '.';
-
-				n = sizeof(str) - 1;
-			}
-
-			bt_shell_printf("\tUUID: %s%*c(%s)\n",
-						str, 26 - n, ' ', uuid);
-		} else
-			bt_shell_printf("\tUUID: %*c(%s)\n", 26, ' ', uuid);
+		print_uuid(uuid);
 
 		dbus_message_iter_next(&value);
 	}
@@ -1291,13 +1297,22 @@ static void cmd_set_scan_filter_commit(void)
 	}
 }
 
-static void cmd_set_scan_filter_uuids(int argc, char *argv[])
+static void cmd_scan_filter_uuids(int argc, char *argv[])
 {
+	if (argc < 2 || !strlen(argv[1])) {
+		char **uuid;
+
+		for (uuid = filtered_scan_uuids; uuid && *uuid; uuid++)
+			print_uuid(*uuid);
+
+		return;
+	}
+
 	g_strfreev(filtered_scan_uuids);
 	filtered_scan_uuids = NULL;
 	filtered_scan_uuids_len = 0;
 
-	if (argc < 2 || !strlen(argv[1]))
+	if (!strcmp(argv[1], "all"))
 		goto commit;
 
 	filtered_scan_uuids = g_strdupv(&argv[1]);
@@ -2229,8 +2244,8 @@ static const struct bt_shell_menu scan_menu = {
 	.name = "scan",
 	.desc = "Scan Options Submenu",
 	.entries = {
-	{ "set-filter-uuids", "[uuid1 uuid2 ...]", cmd_set_scan_filter_uuids,
-				"Set scan filter uuids" },
+	{ "uuids", "[all/uuid1 uuid2 ...]", cmd_scan_filter_uuids,
+				"Set/Get UUIDs filter" },
 	{ "set-filter-rssi", "[rssi]", cmd_set_scan_filter_rssi,
 				"Set scan filter rssi, and clears pathloss" },
 	{ "set-filter-pathloss", "[pathloss]", cmd_set_scan_filter_pathloss,
-- 
2.13.6


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

* [PATCH BlueZ 4/9] client: Rename set-filter-rssi to rssi
  2017-12-13 12:36 [PATCH BlueZ 1/9] monitor: Detect string format Luiz Augusto von Dentz
  2017-12-13 12:36 ` [PATCH BlueZ 2/9] shared/shell: Fix parsing of optional parameters Luiz Augusto von Dentz
  2017-12-13 12:36 ` [PATCH BlueZ 3/9] client: Rename set-filter-uuids to uuids Luiz Augusto von Dentz
@ 2017-12-13 12:36 ` Luiz Augusto von Dentz
  2017-12-13 12:36 ` [PATCH BlueZ 5/9] client: Rename set-filter-pathloss to pathloss Luiz Augusto von Dentz
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2017-12-13 12:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

All commands under scan submenu are related to set-filter so remove its
portion from it and make the command return the current value if no
parameters:

[bluetooth]# rssi 0
SetDiscoveryFilter success
[bluetooth]# rssi
RSSI: 0
---
 client/main.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/client/main.c b/client/main.c
index 8dd92549e..06e4905e9 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1327,14 +1327,16 @@ commit:
 	cmd_set_scan_filter_commit();
 }
 
-static void cmd_set_scan_filter_rssi(int argc, char *argv[])
+static void cmd_scan_filter_rssi(int argc, char *argv[])
 {
-	filtered_scan_pathloss = DISTANCE_VAL_INVALID;
+	if (argc < 2 || !strlen(argv[1])) {
+		if (filtered_scan_rssi != DISTANCE_VAL_INVALID)
+			bt_shell_printf("RSSI: %d\n", filtered_scan_rssi);
+		return;
+	}
 
-	if (argc < 2 || !strlen(argv[1]))
-		filtered_scan_rssi = DISTANCE_VAL_INVALID;
-	else
-		filtered_scan_rssi = atoi(argv[1]);
+	filtered_scan_pathloss = DISTANCE_VAL_INVALID;
+	filtered_scan_rssi = atoi(argv[1]);
 
 	cmd_set_scan_filter_commit();
 }
@@ -2246,8 +2248,8 @@ static const struct bt_shell_menu scan_menu = {
 	.entries = {
 	{ "uuids", "[all/uuid1 uuid2 ...]", cmd_scan_filter_uuids,
 				"Set/Get UUIDs filter" },
-	{ "set-filter-rssi", "[rssi]", cmd_set_scan_filter_rssi,
-				"Set scan filter rssi, and clears pathloss" },
+	{ "rssi", "[rssi]", cmd_scan_filter_rssi,
+				"Set/Get RSSI filter, and clears pathloss" },
 	{ "set-filter-pathloss", "[pathloss]", cmd_set_scan_filter_pathloss,
 				"Set scan filter pathloss, and clears rssi" },
 	{ "set-filter-transport", "[transport]", cmd_set_scan_filter_transport,
-- 
2.13.6


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

* [PATCH BlueZ 5/9] client: Rename set-filter-pathloss to pathloss
  2017-12-13 12:36 [PATCH BlueZ 1/9] monitor: Detect string format Luiz Augusto von Dentz
                   ` (2 preceding siblings ...)
  2017-12-13 12:36 ` [PATCH BlueZ 4/9] client: Rename set-filter-rssi to rssi Luiz Augusto von Dentz
@ 2017-12-13 12:36 ` Luiz Augusto von Dentz
  2017-12-13 12:36 ` [PATCH BlueZ 6/9] client: Rename set-filter-transport to transport Luiz Augusto von Dentz
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2017-12-13 12:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

All commands under scan submenu are related to set-filter so remove its
portion from it and make the command return the current value if no
parameters:

[bluetooth]# pathloss 0
SetDiscoveryFilter success
[bluetooth]# pathloss
Pathloss: 0
---
 client/main.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/client/main.c b/client/main.c
index 06e4905e9..1728a4d82 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1341,14 +1341,17 @@ static void cmd_scan_filter_rssi(int argc, char *argv[])
 	cmd_set_scan_filter_commit();
 }
 
-static void cmd_set_scan_filter_pathloss(int argc, char *argv[])
+static void cmd_scan_filter_pathloss(int argc, char *argv[])
 {
-	filtered_scan_rssi = DISTANCE_VAL_INVALID;
+	if (argc < 2 || !strlen(argv[1])) {
+		if (filtered_scan_pathloss != DISTANCE_VAL_INVALID)
+			bt_shell_printf("Pathloss: %d\n",
+						filtered_scan_pathloss);
+		return;
+	}
 
-	if (argc < 2 || !strlen(argv[1]))
-		filtered_scan_pathloss = DISTANCE_VAL_INVALID;
-	else
-		filtered_scan_pathloss = atoi(argv[1]);
+	filtered_scan_rssi = DISTANCE_VAL_INVALID;
+	filtered_scan_pathloss = atoi(argv[1]);
 
 	cmd_set_scan_filter_commit();
 }
@@ -2250,8 +2253,8 @@ static const struct bt_shell_menu scan_menu = {
 				"Set/Get UUIDs filter" },
 	{ "rssi", "[rssi]", cmd_scan_filter_rssi,
 				"Set/Get RSSI filter, and clears pathloss" },
-	{ "set-filter-pathloss", "[pathloss]", cmd_set_scan_filter_pathloss,
-				"Set scan filter pathloss, and clears rssi" },
+	{ "pathloss", "[pathloss]", cmd_scan_filter_pathloss,
+				"Set/Get Pathloss filter, and clears RSSI" },
 	{ "set-filter-transport", "[transport]", cmd_set_scan_filter_transport,
 				"Set scan filter transport" },
 	{ "set-filter-duplicate-data", "[on/off]",
-- 
2.13.6


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

* [PATCH BlueZ 6/9] client: Rename set-filter-transport to transport
  2017-12-13 12:36 [PATCH BlueZ 1/9] monitor: Detect string format Luiz Augusto von Dentz
                   ` (3 preceding siblings ...)
  2017-12-13 12:36 ` [PATCH BlueZ 5/9] client: Rename set-filter-pathloss to pathloss Luiz Augusto von Dentz
@ 2017-12-13 12:36 ` Luiz Augusto von Dentz
  2017-12-14  9:12   ` ERAMOTO Masaya
  2017-12-13 12:36 ` [PATCH BlueZ 7/9] client: Rename set-filter-duplicate-data to duplicate-data Luiz Augusto von Dentz
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2017-12-13 12:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

All commands under scan submenu are related to set-filter so remove its
portion from it and make the command return the current value if no
parameters:

[bluetooth]# transport le
SetDiscoveryFilter success
[bluetooth]# transport
Transport: le
---
 client/main.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/client/main.c b/client/main.c
index 1728a4d82..d8d911a37 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1356,14 +1356,17 @@ static void cmd_scan_filter_pathloss(int argc, char *argv[])
 	cmd_set_scan_filter_commit();
 }
 
-static void cmd_set_scan_filter_transport(int argc, char *argv[])
+static void cmd_scan_filter_transport(int argc, char *argv[])
 {
-	g_free(filtered_scan_transport);
+	if (argc < 2 || !strlen(argv[1])) {
+		if (filtered_scan_transport)
+			bt_shell_printf("Transport: %s\n",
+					filtered_scan_transport);
+		return;
+	}
 
-	if (argc < 2 || !strlen(argv[1]))
-		filtered_scan_transport = NULL;
-	else
-		filtered_scan_transport = g_strdup(argv[1]);
+	g_free(filtered_scan_transport);
+	filtered_scan_transport = g_strdup(argv[1]);
 
 	cmd_set_scan_filter_commit();
 }
@@ -2255,8 +2258,8 @@ static const struct bt_shell_menu scan_menu = {
 				"Set/Get RSSI filter, and clears pathloss" },
 	{ "pathloss", "[pathloss]", cmd_scan_filter_pathloss,
 				"Set/Get Pathloss filter, and clears RSSI" },
-	{ "set-filter-transport", "[transport]", cmd_set_scan_filter_transport,
-				"Set scan filter transport" },
+	{ "transport", "[transport]", cmd_scan_filter_transport,
+				"Set/Get transport filter" },
 	{ "set-filter-duplicate-data", "[on/off]",
 				cmd_set_scan_filter_duplicate_data,
 				"Set scan filter duplicate data",
-- 
2.13.6


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

* [PATCH BlueZ 7/9] client: Rename set-filter-duplicate-data to duplicate-data
  2017-12-13 12:36 [PATCH BlueZ 1/9] monitor: Detect string format Luiz Augusto von Dentz
                   ` (4 preceding siblings ...)
  2017-12-13 12:36 ` [PATCH BlueZ 6/9] client: Rename set-filter-transport to transport Luiz Augusto von Dentz
@ 2017-12-13 12:36 ` Luiz Augusto von Dentz
  2017-12-13 12:36 ` [PATCH BlueZ 8/9] client: Rename set-filter-clear to clear Luiz Augusto von Dentz
  2017-12-13 12:36 ` [PATCH BlueZ 9/9] client: Fix command scan:clear Luiz Augusto von Dentz
  7 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2017-12-13 12:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

All commands under scan submenu are related to set-filter so remove its
portion from it and make the command return the current value if no
parameters:

[bluetooth]# duplicate-data on
SetDiscoveryFilter success
[bluetooth]# duplicate-data
DuplicateData: on
---
 client/main.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/client/main.c b/client/main.c
index d8d911a37..849033870 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1371,11 +1371,15 @@ static void cmd_scan_filter_transport(int argc, char *argv[])
 	cmd_set_scan_filter_commit();
 }
 
-static void cmd_set_scan_filter_duplicate_data(int argc, char *argv[])
+static void cmd_scan_filter_duplicate_data(int argc, char *argv[])
 {
-	if (argc < 2 || !strlen(argv[1]))
-		filtered_scan_duplicate_data = false;
-	else if (!strcmp(argv[1], "on"))
+	if (argc < 2 || !strlen(argv[1])) {
+		bt_shell_printf("DuplicateData: %s\n",
+				filtered_scan_duplicate_data ? "on" : "off");
+		return;
+	}
+
+	if (!strcmp(argv[1], "on"))
 		filtered_scan_duplicate_data = true;
 	else if (!strcmp(argv[1], "off"))
 		filtered_scan_duplicate_data = false;
@@ -2260,9 +2264,8 @@ static const struct bt_shell_menu scan_menu = {
 				"Set/Get Pathloss filter, and clears RSSI" },
 	{ "transport", "[transport]", cmd_scan_filter_transport,
 				"Set/Get transport filter" },
-	{ "set-filter-duplicate-data", "[on/off]",
-				cmd_set_scan_filter_duplicate_data,
-				"Set scan filter duplicate data",
+	{ "duplicate-data", "[on/off]", cmd_scan_filter_duplicate_data,
+				"Set/Get duplicate data filter",
 				mode_generator },
 	{ "set-filter-clear", NULL, cmd_set_scan_filter_clear,
 				"Clears discovery filter." },
-- 
2.13.6


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

* [PATCH BlueZ 8/9] client: Rename set-filter-clear to clear
  2017-12-13 12:36 [PATCH BlueZ 1/9] monitor: Detect string format Luiz Augusto von Dentz
                   ` (5 preceding siblings ...)
  2017-12-13 12:36 ` [PATCH BlueZ 7/9] client: Rename set-filter-duplicate-data to duplicate-data Luiz Augusto von Dentz
@ 2017-12-13 12:36 ` Luiz Augusto von Dentz
  2017-12-13 12:36 ` [PATCH BlueZ 9/9] client: Fix command scan:clear Luiz Augusto von Dentz
  7 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2017-12-13 12:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

All commands under scan submenu are related to set-filter so remove its
portion from it and make the command return the current value if no
parameters.
---
 client/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/client/main.c b/client/main.c
index 849033870..1617b7cb3 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1404,7 +1404,7 @@ static void clear_discovery_filter_setup(DBusMessageIter *iter, void *user_data)
 	dbus_message_iter_close_container(iter, &dict);
 }
 
-static void cmd_set_scan_filter_clear(int argc, char *argv[])
+static void cmd_scan_filter_clear(int argc, char *argv[])
 {
 	/* set default values for all options */
 	filtered_scan_rssi = DISTANCE_VAL_INVALID;
@@ -2267,7 +2267,7 @@ static const struct bt_shell_menu scan_menu = {
 	{ "duplicate-data", "[on/off]", cmd_scan_filter_duplicate_data,
 				"Set/Get duplicate data filter",
 				mode_generator },
-	{ "set-filter-clear", NULL, cmd_set_scan_filter_clear,
+	{ "clear", NULL, cmd_scan_filter_clear,
 				"Clears discovery filter." },
 	{ } },
 };
-- 
2.13.6


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

* [PATCH BlueZ 9/9] client: Fix command scan:clear
  2017-12-13 12:36 [PATCH BlueZ 1/9] monitor: Detect string format Luiz Augusto von Dentz
                   ` (6 preceding siblings ...)
  2017-12-13 12:36 ` [PATCH BlueZ 8/9] client: Rename set-filter-clear to clear Luiz Augusto von Dentz
@ 2017-12-13 12:36 ` Luiz Augusto von Dentz
  7 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2017-12-13 12:36 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Command clear shall clear all filters including DuplicateData.
---
 client/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/client/main.c b/client/main.c
index 1617b7cb3..bbfdea80d 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1414,6 +1414,7 @@ static void cmd_scan_filter_clear(int argc, char *argv[])
 	filtered_scan_uuids_len = 0;
 	g_free(filtered_scan_transport);
 	filtered_scan_transport = NULL;
+	filtered_scan_duplicate_data = false;
 
 	if (check_default_ctrl() == FALSE)
 		return;
-- 
2.13.6


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

* Re: [PATCH BlueZ 6/9] client: Rename set-filter-transport to transport
  2017-12-13 12:36 ` [PATCH BlueZ 6/9] client: Rename set-filter-transport to transport Luiz Augusto von Dentz
@ 2017-12-14  9:12   ` ERAMOTO Masaya
  2017-12-14 10:45     ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 11+ messages in thread
From: ERAMOTO Masaya @ 2017-12-14  9:12 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On 12/13/2017 09:36 PM, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> All commands under scan submenu are related to set-filter so remove its
> portion from it and make the command return the current value if no
> parameters:
> 
> [bluetooth]# transport le
> SetDiscoveryFilter success
> [bluetooth]# transport
> Transport: le
> ---
>  client/main.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/client/main.c b/client/main.c
> index 1728a4d82..d8d911a37 100644
> --- a/client/main.c
> +++ b/client/main.c
> @@ -1356,14 +1356,17 @@ static void cmd_scan_filter_pathloss(int argc, char *argv[])
>  	cmd_set_scan_filter_commit();
>  }
>  
> -static void cmd_set_scan_filter_transport(int argc, char *argv[])
> +static void cmd_scan_filter_transport(int argc, char *argv[])
>  {
> -	g_free(filtered_scan_transport);
> +	if (argc < 2 || !strlen(argv[1])) {
> +		if (filtered_scan_transport)
> +			bt_shell_printf("Transport: %s\n",
> +					filtered_scan_transport);
> +		return;
> +	}
>  
> -	if (argc < 2 || !strlen(argv[1]))
> -		filtered_scan_transport = NULL;
> -	else
> -		filtered_scan_transport = g_strdup(argv[1]);
> +	g_free(filtered_scan_transport);
> +	filtered_scan_transport = g_strdup(argv[1]);

After applying this patch set, I think that clear command may be needed to
enhance for clearing a individual filter value. Since all values is needed to
clear when transport is not want to set after setting uuids/rssi/pathloss/data
and it.


Regards,
Eramoto


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

* Re: [PATCH BlueZ 6/9] client: Rename set-filter-transport to transport
  2017-12-14  9:12   ` ERAMOTO Masaya
@ 2017-12-14 10:45     ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 11+ messages in thread
From: Luiz Augusto von Dentz @ 2017-12-14 10:45 UTC (permalink / raw)
  To: ERAMOTO Masaya; +Cc: linux-bluetooth

Hi Eramoto,

On Thu, Dec 14, 2017 at 7:12 AM, ERAMOTO Masaya
<eramoto.masaya@jp.fujitsu.com> wrote:
> Hi Luiz,
>
> On 12/13/2017 09:36 PM, Luiz Augusto von Dentz wrote:
>> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>>
>> All commands under scan submenu are related to set-filter so remove its
>> portion from it and make the command return the current value if no
>> parameters:
>>
>> [bluetooth]# transport le
>> SetDiscoveryFilter success
>> [bluetooth]# transport
>> Transport: le
>> ---
>>  client/main.c | 19 +++++++++++--------
>>  1 file changed, 11 insertions(+), 8 deletions(-)
>>
>> diff --git a/client/main.c b/client/main.c
>> index 1728a4d82..d8d911a37 100644
>> --- a/client/main.c
>> +++ b/client/main.c
>> @@ -1356,14 +1356,17 @@ static void cmd_scan_filter_pathloss(int argc, char *argv[])
>>       cmd_set_scan_filter_commit();
>>  }
>>
>> -static void cmd_set_scan_filter_transport(int argc, char *argv[])
>> +static void cmd_scan_filter_transport(int argc, char *argv[])
>>  {
>> -     g_free(filtered_scan_transport);
>> +     if (argc < 2 || !strlen(argv[1])) {
>> +             if (filtered_scan_transport)
>> +                     bt_shell_printf("Transport: %s\n",
>> +                                     filtered_scan_transport);
>> +             return;
>> +     }
>>
>> -     if (argc < 2 || !strlen(argv[1]))
>> -             filtered_scan_transport = NULL;
>> -     else
>> -             filtered_scan_transport = g_strdup(argv[1]);
>> +     g_free(filtered_scan_transport);
>> +     filtered_scan_transport = g_strdup(argv[1]);
>
> After applying this patch set, I think that clear command may be needed to
> enhance for clearing a individual filter value. Since all values is needed to
> clear when transport is not want to set after setting uuids/rssi/pathloss/data
> and it.

Yep, that is the drawback of reusing the command to get the current
value, but perhaps we can make clear take an optional parameter to
clear individual options.

>
> Regards,
> Eramoto
>



-- 
Luiz Augusto von Dentz

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

end of thread, other threads:[~2017-12-14 10:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-13 12:36 [PATCH BlueZ 1/9] monitor: Detect string format Luiz Augusto von Dentz
2017-12-13 12:36 ` [PATCH BlueZ 2/9] shared/shell: Fix parsing of optional parameters Luiz Augusto von Dentz
2017-12-13 12:36 ` [PATCH BlueZ 3/9] client: Rename set-filter-uuids to uuids Luiz Augusto von Dentz
2017-12-13 12:36 ` [PATCH BlueZ 4/9] client: Rename set-filter-rssi to rssi Luiz Augusto von Dentz
2017-12-13 12:36 ` [PATCH BlueZ 5/9] client: Rename set-filter-pathloss to pathloss Luiz Augusto von Dentz
2017-12-13 12:36 ` [PATCH BlueZ 6/9] client: Rename set-filter-transport to transport Luiz Augusto von Dentz
2017-12-14  9:12   ` ERAMOTO Masaya
2017-12-14 10:45     ` Luiz Augusto von Dentz
2017-12-13 12:36 ` [PATCH BlueZ 7/9] client: Rename set-filter-duplicate-data to duplicate-data Luiz Augusto von Dentz
2017-12-13 12:36 ` [PATCH BlueZ 8/9] client: Rename set-filter-clear to clear Luiz Augusto von Dentz
2017-12-13 12:36 ` [PATCH BlueZ 9/9] client: Fix command scan:clear 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.