linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Cc: linux-input@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jiri Kosina <jkosina@suse.cz>, Jiri Kosina <jikos@kernel.org>
Subject: Re: [PATCH v4 5/5] hid-logitech-hidpp: add support for ratchet switch
Date: Fri, 14 Apr 2017 14:56:27 +0200	[thread overview]
Message-ID: <20170414125626.GB301@mail.corp.redhat.com> (raw)
In-Reply-To: <42d4c04d292c6788695036b77d8c0e3517e816ec.1491917052.git.mchehab@s-opensource.com>

On Apr 11 2017 or thereabouts, Mauro Carvalho Chehab wrote:
> Logitech Anywhere MX2 and MX master produce events for
> the wheel ratchet/free wheel button. Add support for it.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> ---

On a MX Master, patches 4-5 are:
Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

>  drivers/hid/hid-logitech-hidpp.c | 23 +++++++++++++++++++++--
>  1 file changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
> index 20ced3f519ae..fa5a28cc77ca 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -2031,6 +2031,19 @@ static int hidpp_mouse_set_wheel_mode(struct hidpp_device *hidpp,
>  			return ret;
>  	}
>  
> +	ret = hidpp_send_fap_command_sync(hidpp, hrd->feature_index,
> +					  CMD_MOUSE_GET_WHEEL_RATCHET,
> +					  params, 0, &response);
> +	if (ret > 0) {
> +		hid_err(hidpp->hid_dev, "%s: received protocol error 0x%02x\n",
> +			__func__, ret);
> +		return -EPROTO;
> +	}
> +	if (ret)
> +		return ret;
> +
> +	hrd->ratchet = response.fap.params[0] & 0x01;
> +
>  	params[0] = (invert     ? BIT(2) : 0)  |
>  		    (high_res   ? BIT(1) : 0)  |
>  		    (hidpp_mode ? BIT(0) : 0);
> @@ -2564,10 +2577,11 @@ static int high_res_raw_event(struct hid_device *hdev, u8 *data, int size)
>  			input_report_rel(hrd->input, REL_HIRES_WHEEL, delta);
>  		else
>  			input_report_rel(hrd->input, REL_WHEEL, delta);
> +	} else if (data[3] == 0x10) {
> +		hrd->ratchet = data[4] & 0x01;
> +		input_report_switch(hrd->input, SW_RATCHET, hrd->ratchet);
>  	}
>  
> -	/* FIXME: also report ratchet events to userspace */
> -
>  	return 1;
>  }
>  
> @@ -2580,6 +2594,11 @@ static void high_res_populate_input(struct hidpp_device *hidpp,
>  
>  	__set_bit(REL_WHEEL, hrd->input->relbit);
>  	__set_bit(REL_HIRES_WHEEL, hrd->input->relbit);
> +	__set_bit(EV_SW, hrd->input->evbit);
> +	__set_bit(SW_RATCHET, hrd->input->swbit);
> +
> +	/* Report current state of the ratchet switch */
> +	input_report_switch(hrd->input, SW_RATCHET, hrd->ratchet);
>  }
>  
>  
> -- 
> 2.9.3
> 

  reply	other threads:[~2017-04-14 12:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-11 13:29 [PATCH v4 0/5] add support for high res wheel found on some Logitech devices Mauro Carvalho Chehab
2017-04-11 13:29 ` [PATCH v4 1/5] input: event-codes: reserve some space for REL_MISC events Mauro Carvalho Chehab
2017-04-11 13:29   ` [PATCH v4 2/5] input: add an EV_REL event for high-res vertical wheel Mauro Carvalho Chehab
2017-04-11 13:29     ` [PATCH v4 3/5] input: add a EV_SW event for ratchet switch Mauro Carvalho Chehab
2017-04-11 13:29       ` [PATCH v4 4/5] hid-logitech-hidpp: add support for high res wheel Mauro Carvalho Chehab
2017-04-11 13:29         ` [PATCH v4 5/5] hid-logitech-hidpp: add support for ratchet switch Mauro Carvalho Chehab
2017-04-14 12:56           ` Benjamin Tissoires [this message]
2017-04-14 12:54       ` [PATCH v4 3/5] input: add a EV_SW event " Benjamin Tissoires
2017-04-15 18:04       ` Dmitry Torokhov
2017-04-15 22:50         ` Mauro Carvalho Chehab
2017-04-15 17:55   ` [PATCH v4 1/5] input: event-codes: reserve some space for REL_MISC events Dmitry Torokhov
2017-06-21 12:05     ` Benjamin Tissoires

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=20170414125626.GB301@mail.corp.redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jikos@kernel.org \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=mchehab@s-opensource.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).