summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2018-06-06 14:39:39 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2018-06-08 14:37:22 +1000
commitd0fa740ad917f462dcd8e2fbe2979be12311fdf6 (patch)
treeebc3fb7d48ef55edadcd633fc8ee9a9267d016ea /tools
parentb926497cc6efc87d89bb05b5d44640822fbdb21b (diff)
Hook up list-quirks --validate for the test suite
All the tests fill fail anyway if the validation fails but this is a quick way to fail everything early. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/libinput-list-quirks.c24
-rw-r--r--tools/libinput-list-quirks.man10
2 files changed, 29 insertions, 5 deletions
diff --git a/tools/libinput-list-quirks.c b/tools/libinput-list-quirks.c
index 73e84895..009f7d64 100644
--- a/tools/libinput-list-quirks.c
+++ b/tools/libinput-list-quirks.c
@@ -136,21 +136,27 @@ list_device_quirks(struct quirks_context *ctx, struct udev_device *device)
static void
usage(void)
{
- printf("Usage: %s [--data-dir /path/to/data/dir] /dev/input/event0\n",
+ printf("Usage:\n"
+ " %s [--data-dir /path/to/data/dir] /dev/input/event0\n"
+ " Print the quirks for the given device\n"
+ "\n",
+ program_invocation_short_name);
+ printf(" %s [--data-dir /path/to/data/dir] --validate-only\n"
+ " Validate the database\n",
program_invocation_short_name);
- printf("Note: this tool also takes a syspath\n");
}
int
main(int argc, char **argv)
{
- struct udev *udev;
+ struct udev *udev = NULL;
struct udev_device *device = NULL;
const char *path;
const char *data_path = NULL,
*override_file = NULL;
int rc = 1;
struct quirks_context *quirks;
+ bool validate = false;
while (1) {
int c;
@@ -158,11 +164,13 @@ main(int argc, char **argv)
enum {
OPT_VERBOSE,
OPT_DATADIR,
+ OPT_VALIDATE,
};
static struct option opts[] = {
{ "help", no_argument, 0, 'h' },
{ "verbose", no_argument, 0, OPT_VERBOSE },
{ "data-dir", required_argument, 0, OPT_DATADIR },
+ { "validate-only", no_argument, 0, OPT_VALIDATE },
{ 0, 0, 0, 0}
};
@@ -184,13 +192,16 @@ main(int argc, char **argv)
case OPT_DATADIR:
data_path = optarg;
break;
+ case OPT_VALIDATE:
+ validate = true;
+ break;
default:
usage();
return 1;
}
}
- if (optind >= argc) {
+ if (optind >= argc && !validate) {
usage();
return 1;
}
@@ -214,6 +225,11 @@ main(int argc, char **argv)
return 1;
}
+ if (validate) {
+ rc = 0;
+ goto out;
+ }
+
udev = udev_new();
path = argv[optind];
if (strneq(path, "/sys/", 5)) {
diff --git a/tools/libinput-list-quirks.man b/tools/libinput-list-quirks.man
index 9d90847e..e18495f3 100644
--- a/tools/libinput-list-quirks.man
+++ b/tools/libinput-list-quirks.man
@@ -2,7 +2,11 @@
.SH NAME
libinput\-list\-quirks \- quirk debug helper for libinput
.SH SYNOPSIS
-.B libinput list\-quirks [\-\-help] [\-\-data\-dir /path/to/dir] [\-\-verbose\fB] \fI/dev/input/event0\fB
+.B libinput list\-quirks [\-\-data\-dir /path/to/dir] [\-\-verbose\fB] \fI/dev/input/event0\fB
+.br
+.B libinput list\-quirks [\-\-data\-dir /path/to/dir] [\-\-verbose\fB] \-\-validate\-only
+.br
+.B libinput list\-quirks [\-\-help]
.SH DESCRIPTION
.PP
The
@@ -20,6 +24,10 @@ Use the given directory as data directory for quirks files.
.B \-\-help
Print help
.TP 8
+.B \-\-validate\-only
+Only validate that the quirks files can be parsed. When this option is
+given, no device file should be supplied.
+.TP 8
.B \-\-verbose
Use verbose output, useful for debugging.
.SH LIBINPUT