aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2016-01-16 13:04:49 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2016-01-27 19:03:30 -0500
commitd4f1b06d685d11ebdaccf11c0db1cb3c78736862 (patch)
tree0ad5cf6a883812393d23597b93e222ec7eb15d72
parent015bb5e134544492d840cee17d7442194cfb0fe4 (diff)
Input: vmmouse - fix absolute device registration
We should set device's capabilities first, and then register it, otherwise various handlers already present in the kernel will not be able to connect to the device. Reported-by: Lauri Kasanen <cand@gmx.com> Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/mouse/vmmouse.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.c
index e272f06258ce..a3f0f5a47490 100644
--- a/drivers/input/mouse/vmmouse.c
+++ b/drivers/input/mouse/vmmouse.c
@@ -458,8 +458,6 @@ int vmmouse_init(struct psmouse *psmouse)
458 priv->abs_dev = abs_dev; 458 priv->abs_dev = abs_dev;
459 psmouse->private = priv; 459 psmouse->private = priv;
460 460
461 input_set_capability(rel_dev, EV_REL, REL_WHEEL);
462
463 /* Set up and register absolute device */ 461 /* Set up and register absolute device */
464 snprintf(priv->phys, sizeof(priv->phys), "%s/input1", 462 snprintf(priv->phys, sizeof(priv->phys), "%s/input1",
465 psmouse->ps2dev.serio->phys); 463 psmouse->ps2dev.serio->phys);
@@ -475,10 +473,6 @@ int vmmouse_init(struct psmouse *psmouse)
475 abs_dev->id.version = psmouse->model; 473 abs_dev->id.version = psmouse->model;
476 abs_dev->dev.parent = &psmouse->ps2dev.serio->dev; 474 abs_dev->dev.parent = &psmouse->ps2dev.serio->dev;
477 475
478 error = input_register_device(priv->abs_dev);
479 if (error)
480 goto init_fail;
481
482 /* Set absolute device capabilities */ 476 /* Set absolute device capabilities */
483 input_set_capability(abs_dev, EV_KEY, BTN_LEFT); 477 input_set_capability(abs_dev, EV_KEY, BTN_LEFT);
484 input_set_capability(abs_dev, EV_KEY, BTN_RIGHT); 478 input_set_capability(abs_dev, EV_KEY, BTN_RIGHT);
@@ -488,6 +482,13 @@ int vmmouse_init(struct psmouse *psmouse)
488 input_set_abs_params(abs_dev, ABS_X, 0, VMMOUSE_MAX_X, 0, 0); 482 input_set_abs_params(abs_dev, ABS_X, 0, VMMOUSE_MAX_X, 0, 0);
489 input_set_abs_params(abs_dev, ABS_Y, 0, VMMOUSE_MAX_Y, 0, 0); 483 input_set_abs_params(abs_dev, ABS_Y, 0, VMMOUSE_MAX_Y, 0, 0);
490 484
485 error = input_register_device(priv->abs_dev);
486 if (error)
487 goto init_fail;
488
489 /* Add wheel capability to the relative device */
490 input_set_capability(rel_dev, EV_REL, REL_WHEEL);
491
491 psmouse->protocol_handler = vmmouse_process_byte; 492 psmouse->protocol_handler = vmmouse_process_byte;
492 psmouse->disconnect = vmmouse_disconnect; 493 psmouse->disconnect = vmmouse_disconnect;
493 psmouse->reconnect = vmmouse_reconnect; 494 psmouse->reconnect = vmmouse_reconnect;