updated on Mon Jan 16 12:07:49 UTC 2012
[aur-mirror.git] / synaptics-mod / coordinates.patch
blobf0bc5598afc7b6515416e753050d242914151bbd
1 --- synaptics.c
2 +++ synaptics.c
3 @@ -437,16 +437,17 @@
4 if (hw.z > 30) input_report_key(dev, BTN_TOUCH, 1);
5 if (hw.z < 25) input_report_key(dev, BTN_TOUCH, 0);
7 - if (hw.z > 0) {
8 + if (hw.z > 0 && hw.x != 1) {
9 input_report_abs(dev, ABS_X, hw.x);
10 input_report_abs(dev, ABS_Y, YMAX_NOMINAL + YMIN_NOMINAL - hw.y);
11 - }
13 input_report_abs(dev, ABS_PRESSURE, hw.z);
15 input_report_abs(dev, ABS_TOOL_WIDTH, finger_width);
16 input_report_key(dev, BTN_TOOL_FINGER, num_fingers == 1);
17 input_report_key(dev, BTN_TOOL_DOUBLETAP, num_fingers == 2);
18 input_report_key(dev, BTN_TOOL_TRIPLETAP, num_fingers == 3);
19 + }
21 input_report_key(dev, BTN_LEFT, hw.left);
22 input_report_key(dev, BTN_RIGHT, hw.right);
23 --- psmouse-base.c
24 +++ psmouse-base.c
25 @@ -23,13 +23,7 @@
27 #include "psmouse.h"
28 #include "synaptics.h"
29 -#include "logips2pp.h"
30 -#include "alps.h"
31 -#include "hgpk.h"
32 -#include "lifebook.h"
33 -#include "trackpoint.h"
34 -#include "touchkit_ps2.h"
35 -#include "elantech.h"
38 #define DRIVER_DESC "PS/2 mouse driver"
40 @@ -132,60 +126,6 @@
41 * Full packet accumulated, process it
44 -/*
45 - * Scroll wheel on IntelliMice, scroll buttons on NetMice
46 - */
48 - if (psmouse->type == PSMOUSE_IMPS || psmouse->type == PSMOUSE_GENPS)
49 - input_report_rel(dev, REL_WHEEL, -(signed char) packet[3]);
51 -/*
52 - * Scroll wheel and buttons on IntelliMouse Explorer
53 - */
55 - if (psmouse->type == PSMOUSE_IMEX) {
56 - switch (packet[3] & 0xC0) {
57 - case 0x80: /* vertical scroll on IntelliMouse Explorer 4.0 */
58 - input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 32) - (int) (packet[3] & 31));
59 - break;
60 - case 0x40: /* horizontal scroll on IntelliMouse Explorer 4.0 */
61 - input_report_rel(dev, REL_HWHEEL, (int) (packet[3] & 32) - (int) (packet[3] & 31));
62 - break;
63 - case 0x00:
64 - case 0xC0:
65 - input_report_rel(dev, REL_WHEEL, (int) (packet[3] & 8) - (int) (packet[3] & 7));
66 - input_report_key(dev, BTN_SIDE, (packet[3] >> 4) & 1);
67 - input_report_key(dev, BTN_EXTRA, (packet[3] >> 5) & 1);
68 - break;
69 - }
70 - }
72 -/*
73 - * Extra buttons on Genius NewNet 3D
74 - */
76 - if (psmouse->type == PSMOUSE_GENPS) {
77 - input_report_key(dev, BTN_SIDE, (packet[0] >> 6) & 1);
78 - input_report_key(dev, BTN_EXTRA, (packet[0] >> 7) & 1);
79 - }
81 -/*
82 - * Extra button on ThinkingMouse
83 - */
84 - if (psmouse->type == PSMOUSE_THINKPS) {
85 - input_report_key(dev, BTN_EXTRA, (packet[0] >> 3) & 1);
86 - /* Without this bit of weirdness moving up gives wildly high Y changes. */
87 - packet[1] |= (packet[0] & 0x40) << 1;
88 - }
90 -/*
91 - * Cortron PS2 Trackball reports SIDE button on the 4th bit of the first
92 - * byte.
93 - */
94 - if (psmouse->type == PSMOUSE_CORTRON) {
95 - input_report_key(dev, BTN_SIDE, (packet[0] >> 3) & 1);
96 - packet[0] |= 0x08;
97 - }
100 * Generic PS/2 Mouse
101 @@ -403,144 +343,6 @@
106 - * Genius NetMouse magic init.
107 - */
108 -static int genius_detect(struct psmouse *psmouse, int set_properties)
110 - struct ps2dev *ps2dev = &psmouse->ps2dev;
111 - unsigned char param[4];
113 - param[0] = 3;
114 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
115 - ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11);
116 - ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11);
117 - ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11);
118 - ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO);
120 - if (param[0] != 0x00 || param[1] != 0x33 || param[2] != 0x55)
121 - return -1;
123 - if (set_properties) {
124 - set_bit(BTN_EXTRA, psmouse->dev->keybit);
125 - set_bit(BTN_SIDE, psmouse->dev->keybit);
126 - set_bit(REL_WHEEL, psmouse->dev->relbit);
128 - psmouse->vendor = "Genius";
129 - psmouse->name = "Mouse";
130 - psmouse->pktsize = 4;
133 - return 0;
137 - * IntelliMouse magic init.
138 - */
139 -static int intellimouse_detect(struct psmouse *psmouse, int set_properties)
141 - struct ps2dev *ps2dev = &psmouse->ps2dev;
142 - unsigned char param[2];
144 - param[0] = 200;
145 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
146 - param[0] = 100;
147 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
148 - param[0] = 80;
149 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
150 - ps2_command(ps2dev, param, PSMOUSE_CMD_GETID);
152 - if (param[0] != 3)
153 - return -1;
155 - if (set_properties) {
156 - set_bit(BTN_MIDDLE, psmouse->dev->keybit);
157 - set_bit(REL_WHEEL, psmouse->dev->relbit);
159 - if (!psmouse->vendor) psmouse->vendor = "Generic";
160 - if (!psmouse->name) psmouse->name = "Wheel Mouse";
161 - psmouse->pktsize = 4;
164 - return 0;
168 - * Try IntelliMouse/Explorer magic init.
169 - */
170 -static int im_explorer_detect(struct psmouse *psmouse, int set_properties)
172 - struct ps2dev *ps2dev = &psmouse->ps2dev;
173 - unsigned char param[2];
175 - intellimouse_detect(psmouse, 0);
177 - param[0] = 200;
178 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
179 - param[0] = 200;
180 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
181 - param[0] = 80;
182 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
183 - ps2_command(ps2dev, param, PSMOUSE_CMD_GETID);
185 - if (param[0] != 4)
186 - return -1;
188 -/* Magic to enable horizontal scrolling on IntelliMouse 4.0 */
189 - param[0] = 200;
190 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
191 - param[0] = 80;
192 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
193 - param[0] = 40;
194 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
196 - if (set_properties) {
197 - set_bit(BTN_MIDDLE, psmouse->dev->keybit);
198 - set_bit(REL_WHEEL, psmouse->dev->relbit);
199 - set_bit(REL_HWHEEL, psmouse->dev->relbit);
200 - set_bit(BTN_SIDE, psmouse->dev->keybit);
201 - set_bit(BTN_EXTRA, psmouse->dev->keybit);
203 - if (!psmouse->vendor) psmouse->vendor = "Generic";
204 - if (!psmouse->name) psmouse->name = "Explorer Mouse";
205 - psmouse->pktsize = 4;
208 - return 0;
212 - * Kensington ThinkingMouse / ExpertMouse magic init.
213 - */
214 -static int thinking_detect(struct psmouse *psmouse, int set_properties)
216 - struct ps2dev *ps2dev = &psmouse->ps2dev;
217 - unsigned char param[2];
218 - static const unsigned char seq[] = { 20, 60, 40, 20, 20, 60, 40, 20, 20 };
219 - int i;
221 - param[0] = 10;
222 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
223 - param[0] = 0;
224 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
225 - for (i = 0; i < ARRAY_SIZE(seq); i++) {
226 - param[0] = seq[i];
227 - ps2_command(ps2dev, param, PSMOUSE_CMD_SETRATE);
229 - ps2_command(ps2dev, param, PSMOUSE_CMD_GETID);
231 - if (param[0] != 2)
232 - return -1;
234 - if (set_properties) {
235 - set_bit(BTN_EXTRA, psmouse->dev->keybit);
237 - psmouse->vendor = "Kensington";
238 - psmouse->name = "ThinkingMouse";
241 - return 0;
245 * Bare PS/2 protocol "detection". Always succeeds.
246 @@ -556,21 +358,6 @@
250 - * Cortron PS/2 protocol detection. There's no special way to detect it, so it
251 - * must be forced by sysfs protocol writing.
252 - */
253 -static int cortron_detect(struct psmouse *psmouse, int set_properties)
255 - if (set_properties) {
256 - psmouse->vendor = "Cortron";
257 - psmouse->name = "PS/2 Trackball";
258 - set_bit(BTN_SIDE, psmouse->dev->keybit);
261 - return 0;
265 * psmouse_extensions() probes for any extensions to the basic PS/2 protocol
266 * the mouse may have.
268 @@ -581,25 +368,6 @@
269 int synaptics_hardware = 0;
272 - * We always check for lifebook because it does not disturb mouse
273 - * (it only checks DMI information).
274 - */
275 - if (lifebook_detect(psmouse, set_properties) == 0) {
276 - if (max_proto > PSMOUSE_IMEX) {
277 - if (!set_properties || lifebook_init(psmouse) == 0)
278 - return PSMOUSE_LIFEBOOK;
283 - * Try Kensington ThinkingMouse (we try first, because synaptics probe
284 - * upsets the thinkingmouse).
285 - */
287 - if (max_proto > PSMOUSE_IMEX && thinking_detect(psmouse, set_properties) == 0)
288 - return PSMOUSE_THINKPS;
291 * Try Synaptics TouchPad. Note that probing is done even if Synaptics protocol
292 * support is disabled in config - we need to know if it is synaptics so we
293 * can reset it properly after probing for intellimouse.
294 @@ -623,80 +391,6 @@
295 synaptics_reset(psmouse);
299 - * Try ALPS TouchPad
300 - */
301 - if (max_proto > PSMOUSE_IMEX) {
302 - ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
303 - if (alps_detect(psmouse, set_properties) == 0) {
304 - if (!set_properties || alps_init(psmouse) == 0)
305 - return PSMOUSE_ALPS;
307 - * Init failed, try basic relative protocols
308 - */
309 - max_proto = PSMOUSE_IMEX;
314 - * Try OLPC HGPK touchpad.
315 - */
316 - if (max_proto > PSMOUSE_IMEX &&
317 - hgpk_detect(psmouse, set_properties) == 0) {
318 - if (!set_properties || hgpk_init(psmouse) == 0)
319 - return PSMOUSE_HGPK;
321 - * Init failed, try basic relative protocols
322 - */
323 - max_proto = PSMOUSE_IMEX;
327 - * Try Elantech touchpad.
328 - */
329 - if (max_proto > PSMOUSE_IMEX &&
330 - elantech_detect(psmouse, set_properties) == 0) {
331 - if (!set_properties || elantech_init(psmouse) == 0)
332 - return PSMOUSE_ELANTECH;
334 - * Init failed, try basic relative protocols
335 - */
336 - max_proto = PSMOUSE_IMEX;
339 - if (max_proto > PSMOUSE_IMEX) {
340 - if (genius_detect(psmouse, set_properties) == 0)
341 - return PSMOUSE_GENPS;
343 - if (ps2pp_init(psmouse, set_properties) == 0)
344 - return PSMOUSE_PS2PP;
346 - if (trackpoint_detect(psmouse, set_properties) == 0)
347 - return PSMOUSE_TRACKPOINT;
349 - if (touchkit_ps2_detect(psmouse, set_properties) == 0)
350 - return PSMOUSE_TOUCHKIT_PS2;
354 - * Reset to defaults in case the device got confused by extended
355 - * protocol probes. Note that we follow up with full reset because
356 - * some mice put themselves to sleep when they see PSMOUSE_RESET_DIS.
357 - */
358 - ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
359 - psmouse_reset(psmouse);
361 - if (max_proto >= PSMOUSE_IMEX && im_explorer_detect(psmouse, set_properties) == 0)
362 - return PSMOUSE_IMEX;
364 - if (max_proto >= PSMOUSE_IMPS && intellimouse_detect(psmouse, set_properties) == 0)
365 - return PSMOUSE_IMPS;
368 - * Okay, all failed, we have a standard mouse here. The number of the buttons
369 - * is still a question, though. We assume 3.
370 - */
371 - ps2bare_detect(psmouse, set_properties);
373 if (synaptics_hardware) {
375 @@ -719,40 +413,6 @@
376 .maxproto = 1,
377 .detect = ps2bare_detect,
379 -#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
381 - .type = PSMOUSE_PS2PP,
382 - .name = "PS2++",
383 - .alias = "logitech",
384 - .detect = ps2pp_init,
385 - },
386 -#endif
388 - .type = PSMOUSE_THINKPS,
389 - .name = "ThinkPS/2",
390 - .alias = "thinkps",
391 - .detect = thinking_detect,
392 - },
394 - .type = PSMOUSE_GENPS,
395 - .name = "GenPS/2",
396 - .alias = "genius",
397 - .detect = genius_detect,
398 - },
400 - .type = PSMOUSE_IMPS,
401 - .name = "ImPS/2",
402 - .alias = "imps",
403 - .maxproto = 1,
404 - .detect = intellimouse_detect,
405 - },
407 - .type = PSMOUSE_IMEX,
408 - .name = "ImExPS/2",
409 - .alias = "exps",
410 - .maxproto = 1,
411 - .detect = im_explorer_detect,
412 - },
413 #ifdef CONFIG_MOUSE_PS2_SYNAPTICS
415 .type = PSMOUSE_SYNAPTICS,
416 @@ -762,62 +422,6 @@
417 .init = synaptics_init,
419 #endif
420 -#ifdef CONFIG_MOUSE_PS2_ALPS
422 - .type = PSMOUSE_ALPS,
423 - .name = "AlpsPS/2",
424 - .alias = "alps",
425 - .detect = alps_detect,
426 - .init = alps_init,
427 - },
428 -#endif
429 -#ifdef CONFIG_MOUSE_PS2_LIFEBOOK
431 - .type = PSMOUSE_LIFEBOOK,
432 - .name = "LBPS/2",
433 - .alias = "lifebook",
434 - .init = lifebook_init,
435 - },
436 -#endif
437 -#ifdef CONFIG_MOUSE_PS2_TRACKPOINT
439 - .type = PSMOUSE_TRACKPOINT,
440 - .name = "TPPS/2",
441 - .alias = "trackpoint",
442 - .detect = trackpoint_detect,
443 - },
444 -#endif
445 -#ifdef CONFIG_MOUSE_PS2_TOUCHKIT
447 - .type = PSMOUSE_TOUCHKIT_PS2,
448 - .name = "touchkitPS/2",
449 - .alias = "touchkit",
450 - .detect = touchkit_ps2_detect,
451 - },
452 -#endif
453 -#ifdef CONFIG_MOUSE_PS2_OLPC
455 - .type = PSMOUSE_HGPK,
456 - .name = "OLPC HGPK",
457 - .alias = "hgpk",
458 - .detect = hgpk_detect,
459 - },
460 -#endif
461 -#ifdef CONFIG_MOUSE_PS2_ELANTECH
463 - .type = PSMOUSE_ELANTECH,
464 - .name = "ETPS/2",
465 - .alias = "elantech",
466 - .detect = elantech_detect,
467 - .init = elantech_init,
468 - },
469 - #endif
471 - .type = PSMOUSE_CORTRON,
472 - .name = "CortronPS/2",
473 - .alias = "cortps",
474 - .detect = cortron_detect,
475 - },
477 .type = PSMOUSE_AUTO,
478 .name = "auto",