Use udev rules/hwdb to match mice to drivers and SVGs

This adds udev rules/hwdb that sets RATBAG_DRIVER and RATBAG_SVG
properties to the event devices. We then use this property to select
the correct driver instead of checking the hardcoded list in the
drivers. Having this in a hwdb makes it easier for users to test
if drivers match their mouse with a system installed libratbag.

Each driver now has an "id" which is used to match the driver set
in RATBAG_DRIVER. A SVG can optionally be set as well.

All entries in the hwdb are currently without a name as that
information was not available in the hardcoded lists.

Note that this patch breaks the test-driver.
This commit is contained in:
Thomas Hindoe Paaboel Andersen
2015-10-09 21:01:47 +02:00
parent 5278d43429
commit 3605bede48
12 changed files with 204 additions and 181 deletions

View File

@@ -26,17 +26,6 @@
#include "libratbag-private.h"
#include "libratbag-test.h"
static const struct ratbag_id test_table[] = {
{.id = { .bustype = 0x00,
.vendor = 0x00,
.product = 0x00,
.version = 0x00 },
.data = 1,
},
{ },
};
static int
test_has_capability(const struct ratbag_device *device,
enum ratbag_device_capability cap)
@@ -92,17 +81,12 @@ test_write_profile(struct ratbag_profile *profile)
}
static int
test_probe(struct ratbag_device *device, const struct ratbag_id id)
test_probe(struct ratbag_device *device)
{
struct ratbag_test_device *test_device;
assert(id.id.bustype == 0x00);
assert(id.id.vendor == 0x00);
assert(id.id.product == 0x00);
assert(id.id.version == 0x00);
assert(id.test_device != NULL);
test_device = id.test_device;
/* FIXME: after the move to hwdb the test_device is no
* longer passed in. */
ratbag_set_drv_data(device, test_device);
ratbag_device_init_profiles(device,
@@ -125,7 +109,6 @@ test_remove(struct ratbag_device *device)
struct ratbag_driver test_driver = {
.name = "Test driver",
.table_ids = test_table,
.probe = test_probe,
.remove = test_remove,
.read_profile = test_read_profile,