[PATCH 11/35] monitor: add option -A / --autoconnect

mwilck
2021-01-26T20:35:03Z

From: Martin Wilck <mwilck@suse.com>

With this option, the monitor will try to connect to newly discovered
controllers.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
monitor.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/monitor.c b/monitor.c
index a7afa1c..ecf3be2 100644
--- a/monitor.c
+++ b/monitor.c
@@ -31,6 +31,10 @@
#define LOG_FUNCNAME 1
#include "log.h"

+static struct monitor_config {
+ bool autoconnect;
+} mon_cfg;
+
static struct udev *udev;

static void close_ptr(int *p)
@@ -177,6 +181,7 @@ static int monitor_parse_opts(const char *desc, int argc, char **argv)
bool debug = false;
int ret;
OPT_ARGS(opts) = {
+ OPT_FLAG("autoconnect", 'A', &mon_cfg.autoconnect, "automatically connect newly discovered controllers"),
OPT_FLAG("silent", 'S', &quiet, "log level: silent"),
OPT_FLAG("verbose", 'v', &verbose, "log level: verbose"),
OPT_FLAG("debug", 'D', &debug, "log level: debug"),
--
2.29.2