libratbag: improve debugging to help with new devices

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2019-03-05 13:26:28 +10:00
parent 4b7b9d2e48
commit b2a3d39122
3 changed files with 13 additions and 1 deletions

View File

@@ -470,6 +470,7 @@ ratbag_device_data_new_for_id(struct ratbag *ratbag, const struct input_id *id)
datadir = getenv("LIBRATBAG_DATA_DIR");
if (!datadir)
datadir = LIBRATBAG_DATA_DIR;
log_debug(ratbag, "Using data directory '%s'\n", datadir);
snprintf(devicedir, sizeof(devicedir), "%s/devices", datadir);
@@ -492,6 +493,9 @@ ratbag_device_data_new_for_id(struct ratbag *ratbag, const struct input_id *id)
goto out;
}
if (!data)
log_debug(ratbag, "No data file found for %04x:%04x\n", id->vendor, id->product);
out:
while(nfiles--)
free(files[nfiles]);

View File

@@ -1260,7 +1260,7 @@ ratbag_hidraw_parse_report_descriptor(struct ratbag_device *device)
switch (hid) {
case HID_REPORT_ID:
if (hidraw->reports) {
log_debug(device->ratbag, "report ID %02x\n", content);
log_debug(device->ratbag, "HID report ID %02x\n", content);
hidraw->reports[hidraw->num_reports].report_id = content;
hidraw->reports[hidraw->num_reports].usage_page = usage_page;
hidraw->reports[hidraw->num_reports].usage = usage;
@@ -1328,6 +1328,10 @@ ratbag_open_hidraw_node(struct ratbag_device *device, struct udev_device *hidraw
goto err;
}
log_debug(device->ratbag,
"hidraw info: bus %#04x vendor %#04x product %#04x\n",
info.bustype, info.vendor, info.product);
/* check basic matching between the hidraw node and the ratbag device */
if (info.bustype != device->ids.bustype ||
(info.vendor & 0xFFFF )!= device->ids.vendor ||

View File

@@ -395,10 +395,12 @@ ratbag_assign_driver(struct ratbag_device *device,
if (!test_device) {
driver_name = ratbag_device_data_get_driver(device->data);
} else {
log_debug(device->ratbag, "This is a test device\n");
driver_name = "test_driver";
}
if (driver_name) {
log_debug(device->ratbag, "device assigned driver %s\n", driver_name);
rc = ratbag_test_driver(device, dev_id, driver_name, test_device);
} else {
rc = ratbag_driver_fallback_logitech(device, dev_id);
@@ -456,6 +458,8 @@ ratbag_device_new_from_udev_device(struct ratbag *ratbag,
if ((name = get_device_name(udev_device)) == 0)
goto out_err;
log_debug(ratbag, "New device: %s\n", name);
device = ratbag_device_new(ratbag, udev_device, name, &id);
if (!device || !device->data)
goto out_err;