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 <jikos@kernel.org>
Subject: Re: [PATCH v3 4/4] hid-logitech-hidpp: add support for ratchet switch
Date: Fri, 7 Apr 2017 17:33:48 +0200 [thread overview]
Message-ID: <20170407153347.GD13764@mail.corp.redhat.com> (raw)
In-Reply-To: <f088d8bd1dc2cd4c937d251453b692322a7f3e18.1491564565.git.mchehab@s-opensource.com>
On Apr 07 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>
> ---
> 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 c208a5107511..6177087ffaca 100644
> --- a/drivers/hid/hid-logitech-hidpp.c
> +++ b/drivers/hid/hid-logitech-hidpp.c
> @@ -1406,6 +1406,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, 16, &response);
Like in the other patch, there is no need to have '16' here when there
is no parameters.
Cheers,
Benjamin
> + 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 ? 0x4 : 0 |
> high_res ? 0x2 : 0 |
> hidpp_mode ? 0x1 : 0;
> @@ -1945,10 +1958,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;
> }
>
> @@ -1961,6 +1975,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
>
next prev parent reply other threads:[~2017-04-07 15:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-07 11:31 [PATCH v3 0/4] add support for high res wheel found on some Logitech devices Mauro Carvalho Chehab
2017-04-07 11:31 ` [PATCH v3 1/4] input: add an EV_REL event for high-res vertical wheel Mauro Carvalho Chehab
2017-04-07 11:31 ` [PATCH v3 2/4] input: add a EV_SW event for ratchet switch Mauro Carvalho Chehab
2017-04-07 11:31 ` [PATCH v3 3/4] hid-logitech-hidpp: add support for high res wheel Mauro Carvalho Chehab
2017-04-07 11:31 ` [PATCH v3 4/4] hid-logitech-hidpp: add support for ratchet switch Mauro Carvalho Chehab
2017-04-07 15:33 ` Benjamin Tissoires [this message]
2017-04-07 15:31 ` [PATCH v3 3/4] hid-logitech-hidpp: add support for high res wheel Benjamin Tissoires
2017-04-07 12:17 ` [v3,1/4] input: add an EV_REL event for high-res vertical wheel Benjamin Tissoires
2017-04-07 13:32 ` Mauro Carvalho Chehab
2017-04-07 15:10 ` Benjamin Tissoires
2017-04-11 10:17 ` Mauro Carvalho Chehab
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=20170407153347.GD13764@mail.corp.redhat.com \
--to=benjamin.tissoires@redhat.com \
--cc=dmitry.torokhov@gmail.com \
--cc=jikos@kernel.org \
--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).