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

2015-04-16 Thread Peter Hutterer
On Thu, Apr 16, 2015 at 02:41:36PM -0400, Benjamin Tissoires wrote:
> 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 
> ---
> changes to v1:
> - updated with previous series :)

fwiw, the udev fixes went into upstream, so the hwdb patch would be
something like:

evdev:name:TPPS/2 IBM TrackPoint:dmi:*ThinkpadX230*:
  EVDEV_ABS_01=::100
  EVDEV_ABS_36=::100

Happy to merge any tested patches from you :)

Cheers,
   Peter

>  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
> 
> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


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

2015-04-16 Thread Benjamin Tissoires
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 
---
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

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel