linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Alexander Tsoy <alexander@tsoy.me>
Cc: linux-input@vger.kernel.org,
	Thomas Hellstrom <thellstrom@vmware.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Input: joydev - extend absolute mouse detection
Date: Sun, 30 Jun 2019 00:32:21 -0700	[thread overview]
Message-ID: <20190630073221.GF91171@dtor-ws> (raw)
In-Reply-To: <20190623234456.4074-1-alexander@tsoy.me>

On Mon, Jun 24, 2019 at 02:44:56AM +0300, Alexander Tsoy wrote:
> Extend event signature matching to catch more input devices emulated by
> BMC firmwares, QEMU and VMware.
> 
> Signed-off-by: Alexander Tsoy <alexander@tsoy.me>

Applied, thank you.

> ---
>  drivers/input/joydev.c | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
> index ac21c050fdb0..a2b5fbba2d3b 100644
> --- a/drivers/input/joydev.c
> +++ b/drivers/input/joydev.c
> @@ -808,6 +808,7 @@ static bool joydev_dev_is_blacklisted(struct input_dev *dev)
>  static bool joydev_dev_is_absolute_mouse(struct input_dev *dev)
>  {
>  	DECLARE_BITMAP(jd_scratch, KEY_CNT);
> +	bool ev_match = false;
>  
>  	BUILD_BUG_ON(ABS_CNT > KEY_CNT || EV_CNT > KEY_CNT);
>  
> @@ -826,17 +827,36 @@ static bool joydev_dev_is_absolute_mouse(struct input_dev *dev)
>  	 * considered to be an absolute mouse if the following is
>  	 * true:
>  	 *
> -	 * 1) Event types are exactly EV_ABS, EV_KEY and EV_SYN.
> +	 * 1) Event types are exactly
> +	 *      EV_ABS, EV_KEY and EV_SYN
> +	 *    or
> +	 *      EV_ABS, EV_KEY, EV_SYN and EV_MSC
> +	 *    or
> +	 *      EV_ABS, EV_KEY, EV_SYN, EV_MSC and EV_REL.
>  	 * 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);
> +	/* VMware VMMouse, HP ILO2 */
>  	__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))
> +	if (bitmap_equal(jd_scratch, dev->evbit, EV_CNT))
> +		ev_match = true;
> +
> +	/* HP ILO2, AMI BMC firmware */
> +	__set_bit(EV_MSC, jd_scratch);
> +	if (bitmap_equal(jd_scratch, dev->evbit, EV_CNT))
> +		ev_match = true;
> +
> +	/* VMware Virtual USB Mouse, QEMU USB Tablet, ATEN BMC firmware */
> +	__set_bit(EV_REL, jd_scratch);
> +	if (bitmap_equal(jd_scratch, dev->evbit, EV_CNT))
> +		ev_match = true;
> +
> +	if (!ev_match)
>  		return false;
>  
>  	bitmap_zero(jd_scratch, ABS_CNT);
> -- 
> 2.21.0
> 

-- 
Dmitry

      reply	other threads:[~2019-06-30  7:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-23 23:44 [PATCH] Input: joydev - extend absolute mouse detection Alexander Tsoy
2019-06-30  7:32 ` Dmitry Torokhov [this message]

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=20190630073221.GF91171@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=alexander@tsoy.me \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@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).