diff mbox

[4/4] input/alps: Set DualPoint flag for 74 03 28 devices

Message ID 1464436862-2649-5-git-send-email-ben@smart-cactus.org (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Gamari May 28, 2016, 12:01 p.m. UTC
Here we introduce logic in alps_identify to set the ALPS_DUALPOINT flag
for touchpad hardware responding to E7 report with 73 03 28, as is found
in the Dell Latitude E7470.
---
 drivers/input/mouse/alps.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Pali Rohár May 30, 2016, 9:11 a.m. UTC | #1
On Saturday 28 May 2016 14:01:02 Ben Gamari wrote:
> Here we introduce logic in alps_identify to set the ALPS_DUALPOINT flag
> for touchpad hardware responding to E7 report with 73 03 28, as is found
> in the Dell Latitude E7470.
> ---
>  drivers/input/mouse/alps.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> index 25d2cad..431bc26 100644
> --- a/drivers/input/mouse/alps.c
> +++ b/drivers/input/mouse/alps.c
> @@ -2776,6 +2776,7 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
>  	const struct alps_protocol_info *protocol;
>  	unsigned char e6[4], e7[4], ec[4];
>  	int error;
> +	int flags = 0;
>  
>  	/*
>  	 * First try "E6 report".
> @@ -2817,6 +2818,10 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
>  		} else if (e7[0] == 0x73 && e7[1] == 0x03 &&
>  			   e7[2] == 0x14 && ec[1] == 0x02) {
>  			protocol = &alps_v8_protocol_data;
> +		} else if (e7[0] == 0x73 && e7[1] == 0x03 &&
> +			   e7[2] == 0x28 && ec[1] == 0x01) {
> +			protocol = &alps_v8_protocol_data;
> +			flags |= ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE;
>  		} else {
>  			psmouse_dbg(psmouse,
>  				    "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec);
> @@ -2830,6 +2835,7 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
>  		error = alps_set_protocol(psmouse, priv, protocol);
>  		if (error)
>  			return error;
> +		priv->flags |= flags;
>  	}
>  
>  	return 0;

I would rather see setting flags in alps_set_protocol function. Where it
is done for other protocols. But do not know if it is easily possible
without rewriting lot of code...
Dmitry Torokhov June 21, 2016, 12:43 a.m. UTC | #2
On Mon, May 30, 2016 at 11:11:00AM +0200, Pali Rohár wrote:
> On Saturday 28 May 2016 14:01:02 Ben Gamari wrote:
> > Here we introduce logic in alps_identify to set the ALPS_DUALPOINT flag
> > for touchpad hardware responding to E7 report with 73 03 28, as is found
> > in the Dell Latitude E7470.
> > ---
> >  drivers/input/mouse/alps.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
> > index 25d2cad..431bc26 100644
> > --- a/drivers/input/mouse/alps.c
> > +++ b/drivers/input/mouse/alps.c
> > @@ -2776,6 +2776,7 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
> >  	const struct alps_protocol_info *protocol;
> >  	unsigned char e6[4], e7[4], ec[4];
> >  	int error;
> > +	int flags = 0;
> >  
> >  	/*
> >  	 * First try "E6 report".
> > @@ -2817,6 +2818,10 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
> >  		} else if (e7[0] == 0x73 && e7[1] == 0x03 &&
> >  			   e7[2] == 0x14 && ec[1] == 0x02) {
> >  			protocol = &alps_v8_protocol_data;
> > +		} else if (e7[0] == 0x73 && e7[1] == 0x03 &&
> > +			   e7[2] == 0x28 && ec[1] == 0x01) {
> > +			protocol = &alps_v8_protocol_data;
> > +			flags |= ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE;
> >  		} else {
> >  			psmouse_dbg(psmouse,
> >  				    "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec);
> > @@ -2830,6 +2835,7 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
> >  		error = alps_set_protocol(psmouse, priv, protocol);
> >  		if (error)
> >  			return error;
> > +		priv->flags |= flags;
> >  	}
> >  
> >  	return 0;
> 
> I would rather see setting flags in alps_set_protocol function. Where it
> is done for other protocols. But do not know if it is easily possible
> without rewriting lot of code...

Could probably key it off of prov->fw_ver[1] (which is ec[1]) in
alps_set_protocol() in V8 case.

Thanks.
diff mbox

Patch

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 25d2cad..431bc26 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -2776,6 +2776,7 @@  static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
 	const struct alps_protocol_info *protocol;
 	unsigned char e6[4], e7[4], ec[4];
 	int error;
+	int flags = 0;
 
 	/*
 	 * First try "E6 report".
@@ -2817,6 +2818,10 @@  static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
 		} else if (e7[0] == 0x73 && e7[1] == 0x03 &&
 			   e7[2] == 0x14 && ec[1] == 0x02) {
 			protocol = &alps_v8_protocol_data;
+		} else if (e7[0] == 0x73 && e7[1] == 0x03 &&
+			   e7[2] == 0x28 && ec[1] == 0x01) {
+			protocol = &alps_v8_protocol_data;
+			flags |= ALPS_DUALPOINT | ALPS_DUALPOINT_WITH_PRESSURE;
 		} else {
 			psmouse_dbg(psmouse,
 				    "Likely not an ALPS touchpad: E7=%3ph, EC=%3ph\n", e7, ec);
@@ -2830,6 +2835,7 @@  static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
 		error = alps_set_protocol(psmouse, priv, protocol);
 		if (error)
 			return error;
+		priv->flags |= flags;
 	}
 
 	return 0;