All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] input: alps-fix the issue the special alps trackpoint do not work.
@ 2019-05-20 11:01 XiaoXiao Liu
  2019-05-21  1:07 ` 答复: " Xiaoxiao Liu
  0 siblings, 1 reply; 19+ messages in thread
From: XiaoXiao Liu @ 2019-05-20 11:01 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: linux-input, linux-kernel, hui.wang, xiaojian.cao, zhangfp1,
	xiaoxiao.liu-1, XiaoXiao Liu

when the alps trackpoint is detected and using the alps_v8_protocol_data
procotol, the alps driver will not report the input data.

solution: use standard mouse driver instead of alps driver when the specail
trackpoint was detected.

Signed-off-by: XiaoXiao Liu <sliuuxiaonxiao@gmail.com>
---
 drivers/input/mouse/alps.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 0a6f7ca883e7..516ae1d0eb17 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -24,7 +24,7 @@
 
 #include "psmouse.h"
 #include "alps.h"
-
+#include "trackpoint.h"
 /*
  * Definitions for ALPS version 3 and 4 command mode protocol
  */
@@ -2864,6 +2864,22 @@ static const struct alps_protocol_info *alps_match_table(unsigned char *e7,
 	return NULL;
 }
 
+int alps_check_is_trackpoint(struct psmouse *psmouse)
+{
+	u8 param[2] = { 0 };
+	int error;
+
+	error = ps2_command(&psmouse->ps2dev,
+			    param, MAKE_PS2_CMD(0, 2, TP_READ_ID));
+	if (error)
+		return error;
+
+	if (param[0] == TP_VARIANT_ALPS)
+		return 0;
+	psmouse_warn(psmouse, "It is not alps trackpoint.\n");
+	return -ENODEV;
+}
+
 static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
 {
 	const struct alps_protocol_info *protocol;
@@ -2912,6 +2928,11 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
 			protocol = &alps_v3_protocol_data;
 		} else if (e7[0] == 0x73 && e7[1] == 0x03 &&
 			   (e7[2] == 0x14 || e7[2] == 0x28)) {
+				if (alps_check_is_trackpoint(psmouse) == 0) {
+					psmouse_warn(psmouse,
+					"It is alps trackpoint, use the standard mouse driver.\n");
+					return -EINVAL;
+				}
 			protocol = &alps_v8_protocol_data;
 		} else if (e7[0] == 0x73 && e7[1] == 0x03 && e7[2] == 0xc8) {
 			protocol = &alps_v9_protocol_data;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2019-05-25  1:34 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20 11:01 [PATCH] input: alps-fix the issue the special alps trackpoint do not work XiaoXiao Liu
2019-05-21  1:07 ` 答复: " Xiaoxiao Liu
2019-05-21  2:26   ` Hui Wang
2019-05-21  9:46     ` Pali Rohár
2019-05-22  2:53       ` 答复: " Xiaoxiao Liu
2019-05-22  6:35         ` Pali Rohár
2019-05-22  7:30           ` 答复: " Xiaoxiao Liu
2019-05-22  7:40             ` Pali Rohár
2019-05-23  6:01               ` Peter Hutterer
2019-05-24  5:25                 ` Hui Wang
2019-05-24  5:36                   ` Peter Hutterer
2019-05-24  5:50                     ` Hui Wang
2019-05-24  7:26                       ` Pali Rohár
2019-05-24  7:37                         ` Hui Wang
2019-05-24  9:37                           ` Peter Hutterer
     [not found]                             ` <f0c2dff9-519e-d54d-4cd0-2be666656dc2@canonical.com>
2019-05-24 10:58                               ` Peter Hutterer
2019-05-25  1:33                                 ` Hui Wang
2019-05-24  9:32                         ` Peter Hutterer
2019-05-24  9:52                           ` Pali Rohár

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.