[PATCH v3 4/4] evdev: Fix reported resolution of Lenovo X230 touchpads

Benjamin Tissoires benjamin.tissoires at gmail.com
Thu Apr 16 11:41:36 PDT 2015


The Lenovo X230 advertise a vertical resolution of 136, which gives a size
of 31 mm. The actual size of the touchpad is 40mm, so override the
resolution to 100.

/!\ This is a temporary fix. The proper fix should go in hwdb. /!\

Signed-off-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
---
changes to v1:
- updated with previous series :)

 src/evdev.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 0b705e4..8cd12cb 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -1491,6 +1491,17 @@ evdev_fix_android_mt(struct evdev_device *device)
 		      libevdev_get_abs_info(evdev, ABS_MT_POSITION_Y));
 }
 
+static inline void
+evdev_fix_x230_res(struct evdev_device *device)
+{
+	struct libevdev *evdev = device->evdev;
+
+	/* ugly hack while EV_ABS_OVERRIDE is merged in udev */
+
+	if (device->model == EVDEV_MODEL_LENOVO_X230)
+		libevdev_set_abs_resolution(evdev, ABS_Y, 100);
+}
+
 static inline int
 evdev_check_min_max(struct evdev_device *device, unsigned int code)
 {
@@ -1681,6 +1692,8 @@ evdev_configure_device(struct evdev_device *device)
 		evdev_fix_android_mt(device);
 
 	if (libevdev_has_event_code(evdev, EV_ABS, ABS_X)) {
+		evdev_fix_x230_res(device);
+
 		if (evdev_fix_abs_resolution(device,
 					     ABS_X,
 					     ABS_Y,
-- 
1.7.1



More information about the wayland-devel mailing list