linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Lauri Kasanen <cand@gmx.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>, linux-input@vger.kernel.org
Subject: Re: MOUSE_PS2_VMMOUSE and input/mice
Date: Sat, 16 Jan 2016 10:16:35 -0800	[thread overview]
Message-ID: <20160116181635.GA9203@dtor-ws> (raw)
In-Reply-To: <20160116173945.cb1f14b9.cand@gmx.com>

On Sat, Jan 16, 2016 at 05:39:45PM +0200, Lauri Kasanen wrote:
> Hi,
> 
> Here's the /proc/bus/input/devices output. Also attaching the kernel
> config in case it'd be useful.
> 

...

> 
> I: Bus=0011 Vendor=0002 Product=0013 Version=0006
> N: Name="VirtualPS/2 VMware VMMouse"
> P: Phys=isa0060/serio1/input1
> S: Sysfs=/devices/platform/i8042/serio1/input/input4
> U: Uniq=
> H: Handlers=event2 
> B: PROP=0
> B: EV=b
> B: KEY=70000 0 0 0 0 0 0 0 0
>

So mousedev indeed did not bind to the absolute portion of the device.
Please try the patch below.

-- 
Dmitry


Input: vmmouse - fix absolute device registration

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

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>
---
 drivers/input/mouse/vmmouse.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.c
index e272f06..a3f0f5a 100644
--- a/drivers/input/mouse/vmmouse.c
+++ b/drivers/input/mouse/vmmouse.c
@@ -458,8 +458,6 @@ int vmmouse_init(struct psmouse *psmouse)
 	priv->abs_dev = abs_dev;
 	psmouse->private = priv;
 
-	input_set_capability(rel_dev, EV_REL, REL_WHEEL);
-
 	/* Set up and register absolute device */
 	snprintf(priv->phys, sizeof(priv->phys), "%s/input1",
 		 psmouse->ps2dev.serio->phys);
@@ -475,10 +473,6 @@ int vmmouse_init(struct psmouse *psmouse)
 	abs_dev->id.version = psmouse->model;
 	abs_dev->dev.parent = &psmouse->ps2dev.serio->dev;
 
-	error = input_register_device(priv->abs_dev);
-	if (error)
-		goto init_fail;
-
 	/* Set absolute device capabilities */
 	input_set_capability(abs_dev, EV_KEY, BTN_LEFT);
 	input_set_capability(abs_dev, EV_KEY, BTN_RIGHT);
@@ -488,6 +482,13 @@ int vmmouse_init(struct psmouse *psmouse)
 	input_set_abs_params(abs_dev, ABS_X, 0, VMMOUSE_MAX_X, 0, 0);
 	input_set_abs_params(abs_dev, ABS_Y, 0, VMMOUSE_MAX_Y, 0, 0);
 
+	error = input_register_device(priv->abs_dev);
+	if (error)
+		goto init_fail;
+
+	/* Add wheel capability to the relative device */
+	input_set_capability(rel_dev, EV_REL, REL_WHEEL);
+
 	psmouse->protocol_handler = vmmouse_process_byte;
 	psmouse->disconnect = vmmouse_disconnect;
 	psmouse->reconnect = vmmouse_reconnect;

  reply	other threads:[~2016-01-16 18:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 10:39 MOUSE_PS2_VMMOUSE and input/mice Lauri Kasanen
2016-01-15 11:08 ` Thomas Hellstrom
2016-01-15 11:23   ` Lauri Kasanen
2016-01-15 15:45     ` Thomas Hellstrom
2016-01-15 17:50       ` Dmitry Torokhov
2016-01-15 18:22         ` Thomas Hellstrom
2016-01-16 15:39           ` Lauri Kasanen
2016-01-16 18:16             ` Dmitry Torokhov [this message]
2016-01-18  8:30               ` Lauri Kasanen
2016-01-16  8:57         ` Lauri Kasanen
2016-01-16 18:30           ` Dmitry Torokhov
2016-01-16 19:10             ` Lauri Kasanen
2016-01-16 19:38               ` Dmitry Torokhov
2016-01-17  9:32                 ` Lauri Kasanen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160116181635.GA9203@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=cand@gmx.com \
    --cc=linux-input@vger.kernel.org \
    --cc=thellstrom@vmware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).