[PATCH 5/5] compositor-drm: Load calibration values from udev

Rob Bradford robert.bradford at intel.com
Mon Dec 3 11:44:17 PST 2012


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

This allows the values to be associated with an specific input device using
udev rules.
---
 src/compositor-drm.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 24a71f1..27f2c7d 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -1737,6 +1737,7 @@ device_added(struct udev_device *udev_device, struct drm_seat *master)
 	struct evdev_device *device;
 	const char *devnode;
 	const char *device_seat;
+	const char *calibration_values;
 	int fd;
 
 	device_seat = udev_device_get_property_value(udev_device, "ID_SEAT");
@@ -1765,6 +1766,28 @@ device_added(struct udev_device *udev_device, struct drm_seat *master)
 		return;
 	}
 
+	calibration_values =
+		udev_device_get_property_value(udev_device,
+					       "WL_CALIBRATION");
+
+	if (calibration_values && sscanf(calibration_values,
+					 "%f %f %f %f %f %f",
+					 &device->abs.calibration[0],
+					 &device->abs.calibration[1],
+					 &device->abs.calibration[2],
+					 &device->abs.calibration[3],
+					 &device->abs.calibration[4],
+					 &device->abs.calibration[5]) == 6) {
+		device->abs.apply_calibration = 1;
+		weston_log ("Applying calibration: %f %f %f %f %f %f\n",
+			    device->abs.calibration[0],
+			    device->abs.calibration[1],
+			    device->abs.calibration[2],
+			    device->abs.calibration[3],
+			    device->abs.calibration[4],
+			    device->abs.calibration[5]);
+	}
+
 	wl_list_insert(master->devices_list.prev, &device->link);
 }
 
-- 
1.7.11.7



More information about the wayland-devel mailing list