summaryrefslogtreecommitdiffstats
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
authorTero Saarni <tero.saarni@gmail.com>2009-06-11 08:27:24 +0200
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-06-20 07:55:17 +0200
commitec20a022aa24fc63d3ab59584cb1e5aa9a21d46c (patch)
tree671086529e62fcb541fb03422010d1eeae09b00a /drivers/input/evdev.c
parentInput: ALPS - handle touchpoints buttons correctly (diff)
downloadlinux-ec20a022aa24fc63d3ab59584cb1e5aa9a21d46c.tar.xz
linux-ec20a022aa24fc63d3ab59584cb1e5aa9a21d46c.zip
Input: synaptics - add support for reporting x/y resolution
Synaptics uses anisotropic coordinate system. On some wide touchpads vertical resolution can be twice as high as horizontal which causes unequal sensitivity on x/y directions. Add support for reading the resolution with EVIOCGABS ioctl. Signed-off-by: Tero Saarni <tero.saarni@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/evdev.c')
-rw-r--r--drivers/input/evdev.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index c238116400b3..114efd8dc8f5 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -626,8 +626,11 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
abs.maximum = dev->absmax[t];
abs.fuzz = dev->absfuzz[t];
abs.flat = dev->absflat[t];
+ abs.resolution = dev->absres[t];
- if (copy_to_user(p, &abs, sizeof(struct input_absinfo)))
+ if (copy_to_user(p, &abs, min_t(size_t,
+ _IOC_SIZE(cmd),
+ sizeof(struct input_absinfo))))
return -EFAULT;
return 0;
@@ -654,8 +657,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
t = _IOC_NR(cmd) & ABS_MAX;
- if (copy_from_user(&abs, p,
- sizeof(struct input_absinfo)))
+ if (copy_from_user(&abs, p, min_t(size_t,
+ _IOC_SIZE(cmd),
+ sizeof(struct input_absinfo))))
return -EFAULT;
/*
@@ -670,6 +674,8 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
dev->absmax[t] = abs.maximum;
dev->absfuzz[t] = abs.fuzz;
dev->absflat[t] = abs.flat;
+ dev->absres[t] = _IOC_SIZE(cmd) < sizeof(struct input_absinfo) ?
+ 0 : abs.resolution;
spin_unlock_irq(&dev->event_lock);