Skip to content

Commit b817276

Browse files
committed
tools: add --verbose to interactive-evdev
1 parent ed2dc97 commit b817276

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tools/interactive-evdev.c

+12
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ struct keyboard {
5353
struct keyboard *next;
5454
};
5555

56+
static bool verbose = false;
5657
static bool terminate;
5758
static int evdev_offset = 8;
5859
static bool report_state_changes;
@@ -383,6 +384,7 @@ usage(FILE *fp, char *progname)
383384
fprintf(fp, " or: %s --keymap <path to keymap file>\n",
384385
progname);
385386
fprintf(fp, "For both:\n"
387+
" --verbose (enable verbose debugging output)\n"
386388
#ifdef ENABLE_PRIVATE_APIS
387389
" --print-modmaps (print real & virtual key modmaps)\n"
388390
#endif
@@ -415,6 +417,7 @@ main(int argc, char *argv[])
415417
const char *locale;
416418
struct sigaction act;
417419
enum options {
420+
OPT_VERBOSE,
418421
OPT_INCLUDE,
419422
OPT_INCLUDE_DEFAULTS,
420423
OPT_RULES,
@@ -434,6 +437,7 @@ main(int argc, char *argv[])
434437
};
435438
static struct option opts[] = {
436439
{"help", no_argument, 0, 'h'},
440+
{"verbose", no_argument, 0, OPT_VERBOSE},
437441
{"include", required_argument, 0, OPT_INCLUDE},
438442
{"include-defaults", no_argument, 0, OPT_INCLUDE_DEFAULTS},
439443
{"rules", required_argument, 0, OPT_RULES},
@@ -464,6 +468,9 @@ main(int argc, char *argv[])
464468
break;
465469

466470
switch (opt) {
471+
case OPT_VERBOSE:
472+
verbose = true;
473+
break;
467474
case OPT_INCLUDE:
468475
if (num_includes >= ARRAY_SIZE(includes)) {
469476
fprintf(stderr, "error: too many includes\n");
@@ -539,6 +546,11 @@ main(int argc, char *argv[])
539546
goto out;
540547
}
541548

549+
if (verbose) {
550+
xkb_context_set_log_level(ctx, XKB_LOG_LEVEL_DEBUG);
551+
xkb_context_set_log_verbosity(ctx, 10);
552+
}
553+
542554
if (num_includes == 0)
543555
includes[num_includes++] = DEFAULT_INCLUDE_PATH_PLACEHOLDER;
544556

0 commit comments

Comments
 (0)