1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index f8f86de..5d4cea2 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -676,6 +676,9 @@ static int psmouse_extensions(struct psmouse *psmouse,
if (touchkit_ps2_detect(psmouse, set_properties) == 0)
return PSMOUSE_TOUCHKIT_PS2;
+
+ if (elftouch_ps2_detect(psmouse, set_properties) == 0)
+ return PSMOUSE_ELFTOUCH_PS2;
}
/*
@@ -786,6 +789,12 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.alias = "trackpoint",
.detect = trackpoint_detect,
},
+ {
+ .type = PSMOUSE_ELFTOUCH_PS2,
+ .name = "elftouchPS2",
+ .alias = "elftouch",
+ .detect = elftouch_ps2_detect,
+ },
#endif
#ifdef CONFIG_MOUSE_PS2_TOUCHKIT
{
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 54ed267..8d1ba79 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -89,6 +89,7 @@ enum psmouse_type {
PSMOUSE_TRACKPOINT,
PSMOUSE_TOUCHKIT_PS2,
PSMOUSE_CORTRON,
+ PSMOUSE_ELFTOUCH_PS2,
PSMOUSE_HGPK,
PSMOUSE_ELANTECH,
PSMOUSE_AUTO /* This one should always be last */
diff --git a/drivers/input/mouse/touchkit_ps2.c b/drivers/input/mouse/touchkit_ps2.c
index 3fadb2a..e9c27f1 100644
--- a/drivers/input/mouse/touchkit_ps2.c
+++ b/drivers/input/mouse/touchkit_ps2.c
@@ -51,6 +51,11 @@
#define TOUCHKIT_GET_X(packet) (((packet)[1] << 7) | (packet)[2])
#define TOUCHKIT_GET_Y(packet) (((packet)[3] << 7) | (packet)[4])
+#define ELFTOUCH_MAX_XC 0x0fff
+#define ELFTOUCH_MAX_YC 0x0fff
+#define ELFTOUCH_GET_X(packet) (((packet)[3] << 7) | (packet)[4])
+#define ELFTOUCH_GET_Y(packet) (((packet)[1] << 7) | (packet)[2])
+
static psmouse_ret_t touchkit_ps2_process_byte(struct psmouse *psmouse)
{
unsigned char *packet = psmouse->packet;
@@ -59,9 +64,15 @@ static psmouse_ret_t touchkit_ps2_process_byte(struct psmouse *psmouse)
if (psmouse->pktcnt != 5)
return PSMOUSE_GOOD_DATA;
- input_report_abs(dev, ABS_X, TOUCHKIT_GET_X(packet));
- input_report_abs(dev, ABS_Y, TOUCHKIT_GET_Y(packet));
+ if(psmouse->type==PSMOUSE_ELFTOUCH_PS2) {
+ input_report_abs(dev, ABS_X, ELFTOUCH_GET_X(packet));
+ input_report_abs(dev, ABS_Y, ELFTOUCH_GET_Y(packet));
+ } else {
+ input_report_abs(dev, ABS_X, TOUCHKIT_GET_X(packet));
+ input_report_abs(dev, ABS_Y, TOUCHKIT_GET_Y(packet));
+ }
input_report_key(dev, BTN_TOUCH, TOUCHKIT_GET_TOUCHED(packet));
+
input_sync(dev);
return PSMOUSE_FULL_PACKET;
@@ -98,3 +109,33 @@ int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties)
return 0;
}
+
+int elftouch_ps2_detect(struct psmouse *psmouse, int set_properties)
+{
+ struct input_dev *dev = psmouse->dev;
+ unsigned char param[16];
+ int command, res;
+
+ param[0]=0x0f4;
+ command = TOUCHKIT_SEND_PARMS(1, 0, TOUCHKIT_CMD);
+ res=ps2_command(&psmouse->ps2dev, param, command);
+ if(res) { return -ENODEV; }
+
+ param[0]=0x0b0;
+ command = TOUCHKIT_SEND_PARMS(1, 1, TOUCHKIT_CMD);
+ res=ps2_command(&psmouse->ps2dev, param, command);
+ if(res) { return -ENODEV; }
+
+ if (set_properties) {
+ dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+ set_bit(BTN_TOUCH, dev->keybit);
+ input_set_abs_params(dev, ABS_X, 0, ELFTOUCH_MAX_XC, 0, 0);
+ input_set_abs_params(dev, ABS_Y, 0, ELFTOUCH_MAX_YC, 0, 0);
+
+ psmouse->vendor = "ElfTouch";
+ psmouse->name = "Touchscreen";
+ psmouse->protocol_handler = touchkit_ps2_process_byte;
+ psmouse->pktsize = 5;
+ }
+ return 0;
+}
diff --git a/drivers/input/mouse/touchkit_ps2.h b/drivers/input/mouse/touchkit_ps2.h
index 8a0dd35..f32ef4c 100644
--- a/drivers/input/mouse/touchkit_ps2.h
+++ b/drivers/input/mouse/touchkit_ps2.h
@@ -14,12 +14,18 @@
#ifdef CONFIG_MOUSE_PS2_TOUCHKIT
int touchkit_ps2_detect(struct psmouse *psmouse, int set_properties);
+int elftouch_ps2_detect(struct psmouse *psmouse, int set_properties);
#else
static inline int touchkit_ps2_detect(struct psmouse *psmouse,
int set_properties)
{
return -ENOSYS;
}
+static inline int elftouch_ps2_detect(struct psmouse *psmouse,
+ int set_properties)
+{
+ return -ENOSYS;
+}
#endif /* CONFIG_MOUSE_PS2_TOUCHKIT */
#endif
|