Skip to contentSkip to conversation

Input: ALPS - Fix ALPS touchpad detection

PATCH In review Akio Idehara 3 participants 5 messages Feb 16, 2012 – Feb 24, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Input: ALPS - Fix ALPS touchpad detection

ALPS touchpad detection fails if some buttons of ALPS are pressed. The reason is that the "E6" query response byte is different from what is expected.
This was tested on a Toshiba Portege R500.

---
 Documentation/input/alps.txt |    3 ++-
 drivers/input/mouse/alps.c   |    7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)
Documentation/input/alps.txt +2 -1
index f274c28..2f95308 100644
@@ -13,7 +13,8 @@ Detection
 
 All ALPS touchpads should respond to the "E6 report" command sequence:
 E8-E6-E6-E6-E9. An ALPS touchpad should respond with either 00-00-0A or
-00-00-64.
+00-00-64 if no buttons are pressed. The bits 0-2 of the first byte will be 1s
+if some buttons are pressed.
 
 If the E6 report is successful, the touchpad model is identified using the "E7
 report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is
drivers/input/mouse/alps.c +5 -2
index bd87380..4c6a72d 100644
@@ -952,7 +952,9 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
 
 	/*
 	 * First try "E6 report".
-	 * ALPS should return 0,0,10 or 0,0,100
+	 * ALPS should return 0,0,10 or 0,0,100 if no buttons are pressed.
+	 * The bits 0-2 of the first byte will be 1s if some buttons are
+	 * pressed.
 	 */
 	param[0] = 0;
 	if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES) ||
@@ -968,7 +970,8 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
 	psmouse_dbg(psmouse, "E6 report: %2.2x %2.2x %2.2x",
 		    param[0], param[1], param[2]);
 
-	if (param[0] != 0 || param[1] != 0 || (param[2] != 10 && param[2] != 100))
+	if ((param[0] & 0xf8) != 0 || param[1] != 0 ||
+	    (param[2] != 10 && param[2] != 100))
 		return NULL;
 
 	/*
Signature · 1 line
1.7.9
author Tested-by Seth Forshee
#2 lore raw

This is definitely a bug which isn't fixed for nine years. Why this patch isn't applied to the input sub-system (or mainline)?

Quoted 6 lines · Seth Forshee
Quoted 5 lines · Akio Idehara

ALPS touchpad detection fails if some buttons of ALPS are pressed. The reason is that the "E6" query response byte is different from what is expected.
This was tested on a Toshiba Portege R500.

Quoted 8 lines
Quoted 2 lines

This version is working fine for me. Thanks!

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

ALPS touchpad detection fails if some buttons of ALPS are pressed. The reason is that the "E6" query response byte is different from what is expected.
This was tested on a Toshiba Portege R500.

---
    Documentation/input/alps.txt |    3 ++-
    drivers/input/mouse/alps.c   |    7 +++++--
    2 files changed, 7 insertions(+), 3 deletions(-)
Documentation/input/alps.txt +2 -1
index f274c28..2f95308 100644
@@ -13,7 +13,8 @@ Detection
 
    All ALPS touchpads should respond to the "E6 report" command sequence:
    E8-E6-E6-E6-E9. An ALPS touchpad should respond with either 00-00-0A or
-00-00-64.
+00-00-64 if no buttons are pressed. The bits 0-2 of the first byte will be 1s
+if some buttons are pressed.
 
    If the E6 report is successful, the touchpad model is identified using the "E7
    report" sequence: E8-E7-E7-E7-E9. The response is the model signature and is
drivers/input/mouse/alps.c +5 -2
index bd87380..4c6a72d 100644
@@ -952,7 +952,9 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
 
    	/*
    	 * First try "E6 report".
-	 * ALPS should return 0,0,10 or 0,0,100
+	 * ALPS should return 0,0,10 or 0,0,100 if no buttons are pressed.
+	 * The bits 0-2 of the first byte will be 1s if some buttons are
+	 * pressed.
    	 */
    	param[0] = 0;
    	if (ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES) ||
@@ -968,7 +970,8 @@ static const struct alps_model_info *alps_get_model(struct psmouse *psmouse, int
    	psmouse_dbg(psmouse, "E6 report: %2.2x %2.2x %2.2x",
    		    param[0], param[1], param[2]);
 
-	if (param[0] != 0 || param[1] != 0 || (param[2] != 10 && param[2] != 100))
+	if ((param[0] & 0xf8) != 0 || param[1] != 0 ||
+	    (param[2] != 10 && param[2] != 100))
    		return NULL;
 
    	/*

-- 1.7.9

maintainer
#3 lore raw

Hi Akio,

Quoted 3 lines · Akio Idehara

This is definitely a bug which isn't fixed for nine years. Why this patch isn't applied to the input sub-system (or mainline)?

Well, if we waited for 9 years, we could wait for couple more days...

Also, please make sure you do not send patches as:

Content-Type: text/plain; charset=ISO-8859-1; format=flowed

as this requires fixing up the patch manually before it can be applied.

Anyway, applied, thank you.

Signature · 1 line
Dmitry
#4 lore raw

Hi Dmitry,

I'm sorry that I hurry you and make you trouble with email setting.

Regards, Akio.

Quoted 17 lines · Dmitry Torokhov

Hi Akio,

Quoted 3 lines · Akio Idehara

This is definitely a bug which isn't fixed for nine years. Why this patch isn't applied to the input sub-system (or mainline)?

Well, if we waited for 9 years, we could wait for couple more days...

Also, please make sure you do not send patches as:

Content-Type: text/plain; charset=ISO-8859-1; format=flowed

as this requires fixing up the patch manually before it can be applied.

Anyway, applied, thank you.