summaryrefslogtreecommitdiffstats
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
authorTero Saarni <tero.saarni@gmail.com>2009-06-10 23:27:24 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-06-19 22:55:17 -0700
commitec20a022aa24fc63d3ab59584cb1e5aa9a21d46c (patch)
tree671086529e62fcb541fb03422010d1eeae09b00a /drivers/input/evdev.c
parentd7ed5d883c09c5474f842dcb148515dfaef2a567 (diff)
downloadop-kernel-dev-ec20a022aa24fc63d3ab59584cb1e5aa9a21d46c.zip
op-kernel-dev-ec20a022aa24fc63d3ab59584cb1e5aa9a21d46c.tar.gz
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 c238116..114efd8 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);
OpenPOWER on IntegriCloud