[PATCH v2 3/4] client: Add generator for scan:clear

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

This adds tab generator for scan:clear:

[bluetooth]# clear
duplicate-data  pathloss        rssi            transport       uuids
---
 client/main.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/client/main.c b/client/main.c
index 53e03f56f..9c77a34b9 100644
--- a/client/main.c
+++ b/client/main.c
@@ -1432,6 +1432,26 @@ static const struct filter_clear {
 	{}
 };
 
+static char *filter_clear_generator(const char *text, int state)
+{
+	static int index, len;
+	const char *arg;
+
+	if (!state) {
+		index = 0;
+		len = strlen(text);
+	}
+
+	while ((arg = filter_clear[index].name)) {
+		index++;
+
+		if (!strncmp(arg, text, len))
+			return strdup(arg);
+	}
+
+	return NULL;
+}
+
 static void cmd_scan_filter_clear(int argc, char *argv[])
 {
 	const struct filter_clear *fc;
@@ -2308,7 +2328,8 @@ static const struct bt_shell_menu scan_menu = {
 				mode_generator },
 	{ "clear", "[uuids/rssi/pathloss/transport/duplicate-data]",
 				cmd_scan_filter_clear,
-				"Clears discovery filter." },
+				"Clears discovery filter.",
+				filter_clear_generator },
 	{ } },
 };
 
-- 
2.13.6

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux