aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/evdev.c
diff options
context:
space:
mode:
authorTero Saarni <tero.saarni@gmail.com>2009-06-11 02:27:24 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-06-20 01:55:17 -0400
commitec20a022aa24fc63d3ab59584cb1e5aa9a21d46c (patch)
tree671086529e62fcb541fb03422010d1eeae09b00a /drivers/input/evdev.c
parentd7ed5d883c09c5474f842dcb148515dfaef2a567 (diff)
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,
626 abs.maximum = dev->absmax[t]; 626 abs.maximum = dev->absmax[t];
627 abs.fuzz = dev->absfuzz[t]; 627 abs.fuzz = dev->absfuzz[t];
628 abs.flat = dev->absflat[t]; 628 abs.flat = dev->absflat[t];
629 abs.resolution = dev->absres[t];
629 630
630 if (copy_to_user(p, &abs, sizeof(struct input_absinfo))) 631 if (copy_to_user(p, &abs, min_t(size_t,
632 _IOC_SIZE(cmd),
633 sizeof(struct input_absinfo))))
631 return -EFAULT; 634 return -EFAULT;
632 635
633 return 0; 636 return 0;
@@ -654,8 +657,9 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
654 657
655 t = _IOC_NR(cmd) & ABS_MAX; 658 t = _IOC_NR(cmd) & ABS_MAX;
656 659
657 if (copy_from_user(&abs, p, 660 if (copy_from_user(&abs, p, min_t(size_t,
658 sizeof(struct input_absinfo))) 661 _IOC_SIZE(cmd),
662 sizeof(struct input_absinfo))))
659 return -EFAULT; 663 return -EFAULT;
660 664
661 /* 665 /*
@@ -670,6 +674,8 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd,
670 dev->absmax[t] = abs.maximum; 674 dev->absmax[t] = abs.maximum;
671 dev->absfuzz[t] = abs.fuzz; 675 dev->absfuzz[t] = abs.fuzz;
672 dev->absflat[t] = abs.flat; 676 dev->absflat[t] = abs.flat;
677 dev->absres[t] = _IOC_SIZE(cmd) < sizeof(struct input_absinfo) ?
678 0 : abs.resolution;
673 679
674 spin_unlock_irq(&dev->event_lock); 680 spin_unlock_irq(&dev->event_lock);
675 681