linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Masaki Ota <012nexus@gmail.com>
Cc: jikos@kernel.org, benjamin.tissorires@redhat.com,
	peter.hutterer@who-t.net, hdegoede@redhat.com,
	linux-input@vger.kernel.org, masaki.ota@jp.alps.com,
	naoki.saito@jp.alps.com
Subject: Re: [PATCH] Improve Alps HID Touchpad code
Date: Wed, 22 Jun 2016 17:11:01 -0700	[thread overview]
Message-ID: <20160623001101.GE16965@dtor-ws> (raw)
In-Reply-To: <1466568668-22272-1-git-send-email-masaki.ota@jp.alps.com>

On Wed, Jun 22, 2016 at 01:11:08PM +0900, Masaki Ota wrote:
>  
> -		input_event(hdata->input, EV_KEY, BTN_LEFT, left);
> -		input_event(hdata->input, EV_KEY, BTN_RIGHT, right);
> -		input_event(hdata->input, EV_KEY, BTN_MIDDLE, middle);
> +		input_report_key(hdata->input, BTN_LEFT,
> +			data[1] & 0x1);
> +		input_report_key(hdata->input, BTN_RIGHT,
> +			(data[1] & 0x2) >> 1);
> +		input_report_key(hdata->input, BTN_MIDDLE,
> +			(data[1] & 0x4) >> 2);

There is no really need to do shifts as input_report_key() converts
value to 0/1 for you.

> +
> +		input_sync(hdata->input);
>  
>  		return 1;
>  
>  	case U1_SP_ABSOLUTE_REPORT_ID:
> -		sp_x = (data[2] | (data[3] << 8));
> -		sp_y = (data[4] | (data[5] << 8));
> -		sp_z = (data[6] | data[7]) & 0x7FFF;
> -		left = data[1] & 0x1;
> -		right = (data[1] & 0x2) >> 1;
> -		middle = (data[1] & 0x4) >> 2;
> +		sp_x = get_unaligned_le16(data+2);
> +		sp_y = get_unaligned_le16(data+4);
>  
>  		sp_x = sp_x / 8;
>  		sp_y = sp_y / 8;
>  
> -		input_event(priv->input2, EV_REL, REL_X, sp_x);
> -		input_event(priv->input2, EV_REL, REL_Y, sp_y);
> +		input_report_rel(hdata->input2, REL_X, sp_x);
> +		input_report_rel(hdata->input2, REL_Y, sp_y);
>  
> -		input_event(priv->input2, EV_KEY, BTN_LEFT, left);
> -		input_event(priv->input2, EV_KEY, BTN_RIGHT, right);
> -		input_event(priv->input2, EV_KEY, BTN_MIDDLE, middle);
> +		input_report_key(hdata->input2, BTN_LEFT,
> +			data[1] & 0x1);
> +		input_report_key(hdata->input2, BTN_RIGHT,
> +			(data[1] & 0x2) >> 1);
> +		input_report_key(hdata->input2, BTN_MIDDLE,
> +			(data[1] & 0x4) >> 2);

Same here. Maybe Jiri will fix it up by hand while appplying?

Otherwise:

Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

-- 
Dmitry

  reply	other threads:[~2016-06-23  0:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22  4:11 [PATCH] Improve Alps HID Touchpad code Masaki Ota
2016-06-23  0:11 ` Dmitry Torokhov [this message]
2016-06-23  6:58   ` Jiri Kosina
2016-07-22  8:10     ` Masaki Ota
2016-07-27 14:12       ` Jiri Kosina
  -- strict thread matches above, loose matches on Subject: below --
2016-06-21 10:28 Masaki Ota
2016-06-21 22:35 ` Dmitry Torokhov
2016-06-21 22:38   ` Jiri Kosina
2016-06-22  2:48     ` Masaki Ota
2016-06-22  4:42     ` Masaki Ota
2016-06-23  0:08       ` Dmitry Torokhov
2016-06-21  8:14 Masaki Ota
2016-06-21  8:22 ` Jiri Kosina

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=20160623001101.GE16965@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=012nexus@gmail.com \
    --cc=benjamin.tissorires@redhat.com \
    --cc=hdegoede@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=masaki.ota@jp.alps.com \
    --cc=naoki.saito@jp.alps.com \
    --cc=peter.hutterer@who-t.net \
    /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).