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 <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2018-05-25 09:23:50 +10:00
parent 5792af9a5f
commit fc6e6aad36

View file

@ -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;