All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "jingle.wu" <jingle.wu@emc.com.tw>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	phoenix@emc.com.tw, josh.chen@emc.com.tw, dave.wang@emc.com.tw
Subject: Re: [PATCH 1/2] Input: elan_i2c - Add new trackpoint report type 0x5F.
Date: Wed, 9 Dec 2020 22:14:29 -0800	[thread overview]
Message-ID: <X9G8xUk/QvcxsNWi@google.com> (raw)
In-Reply-To: <20201207090751.9076-1-jingle.wu@emc.com.tw>

Hi Jingle,

On Mon, Dec 07, 2020 at 05:07:51PM +0800, jingle.wu wrote:
> The 0x5F is new trackpoint report type of some module.
> 
> Signed-off-by: Jingle Wu <jingle.wu@emc.com.tw>
> ---
>  drivers/input/mouse/elan_i2c_core.c  | 2 ++
>  drivers/input/mouse/elan_i2c_smbus.c | 3 ++-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
> index 61ed3f5ca219..8f0c4663167c 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -52,6 +52,7 @@
>  #define ETP_REPORT_ID		0x5D
>  #define ETP_REPORT_ID2		0x60	/* High precision report */
>  #define ETP_TP_REPORT_ID	0x5E
> +#define ETP_TP_REPORT_ID2	0x5F
>  #define ETP_REPORT_ID_OFFSET	2
>  #define ETP_TOUCH_INFO_OFFSET	3
>  #define ETP_FINGER_DATA_OFFSET	4

I think we might need to move this into elan_i2c.h so that we can
reference it from elan_i2c_smbus.c.

> @@ -1076,6 +1077,7 @@ static irqreturn_t elan_isr(int irq, void *dev_id)
>  		elan_report_absolute(data, report, true);
>  		break;
>  	case ETP_TP_REPORT_ID:
> +	case ETP_TP_REPORT_ID2:
>  		elan_report_trackpoint(data, report);
>  		break;
>  	default:
> diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c
> index 1820f1cfc1dc..1226d47ec3cf 100644
> --- a/drivers/input/mouse/elan_i2c_smbus.c
> +++ b/drivers/input/mouse/elan_i2c_smbus.c
> @@ -45,6 +45,7 @@
>  #define ETP_SMBUS_CALIBRATE_QUERY	0xC5
>  
>  #define ETP_SMBUS_REPORT_LEN		32
> +#define ETP_SMBUS_REPORT_LEN2		7
>  #define ETP_SMBUS_REPORT_OFFSET		2
>  #define ETP_SMBUS_HELLOPACKET_LEN	5
>  #define ETP_SMBUS_IAP_PASSWORD		0x1234
> @@ -497,7 +498,7 @@ static int elan_smbus_get_report(struct i2c_client *client,
>  		return len;
>  	}
>  
> -	if (len != ETP_SMBUS_REPORT_LEN) {
> +	if ((len != ETP_SMBUS_REPORT_LEN) && (len != ETP_SMBUS_REPORT_LEN2))  {

I would prefer if we validated report length versus the packet type
before accepting it.

>  		dev_err(&client->dev,
>  			"wrong report length (%d vs %d expected)\n",
>  			len, ETP_SMBUS_REPORT_LEN);
> -- 
> 2.17.1
> 

Thanks.

-- 
Dmitry

  reply	other threads:[~2020-12-10  6:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07  9:07 [PATCH 1/2] Input: elan_i2c - Add new trackpoint report type 0x5F jingle.wu
2020-12-10  6:14 ` Dmitry Torokhov [this message]
2020-12-11  2:38   ` jingle
2020-12-11  3:04     ` 'Dmitry Torokhov'
  -- strict thread matches above, loose matches on Subject: below --
2020-12-11  7:15 jingle.wu
2020-12-11 21:48 ` Dmitry Torokhov
2020-12-07  8:50 jingle.wu

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=X9G8xUk/QvcxsNWi@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=dave.wang@emc.com.tw \
    --cc=jingle.wu@emc.com.tw \
    --cc=josh.chen@emc.com.tw \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=phoenix@emc.com.tw \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.