From 55d92c8f6192240764bda46c3722292143153670 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 25 Aug 2020 09:01:50 +1000 Subject: [PATCH] tools/demo-client: hook up --verbose Signed-off-by: Peter Hutterer --- tools/ei-demo-client.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/ei-demo-client.c b/tools/ei-demo-client.c index 8913ba5..687352c 100644 --- a/tools/ei-demo-client.c +++ b/tools/ei-demo-client.c @@ -112,7 +112,7 @@ static void usage(FILE *fp, const char *argv0) { fprintf(fp, - "Usage: %s [--socket]\n" + "Usage: %s [--verbose] [--socket]\n" "\n" "Start an EI demo client. The client will connect to EIS\n" "with the chosen backend (default: socket) and emulate pointer\n" @@ -121,6 +121,7 @@ usage(FILE *fp, const char *argv0) "Options:\n" " --socket Use the socket backend. The socket path is $LIBEI_SOCKET if set, \n" " otherwise XDG_RUNTIME/eis-0\n", + " --verbose Enable debugging output\n", argv0); } @@ -129,6 +130,7 @@ int main(int argc, char **argv) enum { SOCKET, } backend = SOCKET; + bool verbose = false; while (1) { enum { @@ -137,6 +139,7 @@ int main(int argc, char **argv) }; static struct option long_opts[] = { {"socket", no_argument, 0, OPT_BACKEND_SOCKET}, + {"verbose", no_argument, 0, OPT_VERBOSE}, {"help", no_argument, 0, 'h'}, {NULL}, }; @@ -150,6 +153,9 @@ int main(int argc, char **argv) case 'h': usage(stdout, argv[0]); return EXIT_SUCCESS; + case OPT_VERBOSE: + verbose = true; + break; case OPT_BACKEND_SOCKET: backend = SOCKET; break; @@ -162,7 +168,8 @@ int main(int argc, char **argv) _cleanup_(ei_unrefp) struct ei *ei = ei_new(NULL); assert(ei); - ei_log_set_priority(ei, EI_LOG_PRIORITY_DEBUG); + if (verbose) + ei_log_set_priority(ei, EI_LOG_PRIORITY_DEBUG); ei_configure_name(ei, "ei-demo-client");