From fc6e6aad363a612110e43dcc5f471c69f8560064 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 25 May 2018 09:23:50 +1000 Subject: [PATCH] quirks: use an empty dmi modalias string for the test suite We don't want any of the test devices to match the local machine's DMI modalias. This was a major drawback in the previous test suite, hacking the dmi modalias string was nontrivial but a wrong string could cause false positives or negatives. The quirks system is internal, so rather than having some fancy API we just hook it off the environment variable that the test suite always sets. Hacky, but a lot easier than the other options. Signed-off-by: Peter Hutterer --- src/quirks.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/quirks.c b/src/quirks.c index 7cef8a79..b88d8bc9 100644 --- a/src/quirks.c +++ b/src/quirks.c @@ -122,7 +122,7 @@ struct match { uint32_t vendor; uint32_t product; - char *dmi; + char *dmi; /* dmi modalias with preceding "dmi:" */ /* We can have more than one type set, so this is a bitfield */ uint32_t udev_type; @@ -337,10 +337,13 @@ init_dmi(void) { struct udev *udev; struct udev_device *udev_device; - const char *modalias; + const char *modalias = NULL; char *copy = NULL; const char *syspath = "/sys/devices/virtual/dmi/id"; + if (getenv("LIBINPUT_RUNNING_TEST_SUITE")) + return safe_strdup("dmi:"); + udev = udev_new(); if (!udev) return NULL;