/[linux-patches]/genpatches-2.6/trunk/2.6.12-pre/2900_alps-tapping.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.12-pre/2900_alps-tapping.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations) (download)
Sat Jun 11 23:20:41 2005 UTC (12 years, 4 months ago) by dsd
File size: 4991 byte(s)
Create 2.6.12 branch
1
2 Subject: [PATCH 2/4] Enable hardware tapping for ALPS touchpads
3
4 When hardware tapping is disabled on an ALPS touchpad, the touchpad
5 generates exactly the same data for a single tap and a fast double
6 tap. The effect is that the second tap in the double tap sequence is
7 lost.
8
9 To fix this problem, this patch enables hardware tapping and converts
10 the resulting tap and gesture bits to standards finger pressure values
11 (z), which is what mousedev.c and the userspace X driver expects.
12
13 Signed-off-by: Peter Osterlund <petero2@telia.com>
14 ---
15
16 linux-petero/drivers/input/mouse/alps.c | 53 +++++++++++++++++++++++++-------
17 linux-petero/drivers/input/mouse/alps.h | 4 ++
18 2 files changed, 47 insertions(+), 10 deletions(-)
19
20 diff -puN drivers/input/mouse/alps.c~alps-hwtaps drivers/input/mouse/alps.c
21 --- linux/drivers/input/mouse/alps.c~alps-hwtaps 2005-03-06 18:26:39.000000000 +0100
22 +++ linux-petero/drivers/input/mouse/alps.c 2005-03-06 18:26:39.000000000 +0100
23 @@ -78,10 +78,12 @@ struct alps_model_info {
24
25 static void alps_process_packet(struct psmouse *psmouse, struct pt_regs *regs)
26 {
27 + struct alps_data *priv = psmouse->private;
28 unsigned char *packet = psmouse->packet;
29 struct input_dev *dev = &psmouse->dev;
30 int x, y, z;
31 int left = 0, right = 0, middle = 0;
32 + int ges, fin;
33
34 input_regs(dev, regs);
35
36 @@ -123,6 +125,27 @@ static void alps_process_packet(struct p
37 return;
38 }
39
40 + ges = packet[2] & 1; /* gesture bit */
41 + fin = packet[2] & 2; /* finger bit */
42 +
43 + /* Convert hardware tap to a reasonable Z value */
44 + if (ges && !fin)
45 + z = 40;
46 +
47 + /*
48 + * A "tap and drag" operation is reported by the hardware as a transition
49 + * from (!fin && ges) to (fin && ges). This should be translated to the
50 + * sequence Z>0, Z==0, Z>0, so the Z==0 event has to be generated manually.
51 + */
52 + if (ges && fin && !priv->prev_fin) {
53 + input_report_abs(dev, ABS_X, x);
54 + input_report_abs(dev, ABS_Y, y);
55 + input_report_abs(dev, ABS_PRESSURE, 0);
56 + input_report_key(dev, BTN_TOOL_FINGER, 0);
57 + input_sync(dev);
58 + }
59 + priv->prev_fin = fin;
60 +
61 if (z > 30) input_report_key(dev, BTN_TOUCH, 1);
62 if (z < 25) input_report_key(dev, BTN_TOUCH, 0);
63
64 @@ -133,7 +156,6 @@ static void alps_process_packet(struct p
65 input_report_abs(dev, ABS_PRESSURE, z);
66 input_report_key(dev, BTN_TOOL_FINGER, z > 0);
67
68 - left |= (packet[2] ) & 1;
69 left |= (packet[3] ) & 1;
70 right |= (packet[3] >> 1) & 1;
71 if (packet[0] == 0xff) {
72 @@ -335,7 +357,7 @@ static int alps_reconnect(struct psmouse
73 return -1;
74
75 if (param[0] & 0x04)
76 - alps_tap_mode(psmouse, 0);
77 + alps_tap_mode(psmouse, 1);
78
79 if (alps_absolute_mode(psmouse)) {
80 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n");
81 @@ -351,40 +373,47 @@ static int alps_reconnect(struct psmouse
82 static void alps_disconnect(struct psmouse *psmouse)
83 {
84 psmouse_reset(psmouse);
85 + kfree(psmouse->private);
86 }
87
88 int alps_init(struct psmouse *psmouse)
89 {
90 + struct alps_data *priv;
91 unsigned char param[4];
92 int model;
93
94 + psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL);
95 + if (!priv)
96 + goto init_fail;
97 + memset(priv, 0, sizeof(struct alps_data));
98 +
99 if ((model = alps_get_model(psmouse)) < 0)
100 - return -1;
101 + goto init_fail;
102
103 printk(KERN_INFO "ALPS Touchpad (%s) detected\n",
104 model == ALPS_MODEL_GLIDEPOINT ? "Glidepoint" : "Dualpoint");
105
106 if (model == ALPS_MODEL_DUALPOINT && alps_passthrough_mode(psmouse, 1))
107 - return -1;
108 + goto init_fail;
109
110 if (alps_get_status(psmouse, param)) {
111 printk(KERN_ERR "alps.c: touchpad status report request failed\n");
112 - return -1;
113 + goto init_fail;
114 }
115
116 if (param[0] & 0x04) {
117 - printk(KERN_INFO " Disabling hardware tapping\n");
118 - if (alps_tap_mode(psmouse, 0))
119 - printk(KERN_WARNING "alps.c: Failed to disable hardware tapping\n");
120 + printk(KERN_INFO " Enabling hardware tapping\n");
121 + if (alps_tap_mode(psmouse, 1))
122 + printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n");
123 }
124
125 if (alps_absolute_mode(psmouse)) {
126 printk(KERN_ERR "alps.c: Failed to enable absolute mode\n");
127 - return -1;
128 + goto init_fail;
129 }
130
131 if (model == ALPS_MODEL_DUALPOINT && alps_passthrough_mode(psmouse, 0))
132 - return -1;
133 + goto init_fail;
134
135 psmouse->dev.evbit[LONG(EV_REL)] |= BIT(EV_REL);
136 psmouse->dev.relbit[LONG(REL_X)] |= BIT(REL_X);
137 @@ -408,6 +437,10 @@ int alps_init(struct psmouse *psmouse)
138 psmouse->pktsize = 6;
139
140 return 0;
141 +
142 +init_fail:
143 + kfree(priv);
144 + return -1;
145 }
146
147 int alps_detect(struct psmouse *psmouse, int set_properties)
148 diff -puN drivers/input/mouse/alps.h~alps-hwtaps drivers/input/mouse/alps.h
149 --- linux/drivers/input/mouse/alps.h~alps-hwtaps 2005-03-06 18:26:39.000000000 +0100
150 +++ linux-petero/drivers/input/mouse/alps.h 2005-03-06 18:26:39.000000000 +0100
151 @@ -14,4 +14,8 @@
152 int alps_detect(struct psmouse *psmouse, int set_properties);
153 int alps_init(struct psmouse *psmouse);
154
155 +struct alps_data {
156 + int prev_fin; /* Finger bit from previous packet */
157 +};
158 +
159 #endif
160 _

  ViewVC Help
Powered by ViewVC 1.1.20