[PATCH 1/2] compositor-drm: Add quirk loading from udev

Rob Bradford rob at robster.org.uk
Fri Sep 21 10:20:30 PDT 2012


From: Rob Bradford <rob at linux.intel.com>

Look at udev properties and then set the quirk flags based on the udev
properties that are set on the device node.
---
 src/compositor-drm.c | 11 +++++++++++
 src/evdev.h          |  6 ++++++
 2 files changed, 17 insertions(+)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 0faf45c..e5ee338 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1777,6 +1777,14 @@ drm_restore(struct weston_compositor *ec)
 	tty_reset(d->tty);
 }
 
+static void
+device_parse_quirks(struct evdev_device *evdev_device,
+		    struct udev_device *udev_device)
+{
+	if (udev_device_get_property_value(udev_device, "WL_QUIRK_SWAP_AXES"))
+		evdev_device->quirks |= EVDEV_QUIRK_SWAP_AXES;
+}
+
 static const char default_seat[] = "seat0";
 
 static void
@@ -1814,6 +1822,9 @@ device_added(struct udev_device *udev_device, struct drm_seat *master)
 		return;
 	}
 
+
+	device_parse_quirks(device, udev_device);
+
 	wl_list_insert(master->devices_list.prev, &device->link);
 }
 
diff --git a/src/evdev.h b/src/evdev.h
index 85c4739..9ae62db 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -44,6 +44,11 @@ enum evdev_device_capability {
 	EVDEV_TOUCH = (1 << 4),
 };
 
+enum evdev_device_quirks {
+	EVDEV_QUIRK_NONE = 0,
+	EVDEV_QUIRK_SWAP_AXES = (1 << 0),
+};
+
 struct evdev_device {
 	struct weston_seat *seat;
 	struct wl_list link;
@@ -71,6 +76,7 @@ struct evdev_device {
 
 	enum evdev_event_type pending_events;
 	enum evdev_device_capability caps;
+	uint32_t quirks;
 
 	int is_mt;
 };
-- 
1.7.11.2



More information about the wayland-devel mailing list