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
This commit is contained in:
Linus Torvalds 2015-05-22 14:49:55 -07:00
commit 1d82b0baf9
6 changed files with 70 additions and 4 deletions

View File

@ -747,6 +747,63 @@ static void joydev_cleanup(struct joydev *joydev)
input_close_device(handle);
}
static bool joydev_dev_is_absolute_mouse(struct input_dev *dev)
{
DECLARE_BITMAP(jd_scratch, KEY_CNT);
BUILD_BUG_ON(ABS_CNT > KEY_CNT || EV_CNT > KEY_CNT);
/*
* Virtualization (VMware, etc) and remote management (HP
* ILO2) solutions use absolute coordinates for their virtual
* pointing devices so that there is one-to-one relationship
* between pointer position on the host screen and virtual
* guest screen, and so their mice use ABS_X, ABS_Y and 3
* primary button events. This clashes with what joydev
* considers to be joysticks (a device with at minimum ABS_X
* axis).
*
* Here we are trying to separate absolute mice from
* joysticks. A device is, for joystick detection purposes,
* considered to be an absolute mouse if the following is
* true:
*
* 1) Event types are exactly EV_ABS, EV_KEY and EV_SYN.
* 2) Absolute events are exactly ABS_X and ABS_Y.
* 3) Keys are exactly BTN_LEFT, BTN_RIGHT and BTN_MIDDLE.
* 4) Device is not on "Amiga" bus.
*/
bitmap_zero(jd_scratch, EV_CNT);
__set_bit(EV_ABS, jd_scratch);
__set_bit(EV_KEY, jd_scratch);
__set_bit(EV_SYN, jd_scratch);
if (!bitmap_equal(jd_scratch, dev->evbit, EV_CNT))
return false;
bitmap_zero(jd_scratch, ABS_CNT);
__set_bit(ABS_X, jd_scratch);
__set_bit(ABS_Y, jd_scratch);
if (!bitmap_equal(dev->absbit, jd_scratch, ABS_CNT))
return false;
bitmap_zero(jd_scratch, KEY_CNT);
__set_bit(BTN_LEFT, jd_scratch);
__set_bit(BTN_RIGHT, jd_scratch);
__set_bit(BTN_MIDDLE, jd_scratch);
if (!bitmap_equal(dev->keybit, jd_scratch, KEY_CNT))
return false;
/*
* Amiga joystick (amijoy) historically uses left/middle/right
* button events.
*/
if (dev->id.bustype == BUS_AMIGA)
return false;
return true;
}
static bool joydev_match(struct input_handler *handler, struct input_dev *dev)
{
@ -758,6 +815,10 @@ static bool joydev_match(struct input_handler *handler, struct input_dev *dev)
if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit))
return false;
/* Avoid absolute mice */
if (joydev_dev_is_absolute_mouse(dev))
return false;
return true;
}

View File

@ -156,7 +156,7 @@ config MOUSE_PS2_VMMOUSE
Say Y here if you are running under control of VMware hypervisor
(ESXi, Workstation or Fusion). Also make sure that when you enable
this option, you remove the xf86-input-vmmouse user-space driver
or upgrade it to at least xf86-input-vmmouse 13.0.1, which doesn't
or upgrade it to at least xf86-input-vmmouse 13.1.0, which doesn't
load in the presence of an in-kernel vmmouse driver.
If unsure, say N.

View File

@ -941,6 +941,11 @@ static void alps_get_finger_coordinate_v7(struct input_mt_pos *mt,
case V7_PACKET_ID_TWO:
mt[1].x &= ~0x000F;
mt[1].y |= 0x000F;
/* Detect false-postive touches where x & y report max value */
if (mt[1].y == 0x7ff && mt[1].x == 0xff0) {
mt[1].x = 0;
/* y gets set to 0 at the end of this function */
}
break;
case V7_PACKET_ID_MULTI:

View File

@ -315,7 +315,7 @@ static void elantech_report_semi_mt_data(struct input_dev *dev,
unsigned int x2, unsigned int y2)
{
elantech_set_slot(dev, 0, num_fingers != 0, x1, y1);
elantech_set_slot(dev, 1, num_fingers == 2, x2, y2);
elantech_set_slot(dev, 1, num_fingers >= 2, x2, y2);
}
/*

View File

@ -164,7 +164,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data)
STMPE_TSC_CTRL_TSC_EN, STMPE_TSC_CTRL_TSC_EN);
/* start polling for touch_det to detect release */
schedule_delayed_work(&ts->work, HZ / 50);
schedule_delayed_work(&ts->work, msecs_to_jiffies(50));
return IRQ_HANDLED;
}

View File

@ -187,7 +187,7 @@ static int sx8654_probe(struct i2c_client *client,
return -ENOMEM;
input = devm_input_allocate_device(&client->dev);
if (!sx8654)
if (!input)
return -ENOMEM;
input->name = "SX8654 I2C Touchscreen";