summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/libinput-record.c52
-rw-r--r--tools/libinput-record.man14
2 files changed, 66 insertions, 0 deletions
diff --git a/tools/libinput-record.c b/tools/libinput-record.c
index aaaa6cae..b0f11e8b 100644
--- a/tools/libinput-record.c
+++ b/tools/libinput-record.c
@@ -26,13 +26,16 @@
#include <errno.h>
#include <linux/input.h>
#include <libevdev/libevdev.h>
+#include <libudev.h>
#include <sys/signalfd.h>
#include <sys/utsname.h>
+#include <sys/stat.h>
#include <string.h>
#include <dirent.h>
#include <fcntl.h>
#include <getopt.h>
#include <poll.h>
+#include <unistd.h>
#include <signal.h>
#include <stdbool.h>
@@ -552,11 +555,60 @@ print_evdev_description(struct record_context *ctx, struct record_device *dev)
}
static inline void
+print_udev_properties(struct record_context *ctx, struct record_device *dev)
+{
+ struct udev *udev = NULL;
+ struct udev_device *udev_device = NULL;
+ struct udev_list_entry *entry;
+ struct stat st;
+
+ if (stat(dev->devnode, &st) < 0)
+ return;
+
+ udev = udev_new();
+ if (!udev)
+ goto out;
+
+ udev_device = udev_device_new_from_devnum(udev, 'c', st.st_rdev);
+ if (!udev_device)
+ goto out;
+
+ iprintf(ctx, "udev:\n");
+ indent_push(ctx);
+
+ iprintf(ctx, "properties:\n");
+ indent_push(ctx);
+
+ entry = udev_device_get_properties_list_entry(udev_device);
+ while (entry) {
+ const char *key, *value;
+
+ key = udev_list_entry_get_name(entry);
+
+ if (strneq(key, "ID_INPUT", 8) ||
+ strneq(key, "LIBINPUT", 8) ||
+ strneq(key, "EV_ABS", 6)) {
+ value = udev_list_entry_get_value(entry);
+ iprintf(ctx, "- %s=%s\n", key, value);
+ }
+
+ entry = udev_list_entry_get_next(entry);
+ }
+
+ indent_pop(ctx);
+ indent_pop(ctx);
+out:
+ udev_device_unref(udev_device);
+ udev_unref(udev);
+}
+
+static inline void
print_device_description(struct record_context *ctx, struct record_device *dev)
{
iprintf(ctx, "- node: %s\n", dev->devnode);
print_evdev_description(ctx, dev);
+ print_udev_properties(ctx, dev);
}
static int is_event_node(const struct dirent *dir) {
diff --git a/tools/libinput-record.man b/tools/libinput-record.man
index 8f9787f4..5ff263ad 100644
--- a/tools/libinput-record.man
+++ b/tools/libinput-record.man
@@ -119,6 +119,10 @@ devices:
57: [0, 65535, 0, 0, 0]
58: [0, 255, 0, 0, 0]
properties: [0, 2, 4]
+ udev:
+ properties:
+ - ID_INPUT_MOUSE=1
+ - ID_INPUT=1
events:
- evdev:
- [ 0, 0, 3, 57, 1420] # EV_ABS / ABS_MT_TRACKING_ID 1420
@@ -192,6 +196,9 @@ the device node recorded
.B evdev
A dictionary with the evdev device information.
.TP 8
+.B udev
+A dictionary with the udev device information.
+.TP 8
.B events
A list of dictionaries with the recorded events
.SS evdev
@@ -213,6 +220,13 @@ in decimal format.
.TP 8
.B properties: [0, 1, ...]
Array with all \fBINPUT_PROP_FOO\fR constants. May be an empty array.
+.SS udev
+.TP 8
+.B properties: list of strings
+A list of udev properties in the \fBkey=value\fR format. This is not the
+complete list of properties assigned to the device but a subset that is
+relevant to libinput. These properties may include properties set on a
+parent device.
.SS events
A list of the recorded events. The list contains dictionaries