aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-05-22 17:49:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-05-22 17:49:55 -0400
commit1d82b0baf9abd59ae6f53f3102f4e442043763a4 (patch)
tree93245bedc0ca82c55f51193d3c3b3d8d6613407d /drivers/input
parent2a058f388db8f2bf83ed43f6170a2bb79567dedb (diff)
parent77b071e7931dd762563ac74e3e448b2aef23ad2f (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input fixes from Dmitry Torokhov: "Updates for the input subsystem. The main change is that we tell joydev not to touch "absolute mice", such as VMware virtual mouse, as that produced bad result (cursor stuck in upper right corner) with games" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: smtpe-ts - wait 50mS until polling for pen-up Input: smtpe-ts - use msecs_to_jiffies() instead of HZ Input: joydev - don't classify the vmmouse as a joystick Input: vmmouse - do not reference non-existing version of X driver Input: alps - fix finger jumps on lifting 2 fingers on v7 touchpad Input: elantech - fix semi-mt protocol for v3 HW Input: sx8654 - fix memory allocation check
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/joydev.c61
-rw-r--r--drivers/input/mouse/Kconfig2
-rw-r--r--drivers/input/mouse/alps.c5
-rw-r--r--drivers/input/mouse/elantech.c2
-rw-r--r--drivers/input/touchscreen/stmpe-ts.c2
-rw-r--r--drivers/input/touchscreen/sx8654.c2
6 files changed, 70 insertions, 4 deletions
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index f362883c94e3..1d247bcf2ae2 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -747,6 +747,63 @@ static void joydev_cleanup(struct joydev *joydev)
747 input_close_device(handle); 747 input_close_device(handle);
748} 748}
749 749
750static bool joydev_dev_is_absolute_mouse(struct input_dev *dev)
751{
752 DECLARE_BITMAP(jd_scratch, KEY_CNT);
753
754 BUILD_BUG_ON(ABS_CNT > KEY_CNT || EV_CNT > KEY_CNT);
755
756 /*
757 * Virtualization (VMware, etc) and remote management (HP
758 * ILO2) solutions use absolute coordinates for their virtual
759 * pointing devices so that there is one-to-one relationship
760 * between pointer position on the host screen and virtual
761 * guest screen, and so their mice use ABS_X, ABS_Y and 3
762 * primary button events. This clashes with what joydev
763 * considers to be joysticks (a device with at minimum ABS_X
764 * axis).
765 *
766 * Here we are trying to separate absolute mice from
767 * joysticks. A device is, for joystick detection purposes,
768 * considered to be an absolute mouse if the following is
769 * true:
770 *
771 * 1) Event types are exactly EV_ABS, EV_KEY and EV_SYN.
772 * 2) Absolute events are exactly ABS_X and ABS_Y.
773 * 3) Keys are exactly BTN_LEFT, BTN_RIGHT and BTN_MIDDLE.
774 * 4) Device is not on "Amiga" bus.
775 */
776
777 bitmap_zero(jd_scratch, EV_CNT);
778 __set_bit(EV_ABS, jd_scratch);
779 __set_bit(EV_KEY, jd_scratch);
780 __set_bit(EV_SYN, jd_scratch);
781 if (!bitmap_equal(jd_scratch, dev->evbit, EV_CNT))
782 return false;
783
784 bitmap_zero(jd_scratch, ABS_CNT);
785 __set_bit(ABS_X, jd_scratch);
786 __set_bit(ABS_Y, jd_scratch);
787 if (!bitmap_equal(dev->absbit, jd_scratch, ABS_CNT))
788 return false;
789
790 bitmap_zero(jd_scratch, KEY_CNT);
791 __set_bit(BTN_LEFT, jd_scratch);
792 __set_bit(BTN_RIGHT, jd_scratch);
793 __set_bit(BTN_MIDDLE, jd_scratch);
794
795 if (!bitmap_equal(dev->keybit, jd_scratch, KEY_CNT))
796 return false;
797
798 /*
799 * Amiga joystick (amijoy) historically uses left/middle/right
800 * button events.
801 */
802 if (dev->id.bustype == BUS_AMIGA)
803 return false;
804
805 return true;
806}
750 807
751static bool joydev_match(struct input_handler *handler, struct input_dev *dev) 808static bool joydev_match(struct input_handler *handler, struct input_dev *dev)
752{ 809{
@@ -758,6 +815,10 @@ static bool joydev_match(struct input_handler *handler, struct input_dev *dev)
758 if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit)) 815 if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit))
759 return false; 816 return false;
760 817
818 /* Avoid absolute mice */
819 if (joydev_dev_is_absolute_mouse(dev))
820 return false;
821
761 return true; 822 return true;
762} 823}
763 824
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index 7462d2fc8cfe..d7820d1152d2 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -156,7 +156,7 @@ config MOUSE_PS2_VMMOUSE
156 Say Y here if you are running under control of VMware hypervisor 156 Say Y here if you are running under control of VMware hypervisor
157 (ESXi, Workstation or Fusion). Also make sure that when you enable 157 (ESXi, Workstation or Fusion). Also make sure that when you enable
158 this option, you remove the xf86-input-vmmouse user-space driver 158 this option, you remove the xf86-input-vmmouse user-space driver
159 or upgrade it to at least xf86-input-vmmouse 13.0.1, which doesn't 159 or upgrade it to at least xf86-input-vmmouse 13.1.0, which doesn't
160 load in the presence of an in-kernel vmmouse driver. 160 load in the presence of an in-kernel vmmouse driver.
161 161
162 If unsure, say N. 162 If unsure, say N.
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index e6708f6efb4d..7752bd59d4b7 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -941,6 +941,11 @@ static void alps_get_finger_coordinate_v7(struct input_mt_pos *mt,
941 case V7_PACKET_ID_TWO: 941 case V7_PACKET_ID_TWO:
942 mt[1].x &= ~0x000F; 942 mt[1].x &= ~0x000F;
943 mt[1].y |= 0x000F; 943 mt[1].y |= 0x000F;
944 /* Detect false-postive touches where x & y report max value */
945 if (mt[1].y == 0x7ff && mt[1].x == 0xff0) {
946 mt[1].x = 0;
947 /* y gets set to 0 at the end of this function */
948 }
944 break; 949 break;
945 950
946 case V7_PACKET_ID_MULTI: 951 case V7_PACKET_ID_MULTI:
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 991dc6b20a58..79363b687195 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -315,7 +315,7 @@ static void elantech_report_semi_mt_data(struct input_dev *dev,
315 unsigned int x2, unsigned int y2) 315 unsigned int x2, unsigned int y2)
316{ 316{
317 elantech_set_slot(dev, 0, num_fingers != 0, x1, y1); 317 elantech_set_slot(dev, 0, num_fingers != 0, x1, y1);
318 elantech_set_slot(dev, 1, num_fingers == 2, x2, y2); 318 elantech_set_slot(dev, 1, num_fingers >= 2, x2, y2);
319} 319}
320 320
321/* 321/*
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c
index 2d5ff86b343f..e4c31256a74d 100644
--- a/drivers/input/touchscreen/stmpe-ts.c
+++ b/drivers/input/touchscreen/stmpe-ts.c
@@ -164,7 +164,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data)
164 STMPE_TSC_CTRL_TSC_EN, STMPE_TSC_CTRL_TSC_EN); 164 STMPE_TSC_CTRL_TSC_EN, STMPE_TSC_CTRL_TSC_EN);
165 165
166 /* start polling for touch_det to detect release */ 166 /* start polling for touch_det to detect release */
167 schedule_delayed_work(&ts->work, HZ / 50); 167 schedule_delayed_work(&ts->work, msecs_to_jiffies(50));
168 168
169 return IRQ_HANDLED; 169 return IRQ_HANDLED;
170} 170}
diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c
index aecb9ad2e701..642f4a53de50 100644
--- a/drivers/input/touchscreen/sx8654.c
+++ b/drivers/input/touchscreen/sx8654.c
@@ -187,7 +187,7 @@ static int sx8654_probe(struct i2c_client *client,
187 return -ENOMEM; 187 return -ENOMEM;
188 188
189 input = devm_input_allocate_device(&client->dev); 189 input = devm_input_allocate_device(&client->dev);
190 if (!sx8654) 190 if (!input)
191 return -ENOMEM; 191 return -ENOMEM;
192 192
193 input->name = "SX8654 I2C Touchscreen"; 193 input->name = "SX8654 I2C Touchscreen";