linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Shapovalov <intelfx@intelfx.name>
To: linux-input@vger.kernel.org
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Jiri Kosina <jikos@kernel.org>
Subject: Re: HID: input: support for misbehaving mice having logical_minimum != 0
Date: Sun, 21 Jan 2018 09:01:39 +0300	[thread overview]
Message-ID: <1516514499.14165.1.camel@intelfx.name> (raw)
In-Reply-To: <1496529275.7616.7.camel@intelfx.name>

[-- Attachment #1: Type: text/plain, Size: 2399 bytes --]

On 2017-06-04 at 01:34 +0300, Ivan Shapovalov wrote:
> Hello folks,
> 
> (this is not an actual patch submission; also, this is my first
> submission to mainline kernel, so bear with me...)
> 
> This is an attempt to fix touchpad handling on Sony Vaio Tap 11.
> On that hardware, touchpad is visible as a generic hid-input mouse.
> The problem is that kernel does not register mouse button release
> events because the hardware reports bogus logical minimum (1) in the
> respective field of the HID descriptor. (Sorry for probably wrong
> terminology.)
> 
> Moreover, the reported logical maximum (5) also disagrees with what
> I've seen in other generic USB mice (it's 1 everywhere else), but I
> do
> not see the logic by which it is determined -- blindly forcing it to
> 1
> system-wide locks me out of the keyboard.
> 
> A PoC patch is below that makes touchpad work on that system.
> However,
> the keyboard/mouse on that system are connected via a WUSB dongle
> with
> a generic USB VID/PID, so matching via these (as in the rest of
> usbhid
> quirks) seems inappropriate.
> 
> So, I'd appreciate a hint on how to match that hardware for a proper
> quirk and what to do with the odd reported logical maximum.
> 
> I'm also attaching the output of various debug tools ran before and
> after patching.
> 
> ---
>  drivers/hid/hid-input.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
> index d05f903c7614..f8e780185c8a 100644
> --- a/drivers/hid/hid-input.c
> +++ b/drivers/hid/hid-input.c
> @@ -1069,6 +1069,16 @@ static void hidinput_configure_usage(struct
> hid_input *hidinput, struct hid_fiel
>  	if (usage->type == EV_KEY) {
>  		set_bit(EV_MSC, input->evbit);
>  		set_bit(MSC_SCAN, input->mscbit);
> +
> +		if (field->logical_minimum > 0) {
> +			hid_err(device, "XXX: EV_KEY logical_minimum
> = %d != 0 - updating\n", field->logical_minimum);
> +			field->logical_minimum = 0;
> +			if (field->logical_maximum != 1) {
> +				hid_err(device, "XXX: EV_KEY
> logical_maximum = %d != 1 - updating\n", field->logical_maximum);
> +				field->logical_maximum = 1;
> +			}
> +		}
> +
>  	}
>  
>  ignore:
> -- 
> 2.13.0
> 
> Thanks,

Ping?
Anyone?

Cc'ing maintainers of HID core layer as per MAINTAINERS.

Cheers,
-- 
Ivan Shapovalov / intelfx /

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      parent reply	other threads:[~2018-01-21  6:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1496529275.7616.7.camel@intelfx.name>
2017-06-07  0:30 ` HID: input: support for misbehaving mice having logical_minimum != 0 Ivan Shapovalov
2018-01-21  6:01 ` Ivan Shapovalov [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=1516514499.14165.1.camel@intelfx.name \
    --to=intelfx@intelfx.name \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    /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).