diff options
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r-- | drivers/input/mouse/alps.c | 100 | ||||
-rw-r--r-- | drivers/input/mouse/elantech.c | 1 | ||||
-rw-r--r-- | drivers/input/mouse/hgpk.c | 13 | ||||
-rw-r--r-- | drivers/input/mouse/lifebook.c | 55 | ||||
-rw-r--r-- | drivers/input/mouse/lifebook.h | 4 | ||||
-rw-r--r-- | drivers/input/mouse/logips2pp.c | 4 | ||||
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 41 | ||||
-rw-r--r-- | drivers/input/mouse/sentelic.c | 1 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.c | 31 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics.h | 1 | ||||
-rw-r--r-- | drivers/input/mouse/synaptics_i2c.c | 6 | ||||
-rw-r--r-- | drivers/input/mouse/touchkit_ps2.c | 3 | ||||
-rw-r--r-- | drivers/input/mouse/trackpoint.c | 13 | ||||
-rw-r--r-- | drivers/input/mouse/vsxxxaa.c | 374 |
14 files changed, 344 insertions, 303 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index f36110689aae..a3f492a50850 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -28,13 +28,16 @@ | |||
28 | #define dbg(format, arg...) do {} while (0) | 28 | #define dbg(format, arg...) do {} while (0) |
29 | #endif | 29 | #endif |
30 | 30 | ||
31 | #define ALPS_DUALPOINT 0x01 | 31 | |
32 | #define ALPS_WHEEL 0x02 | 32 | #define ALPS_OLDPROTO 0x01 /* old style input */ |
33 | #define ALPS_FW_BK_1 0x04 | 33 | #define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */ |
34 | #define ALPS_4BTN 0x08 | 34 | #define ALPS_PASS 0x04 /* device has a pass-through port */ |
35 | #define ALPS_OLDPROTO 0x10 | 35 | |
36 | #define ALPS_PASS 0x20 | 36 | #define ALPS_WHEEL 0x08 /* hardware wheel present */ |
37 | #define ALPS_FW_BK_2 0x40 | 37 | #define ALPS_FW_BK_1 0x10 /* front & back buttons present */ |
38 | #define ALPS_FW_BK_2 0x20 /* front & back buttons present */ | ||
39 | #define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */ | ||
40 | |||
38 | 41 | ||
39 | static const struct alps_model_info alps_model_data[] = { | 42 | static const struct alps_model_info alps_model_data[] = { |
40 | { { 0x32, 0x02, 0x14 }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */ | 43 | { { 0x32, 0x02, 0x14 }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */ |
@@ -56,7 +59,7 @@ static const struct alps_model_info alps_model_data[] = { | |||
56 | { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, | 59 | { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, |
57 | { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ | 60 | { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */ |
58 | { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude E6500 */ | 61 | { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude E6500 */ |
59 | { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FW_BK_1 }, /* Dell Vostro 1400 */ | 62 | { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ |
60 | }; | 63 | }; |
61 | 64 | ||
62 | /* | 65 | /* |
@@ -83,6 +86,7 @@ static const struct alps_model_info alps_model_data[] = { | |||
83 | static void alps_process_packet(struct psmouse *psmouse) | 86 | static void alps_process_packet(struct psmouse *psmouse) |
84 | { | 87 | { |
85 | struct alps_data *priv = psmouse->private; | 88 | struct alps_data *priv = psmouse->private; |
89 | const struct alps_model_info *model = priv->i; | ||
86 | unsigned char *packet = psmouse->packet; | 90 | unsigned char *packet = psmouse->packet; |
87 | struct input_dev *dev = psmouse->dev; | 91 | struct input_dev *dev = psmouse->dev; |
88 | struct input_dev *dev2 = priv->dev2; | 92 | struct input_dev *dev2 = priv->dev2; |
@@ -101,7 +105,7 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
101 | return; | 105 | return; |
102 | } | 106 | } |
103 | 107 | ||
104 | if (priv->i->flags & ALPS_OLDPROTO) { | 108 | if (model->flags & ALPS_OLDPROTO) { |
105 | left = packet[2] & 0x10; | 109 | left = packet[2] & 0x10; |
106 | right = packet[2] & 0x08; | 110 | right = packet[2] & 0x08; |
107 | middle = 0; | 111 | middle = 0; |
@@ -117,12 +121,12 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
117 | z = packet[5]; | 121 | z = packet[5]; |
118 | } | 122 | } |
119 | 123 | ||
120 | if (priv->i->flags & ALPS_FW_BK_1) { | 124 | if (model->flags & ALPS_FW_BK_1) { |
121 | back = packet[0] & 0x10; | 125 | back = packet[0] & 0x10; |
122 | forward = packet[2] & 4; | 126 | forward = packet[2] & 4; |
123 | } | 127 | } |
124 | 128 | ||
125 | if (priv->i->flags & ALPS_FW_BK_2) { | 129 | if (model->flags & ALPS_FW_BK_2) { |
126 | back = packet[3] & 4; | 130 | back = packet[3] & 4; |
127 | forward = packet[2] & 4; | 131 | forward = packet[2] & 4; |
128 | if ((middle = forward && back)) | 132 | if ((middle = forward && back)) |
@@ -132,7 +136,7 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
132 | ges = packet[2] & 1; | 136 | ges = packet[2] & 1; |
133 | fin = packet[2] & 2; | 137 | fin = packet[2] & 2; |
134 | 138 | ||
135 | if ((priv->i->flags & ALPS_DUALPOINT) && z == 127) { | 139 | if ((model->flags & ALPS_DUALPOINT) && z == 127) { |
136 | input_report_rel(dev2, REL_X, (x > 383 ? (x - 768) : x)); | 140 | input_report_rel(dev2, REL_X, (x > 383 ? (x - 768) : x)); |
137 | input_report_rel(dev2, REL_Y, -(y > 255 ? (y - 512) : y)); | 141 | input_report_rel(dev2, REL_Y, -(y > 255 ? (y - 512) : y)); |
138 | 142 | ||
@@ -150,7 +154,8 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
150 | input_report_key(dev, BTN_MIDDLE, middle); | 154 | input_report_key(dev, BTN_MIDDLE, middle); |
151 | 155 | ||
152 | /* Convert hardware tap to a reasonable Z value */ | 156 | /* Convert hardware tap to a reasonable Z value */ |
153 | if (ges && !fin) z = 40; | 157 | if (ges && !fin) |
158 | z = 40; | ||
154 | 159 | ||
155 | /* | 160 | /* |
156 | * A "tap and drag" operation is reported by the hardware as a transition | 161 | * A "tap and drag" operation is reported by the hardware as a transition |
@@ -166,8 +171,10 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
166 | } | 171 | } |
167 | priv->prev_fin = fin; | 172 | priv->prev_fin = fin; |
168 | 173 | ||
169 | if (z > 30) input_report_key(dev, BTN_TOUCH, 1); | 174 | if (z > 30) |
170 | if (z < 25) input_report_key(dev, BTN_TOUCH, 0); | 175 | input_report_key(dev, BTN_TOUCH, 1); |
176 | if (z < 25) | ||
177 | input_report_key(dev, BTN_TOUCH, 0); | ||
171 | 178 | ||
172 | if (z > 0) { | 179 | if (z > 0) { |
173 | input_report_abs(dev, ABS_X, x); | 180 | input_report_abs(dev, ABS_X, x); |
@@ -177,14 +184,21 @@ static void alps_process_packet(struct psmouse *psmouse) | |||
177 | input_report_abs(dev, ABS_PRESSURE, z); | 184 | input_report_abs(dev, ABS_PRESSURE, z); |
178 | input_report_key(dev, BTN_TOOL_FINGER, z > 0); | 185 | input_report_key(dev, BTN_TOOL_FINGER, z > 0); |
179 | 186 | ||
180 | if (priv->i->flags & ALPS_WHEEL) | 187 | if (model->flags & ALPS_WHEEL) |
181 | input_report_rel(dev, REL_WHEEL, ((packet[2] << 1) & 0x08) - ((packet[0] >> 4) & 0x07)); | 188 | input_report_rel(dev, REL_WHEEL, ((packet[2] << 1) & 0x08) - ((packet[0] >> 4) & 0x07)); |
182 | 189 | ||
183 | if (priv->i->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { | 190 | if (model->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { |
184 | input_report_key(dev, BTN_FORWARD, forward); | 191 | input_report_key(dev, BTN_FORWARD, forward); |
185 | input_report_key(dev, BTN_BACK, back); | 192 | input_report_key(dev, BTN_BACK, back); |
186 | } | 193 | } |
187 | 194 | ||
195 | if (model->flags & ALPS_FOUR_BUTTONS) { | ||
196 | input_report_key(dev, BTN_0, packet[2] & 4); | ||
197 | input_report_key(dev, BTN_1, packet[0] & 0x10); | ||
198 | input_report_key(dev, BTN_2, packet[3] & 4); | ||
199 | input_report_key(dev, BTN_3, packet[0] & 0x20); | ||
200 | } | ||
201 | |||
188 | input_sync(dev); | 202 | input_sync(dev); |
189 | } | 203 | } |
190 | 204 | ||
@@ -393,15 +407,12 @@ static int alps_poll(struct psmouse *psmouse) | |||
393 | return 0; | 407 | return 0; |
394 | } | 408 | } |
395 | 409 | ||
396 | static int alps_hw_init(struct psmouse *psmouse, int *version) | 410 | static int alps_hw_init(struct psmouse *psmouse) |
397 | { | 411 | { |
398 | struct alps_data *priv = psmouse->private; | 412 | struct alps_data *priv = psmouse->private; |
413 | const struct alps_model_info *model = priv->i; | ||
399 | 414 | ||
400 | priv->i = alps_get_model(psmouse, version); | 415 | if ((model->flags & ALPS_PASS) && |
401 | if (!priv->i) | ||
402 | return -1; | ||
403 | |||
404 | if ((priv->i->flags & ALPS_PASS) && | ||
405 | alps_passthrough_mode(psmouse, true)) { | 416 | alps_passthrough_mode(psmouse, true)) { |
406 | return -1; | 417 | return -1; |
407 | } | 418 | } |
@@ -416,7 +427,7 @@ static int alps_hw_init(struct psmouse *psmouse, int *version) | |||
416 | return -1; | 427 | return -1; |
417 | } | 428 | } |
418 | 429 | ||
419 | if ((priv->i->flags & ALPS_PASS) && | 430 | if ((model->flags & ALPS_PASS) && |
420 | alps_passthrough_mode(psmouse, false)) { | 431 | alps_passthrough_mode(psmouse, false)) { |
421 | return -1; | 432 | return -1; |
422 | } | 433 | } |
@@ -432,12 +443,15 @@ static int alps_hw_init(struct psmouse *psmouse, int *version) | |||
432 | 443 | ||
433 | static int alps_reconnect(struct psmouse *psmouse) | 444 | static int alps_reconnect(struct psmouse *psmouse) |
434 | { | 445 | { |
446 | const struct alps_model_info *model; | ||
447 | |||
435 | psmouse_reset(psmouse); | 448 | psmouse_reset(psmouse); |
436 | 449 | ||
437 | if (alps_hw_init(psmouse, NULL)) | 450 | model = alps_get_model(psmouse, NULL); |
451 | if (!model) | ||
438 | return -1; | 452 | return -1; |
439 | 453 | ||
440 | return 0; | 454 | return alps_hw_init(psmouse); |
441 | } | 455 | } |
442 | 456 | ||
443 | static void alps_disconnect(struct psmouse *psmouse) | 457 | static void alps_disconnect(struct psmouse *psmouse) |
@@ -452,6 +466,7 @@ static void alps_disconnect(struct psmouse *psmouse) | |||
452 | int alps_init(struct psmouse *psmouse) | 466 | int alps_init(struct psmouse *psmouse) |
453 | { | 467 | { |
454 | struct alps_data *priv; | 468 | struct alps_data *priv; |
469 | const struct alps_model_info *model; | ||
455 | struct input_dev *dev1 = psmouse->dev, *dev2; | 470 | struct input_dev *dev1 = psmouse->dev, *dev2; |
456 | int version; | 471 | int version; |
457 | 472 | ||
@@ -463,33 +478,48 @@ int alps_init(struct psmouse *psmouse) | |||
463 | priv->dev2 = dev2; | 478 | priv->dev2 = dev2; |
464 | psmouse->private = priv; | 479 | psmouse->private = priv; |
465 | 480 | ||
466 | if (alps_hw_init(psmouse, &version)) | 481 | model = alps_get_model(psmouse, &version); |
482 | if (!model) | ||
483 | goto init_fail; | ||
484 | |||
485 | priv->i = model; | ||
486 | |||
487 | if (alps_hw_init(psmouse)) | ||
467 | goto init_fail; | 488 | goto init_fail; |
468 | 489 | ||
469 | dev1->evbit[BIT_WORD(EV_KEY)] |= BIT_MASK(EV_KEY); | 490 | dev1->evbit[BIT_WORD(EV_KEY)] |= BIT_MASK(EV_KEY); |
470 | dev1->keybit[BIT_WORD(BTN_TOUCH)] |= BIT_MASK(BTN_TOUCH); | 491 | dev1->keybit[BIT_WORD(BTN_TOUCH)] |= BIT_MASK(BTN_TOUCH); |
471 | dev1->keybit[BIT_WORD(BTN_TOOL_FINGER)] |= BIT_MASK(BTN_TOOL_FINGER); | 492 | dev1->keybit[BIT_WORD(BTN_TOOL_FINGER)] |= BIT_MASK(BTN_TOOL_FINGER); |
472 | dev1->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) | | 493 | dev1->keybit[BIT_WORD(BTN_LEFT)] |= |
473 | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | 494 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); |
474 | 495 | ||
475 | dev1->evbit[BIT_WORD(EV_ABS)] |= BIT_MASK(EV_ABS); | 496 | dev1->evbit[BIT_WORD(EV_ABS)] |= BIT_MASK(EV_ABS); |
476 | input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0); | 497 | input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0); |
477 | input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); | 498 | input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); |
478 | input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); | 499 | input_set_abs_params(dev1, ABS_PRESSURE, 0, 127, 0, 0); |
479 | 500 | ||
480 | if (priv->i->flags & ALPS_WHEEL) { | 501 | if (model->flags & ALPS_WHEEL) { |
481 | dev1->evbit[BIT_WORD(EV_REL)] |= BIT_MASK(EV_REL); | 502 | dev1->evbit[BIT_WORD(EV_REL)] |= BIT_MASK(EV_REL); |
482 | dev1->relbit[BIT_WORD(REL_WHEEL)] |= BIT_MASK(REL_WHEEL); | 503 | dev1->relbit[BIT_WORD(REL_WHEEL)] |= BIT_MASK(REL_WHEEL); |
483 | } | 504 | } |
484 | 505 | ||
485 | if (priv->i->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { | 506 | if (model->flags & (ALPS_FW_BK_1 | ALPS_FW_BK_2)) { |
486 | dev1->keybit[BIT_WORD(BTN_FORWARD)] |= BIT_MASK(BTN_FORWARD); | 507 | dev1->keybit[BIT_WORD(BTN_FORWARD)] |= BIT_MASK(BTN_FORWARD); |
487 | dev1->keybit[BIT_WORD(BTN_BACK)] |= BIT_MASK(BTN_BACK); | 508 | dev1->keybit[BIT_WORD(BTN_BACK)] |= BIT_MASK(BTN_BACK); |
488 | } | 509 | } |
489 | 510 | ||
511 | if (model->flags & ALPS_FOUR_BUTTONS) { | ||
512 | dev1->keybit[BIT_WORD(BTN_0)] |= BIT_MASK(BTN_0); | ||
513 | dev1->keybit[BIT_WORD(BTN_1)] |= BIT_MASK(BTN_1); | ||
514 | dev1->keybit[BIT_WORD(BTN_2)] |= BIT_MASK(BTN_2); | ||
515 | dev1->keybit[BIT_WORD(BTN_3)] |= BIT_MASK(BTN_3); | ||
516 | } else { | ||
517 | dev1->keybit[BIT_WORD(BTN_MIDDLE)] |= BIT_MASK(BTN_MIDDLE); | ||
518 | } | ||
519 | |||
490 | snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys); | 520 | snprintf(priv->phys, sizeof(priv->phys), "%s/input1", psmouse->ps2dev.serio->phys); |
491 | dev2->phys = priv->phys; | 521 | dev2->phys = priv->phys; |
492 | dev2->name = (priv->i->flags & ALPS_DUALPOINT) ? "DualPoint Stick" : "PS/2 Mouse"; | 522 | dev2->name = (model->flags & ALPS_DUALPOINT) ? "DualPoint Stick" : "PS/2 Mouse"; |
493 | dev2->id.bustype = BUS_I8042; | 523 | dev2->id.bustype = BUS_I8042; |
494 | dev2->id.vendor = 0x0002; | 524 | dev2->id.vendor = 0x0002; |
495 | dev2->id.product = PSMOUSE_ALPS; | 525 | dev2->id.product = PSMOUSE_ALPS; |
@@ -497,9 +527,9 @@ int alps_init(struct psmouse *psmouse) | |||
497 | dev2->dev.parent = &psmouse->ps2dev.serio->dev; | 527 | dev2->dev.parent = &psmouse->ps2dev.serio->dev; |
498 | 528 | ||
499 | dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 529 | dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
500 | dev2->relbit[BIT_WORD(REL_X)] |= BIT_MASK(REL_X) | BIT_MASK(REL_Y); | 530 | dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); |
501 | dev2->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) | | 531 | dev2->keybit[BIT_WORD(BTN_LEFT)] = |
502 | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | 532 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); |
503 | 533 | ||
504 | if (input_register_device(priv->dev2)) | 534 | if (input_register_device(priv->dev2)) |
505 | goto init_fail; | 535 | goto init_fail; |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index fda35e615abf..b27684f267bf 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -420,6 +420,7 @@ static void elantech_set_input_params(struct psmouse *psmouse) | |||
420 | 420 | ||
421 | __set_bit(EV_KEY, dev->evbit); | 421 | __set_bit(EV_KEY, dev->evbit); |
422 | __set_bit(EV_ABS, dev->evbit); | 422 | __set_bit(EV_ABS, dev->evbit); |
423 | __clear_bit(EV_REL, dev->evbit); | ||
423 | 424 | ||
424 | __set_bit(BTN_LEFT, dev->keybit); | 425 | __set_bit(BTN_LEFT, dev->keybit); |
425 | __set_bit(BTN_RIGHT, dev->keybit); | 426 | __set_bit(BTN_RIGHT, dev->keybit); |
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index de1e553028b7..b146237266d8 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c | |||
@@ -430,19 +430,6 @@ static int hgpk_register(struct psmouse *psmouse) | |||
430 | struct input_dev *dev = psmouse->dev; | 430 | struct input_dev *dev = psmouse->dev; |
431 | int err; | 431 | int err; |
432 | 432 | ||
433 | /* unset the things that psmouse-base sets which we don't have */ | ||
434 | __clear_bit(BTN_MIDDLE, dev->keybit); | ||
435 | |||
436 | /* set the things we do have */ | ||
437 | __set_bit(EV_KEY, dev->evbit); | ||
438 | __set_bit(EV_REL, dev->evbit); | ||
439 | |||
440 | __set_bit(REL_X, dev->relbit); | ||
441 | __set_bit(REL_Y, dev->relbit); | ||
442 | |||
443 | __set_bit(BTN_LEFT, dev->keybit); | ||
444 | __set_bit(BTN_RIGHT, dev->keybit); | ||
445 | |||
446 | /* register handlers */ | 433 | /* register handlers */ |
447 | psmouse->protocol_handler = hgpk_process_byte; | 434 | psmouse->protocol_handler = hgpk_process_byte; |
448 | psmouse->poll = hgpk_poll; | 435 | psmouse->poll = hgpk_poll; |
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 82811558ec33..2e6bdfea0165 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
@@ -25,11 +25,13 @@ struct lifebook_data { | |||
25 | char phys[32]; | 25 | char phys[32]; |
26 | }; | 26 | }; |
27 | 27 | ||
28 | static bool lifebook_present; | ||
29 | |||
28 | static const char *desired_serio_phys; | 30 | static const char *desired_serio_phys; |
29 | 31 | ||
30 | static int lifebook_set_serio_phys(const struct dmi_system_id *d) | 32 | static int lifebook_limit_serio3(const struct dmi_system_id *d) |
31 | { | 33 | { |
32 | desired_serio_phys = d->driver_data; | 34 | desired_serio_phys = "isa0060/serio3"; |
33 | return 0; | 35 | return 0; |
34 | } | 36 | } |
35 | 37 | ||
@@ -41,53 +43,53 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d) | |||
41 | return 0; | 43 | return 0; |
42 | } | 44 | } |
43 | 45 | ||
44 | static const struct dmi_system_id lifebook_dmi_table[] = { | 46 | static const struct dmi_system_id __initconst lifebook_dmi_table[] = { |
47 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) | ||
45 | { | 48 | { |
46 | .ident = "FLORA-ie 55mi", | 49 | /* FLORA-ie 55mi */ |
47 | .matches = { | 50 | .matches = { |
48 | DMI_MATCH(DMI_PRODUCT_NAME, "FLORA-ie 55mi"), | 51 | DMI_MATCH(DMI_PRODUCT_NAME, "FLORA-ie 55mi"), |
49 | }, | 52 | }, |
50 | }, | 53 | }, |
51 | { | 54 | { |
52 | .ident = "LifeBook B", | 55 | /* LifeBook B */ |
53 | .matches = { | 56 | .matches = { |
54 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), | 57 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), |
55 | }, | 58 | }, |
56 | }, | 59 | }, |
57 | { | 60 | { |
58 | .ident = "Lifebook B", | 61 | /* Lifebook B */ |
59 | .matches = { | 62 | .matches = { |
60 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), | 63 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), |
61 | }, | 64 | }, |
62 | }, | 65 | }, |
63 | { | 66 | { |
64 | .ident = "Lifebook B-2130", | 67 | /* Lifebook B-2130 */ |
65 | .matches = { | 68 | .matches = { |
66 | DMI_MATCH(DMI_BOARD_NAME, "ZEPHYR"), | 69 | DMI_MATCH(DMI_BOARD_NAME, "ZEPHYR"), |
67 | }, | 70 | }, |
68 | }, | 71 | }, |
69 | { | 72 | { |
70 | .ident = "Lifebook B213x/B2150", | 73 | /* Lifebook B213x/B2150 */ |
71 | .matches = { | 74 | .matches = { |
72 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), | 75 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), |
73 | }, | 76 | }, |
74 | }, | 77 | }, |
75 | { | 78 | { |
76 | .ident = "Zephyr", | 79 | /* Zephyr */ |
77 | .matches = { | 80 | .matches = { |
78 | DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"), | 81 | DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"), |
79 | }, | 82 | }, |
80 | }, | 83 | }, |
81 | { | 84 | { |
82 | .ident = "CF-18", | 85 | /* Panasonic CF-18 */ |
83 | .matches = { | 86 | .matches = { |
84 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), | 87 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"), |
85 | }, | 88 | }, |
86 | .callback = lifebook_set_serio_phys, | 89 | .callback = lifebook_limit_serio3, |
87 | .driver_data = "isa0060/serio3", | ||
88 | }, | 90 | }, |
89 | { | 91 | { |
90 | .ident = "Panasonic CF-28", | 92 | /* Panasonic CF-28 */ |
91 | .matches = { | 93 | .matches = { |
92 | DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), | 94 | DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), |
93 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-28"), | 95 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-28"), |
@@ -95,7 +97,7 @@ static const struct dmi_system_id lifebook_dmi_table[] = { | |||
95 | .callback = lifebook_set_6byte_proto, | 97 | .callback = lifebook_set_6byte_proto, |
96 | }, | 98 | }, |
97 | { | 99 | { |
98 | .ident = "Panasonic CF-29", | 100 | /* Panasonic CF-29 */ |
99 | .matches = { | 101 | .matches = { |
100 | DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), | 102 | DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"), |
101 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"), | 103 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"), |
@@ -103,21 +105,27 @@ static const struct dmi_system_id lifebook_dmi_table[] = { | |||
103 | .callback = lifebook_set_6byte_proto, | 105 | .callback = lifebook_set_6byte_proto, |
104 | }, | 106 | }, |
105 | { | 107 | { |
106 | .ident = "CF-72", | 108 | /* Panasonic CF-72 */ |
107 | .matches = { | 109 | .matches = { |
108 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-72"), | 110 | DMI_MATCH(DMI_PRODUCT_NAME, "CF-72"), |
109 | }, | 111 | }, |
110 | .callback = lifebook_set_6byte_proto, | 112 | .callback = lifebook_set_6byte_proto, |
111 | }, | 113 | }, |
112 | { | 114 | { |
113 | .ident = "Lifebook B142", | 115 | /* Lifebook B142 */ |
114 | .matches = { | 116 | .matches = { |
115 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), | 117 | DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), |
116 | }, | 118 | }, |
117 | }, | 119 | }, |
118 | { } | 120 | { } |
121 | #endif | ||
119 | }; | 122 | }; |
120 | 123 | ||
124 | void __init lifebook_module_init(void) | ||
125 | { | ||
126 | lifebook_present = dmi_check_system(lifebook_dmi_table); | ||
127 | } | ||
128 | |||
121 | static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) | 129 | static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) |
122 | { | 130 | { |
123 | struct lifebook_data *priv = psmouse->private; | 131 | struct lifebook_data *priv = psmouse->private; |
@@ -198,10 +206,10 @@ static int lifebook_absolute_mode(struct psmouse *psmouse) | |||
198 | return -1; | 206 | return -1; |
199 | 207 | ||
200 | /* | 208 | /* |
201 | Enable absolute output -- ps2_command fails always but if | 209 | * Enable absolute output -- ps2_command fails always but if |
202 | you leave this call out the touchsreen will never send | 210 | * you leave this call out the touchsreen will never send |
203 | absolute coordinates | 211 | * absolute coordinates |
204 | */ | 212 | */ |
205 | param = lifebook_use_6byte_proto ? 0x08 : 0x07; | 213 | param = lifebook_use_6byte_proto ? 0x08 : 0x07; |
206 | ps2_command(ps2dev, ¶m, PSMOUSE_CMD_SETRES); | 214 | ps2_command(ps2dev, ¶m, PSMOUSE_CMD_SETRES); |
207 | 215 | ||
@@ -243,7 +251,7 @@ static void lifebook_disconnect(struct psmouse *psmouse) | |||
243 | 251 | ||
244 | int lifebook_detect(struct psmouse *psmouse, bool set_properties) | 252 | int lifebook_detect(struct psmouse *psmouse, bool set_properties) |
245 | { | 253 | { |
246 | if (!dmi_check_system(lifebook_dmi_table)) | 254 | if (!lifebook_present) |
247 | return -1; | 255 | return -1; |
248 | 256 | ||
249 | if (desired_serio_phys && | 257 | if (desired_serio_phys && |
@@ -283,8 +291,8 @@ static int lifebook_create_relative_device(struct psmouse *psmouse) | |||
283 | 291 | ||
284 | dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 292 | dev2->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
285 | dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); | 293 | dev2->relbit[BIT_WORD(REL_X)] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); |
286 | dev2->keybit[BIT_WORD(BTN_LEFT)] = BIT_MASK(BTN_LEFT) | | 294 | dev2->keybit[BIT_WORD(BTN_LEFT)] = |
287 | BIT_MASK(BTN_RIGHT); | 295 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); |
288 | 296 | ||
289 | error = input_register_device(priv->dev2); | 297 | error = input_register_device(priv->dev2); |
290 | if (error) | 298 | if (error) |
@@ -309,6 +317,7 @@ int lifebook_init(struct psmouse *psmouse) | |||
309 | 317 | ||
310 | dev1->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); | 318 | dev1->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); |
311 | dev1->relbit[0] = 0; | 319 | dev1->relbit[0] = 0; |
320 | dev1->keybit[BIT_WORD(BTN_MOUSE)] = 0; | ||
312 | dev1->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | 321 | dev1->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); |
313 | input_set_abs_params(dev1, ABS_X, 0, max_coord, 0, 0); | 322 | input_set_abs_params(dev1, ABS_X, 0, max_coord, 0, 0); |
314 | input_set_abs_params(dev1, ABS_Y, 0, max_coord, 0, 0); | 323 | input_set_abs_params(dev1, ABS_Y, 0, max_coord, 0, 0); |
diff --git a/drivers/input/mouse/lifebook.h b/drivers/input/mouse/lifebook.h index 407cb226bc0a..4c4326c6f504 100644 --- a/drivers/input/mouse/lifebook.h +++ b/drivers/input/mouse/lifebook.h | |||
@@ -12,9 +12,13 @@ | |||
12 | #define _LIFEBOOK_H | 12 | #define _LIFEBOOK_H |
13 | 13 | ||
14 | #ifdef CONFIG_MOUSE_PS2_LIFEBOOK | 14 | #ifdef CONFIG_MOUSE_PS2_LIFEBOOK |
15 | void lifebook_module_init(void); | ||
15 | int lifebook_detect(struct psmouse *psmouse, bool set_properties); | 16 | int lifebook_detect(struct psmouse *psmouse, bool set_properties); |
16 | int lifebook_init(struct psmouse *psmouse); | 17 | int lifebook_init(struct psmouse *psmouse); |
17 | #else | 18 | #else |
19 | inline void lifebook_module_init(void) | ||
20 | { | ||
21 | } | ||
18 | inline int lifebook_detect(struct psmouse *psmouse, bool set_properties) | 22 | inline int lifebook_detect(struct psmouse *psmouse, bool set_properties) |
19 | { | 23 | { |
20 | return -ENOSYS; | 24 | return -ENOSYS; |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index ab5dc5f5fd83..543c240a85f2 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -404,8 +404,8 @@ int ps2pp_init(struct psmouse *psmouse, bool set_properties) | |||
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
407 | if (buttons < 3) | 407 | if (buttons >= 3) |
408 | __clear_bit(BTN_MIDDLE, psmouse->dev->keybit); | 408 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); |
409 | 409 | ||
410 | if (model_info) | 410 | if (model_info) |
411 | ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); | 411 | ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 07c53798301a..fd0bc094616a 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -425,6 +425,7 @@ static int genius_detect(struct psmouse *psmouse, bool set_properties) | |||
425 | return -1; | 425 | return -1; |
426 | 426 | ||
427 | if (set_properties) { | 427 | if (set_properties) { |
428 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
428 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); | 429 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); |
429 | __set_bit(BTN_SIDE, psmouse->dev->keybit); | 430 | __set_bit(BTN_SIDE, psmouse->dev->keybit); |
430 | __set_bit(REL_WHEEL, psmouse->dev->relbit); | 431 | __set_bit(REL_WHEEL, psmouse->dev->relbit); |
@@ -460,8 +461,10 @@ static int intellimouse_detect(struct psmouse *psmouse, bool set_properties) | |||
460 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | 461 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); |
461 | __set_bit(REL_WHEEL, psmouse->dev->relbit); | 462 | __set_bit(REL_WHEEL, psmouse->dev->relbit); |
462 | 463 | ||
463 | if (!psmouse->vendor) psmouse->vendor = "Generic"; | 464 | if (!psmouse->vendor) |
464 | if (!psmouse->name) psmouse->name = "Wheel Mouse"; | 465 | psmouse->vendor = "Generic"; |
466 | if (!psmouse->name) | ||
467 | psmouse->name = "Wheel Mouse"; | ||
465 | psmouse->pktsize = 4; | 468 | psmouse->pktsize = 4; |
466 | } | 469 | } |
467 | 470 | ||
@@ -504,8 +507,10 @@ static int im_explorer_detect(struct psmouse *psmouse, bool set_properties) | |||
504 | __set_bit(BTN_SIDE, psmouse->dev->keybit); | 507 | __set_bit(BTN_SIDE, psmouse->dev->keybit); |
505 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); | 508 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); |
506 | 509 | ||
507 | if (!psmouse->vendor) psmouse->vendor = "Generic"; | 510 | if (!psmouse->vendor) |
508 | if (!psmouse->name) psmouse->name = "Explorer Mouse"; | 511 | psmouse->vendor = "Generic"; |
512 | if (!psmouse->name) | ||
513 | psmouse->name = "Explorer Mouse"; | ||
509 | psmouse->pktsize = 4; | 514 | psmouse->pktsize = 4; |
510 | } | 515 | } |
511 | 516 | ||
@@ -536,6 +541,7 @@ static int thinking_detect(struct psmouse *psmouse, bool set_properties) | |||
536 | return -1; | 541 | return -1; |
537 | 542 | ||
538 | if (set_properties) { | 543 | if (set_properties) { |
544 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
539 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); | 545 | __set_bit(BTN_EXTRA, psmouse->dev->keybit); |
540 | 546 | ||
541 | psmouse->vendor = "Kensington"; | 547 | psmouse->vendor = "Kensington"; |
@@ -551,8 +557,16 @@ static int thinking_detect(struct psmouse *psmouse, bool set_properties) | |||
551 | static int ps2bare_detect(struct psmouse *psmouse, bool set_properties) | 557 | static int ps2bare_detect(struct psmouse *psmouse, bool set_properties) |
552 | { | 558 | { |
553 | if (set_properties) { | 559 | if (set_properties) { |
554 | if (!psmouse->vendor) psmouse->vendor = "Generic"; | 560 | if (!psmouse->vendor) |
555 | if (!psmouse->name) psmouse->name = "Mouse"; | 561 | psmouse->vendor = "Generic"; |
562 | if (!psmouse->name) | ||
563 | psmouse->name = "Mouse"; | ||
564 | |||
565 | /* | ||
566 | * We have no way of figuring true number of buttons so let's | ||
567 | * assume that the device has 3. | ||
568 | */ | ||
569 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
556 | } | 570 | } |
557 | 571 | ||
558 | return 0; | 572 | return 0; |
@@ -567,6 +581,8 @@ static int cortron_detect(struct psmouse *psmouse, bool set_properties) | |||
567 | if (set_properties) { | 581 | if (set_properties) { |
568 | psmouse->vendor = "Cortron"; | 582 | psmouse->vendor = "Cortron"; |
569 | psmouse->name = "PS/2 Trackball"; | 583 | psmouse->name = "PS/2 Trackball"; |
584 | |||
585 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
570 | __set_bit(BTN_SIDE, psmouse->dev->keybit); | 586 | __set_bit(BTN_SIDE, psmouse->dev->keybit); |
571 | } | 587 | } |
572 | 588 | ||
@@ -1184,15 +1200,16 @@ static void psmouse_disconnect(struct serio *serio) | |||
1184 | mutex_unlock(&psmouse_mutex); | 1200 | mutex_unlock(&psmouse_mutex); |
1185 | } | 1201 | } |
1186 | 1202 | ||
1187 | static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse_protocol *proto) | 1203 | static int psmouse_switch_protocol(struct psmouse *psmouse, |
1204 | const struct psmouse_protocol *proto) | ||
1188 | { | 1205 | { |
1189 | struct input_dev *input_dev = psmouse->dev; | 1206 | struct input_dev *input_dev = psmouse->dev; |
1190 | 1207 | ||
1191 | input_dev->dev.parent = &psmouse->ps2dev.serio->dev; | 1208 | input_dev->dev.parent = &psmouse->ps2dev.serio->dev; |
1192 | 1209 | ||
1193 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 1210 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
1194 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) | | 1211 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] = |
1195 | BIT_MASK(BTN_MIDDLE) | BIT_MASK(BTN_RIGHT); | 1212 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); |
1196 | input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); | 1213 | input_dev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y); |
1197 | 1214 | ||
1198 | psmouse->set_rate = psmouse_set_rate; | 1215 | psmouse->set_rate = psmouse_set_rate; |
@@ -1209,8 +1226,7 @@ static int psmouse_switch_protocol(struct psmouse *psmouse, const struct psmouse | |||
1209 | return -1; | 1226 | return -1; |
1210 | 1227 | ||
1211 | psmouse->type = proto->type; | 1228 | psmouse->type = proto->type; |
1212 | } | 1229 | } else |
1213 | else | ||
1214 | psmouse->type = psmouse_extensions(psmouse, | 1230 | psmouse->type = psmouse_extensions(psmouse, |
1215 | psmouse_max_proto, true); | 1231 | psmouse_max_proto, true); |
1216 | 1232 | ||
@@ -1680,6 +1696,9 @@ static int __init psmouse_init(void) | |||
1680 | { | 1696 | { |
1681 | int err; | 1697 | int err; |
1682 | 1698 | ||
1699 | lifebook_module_init(); | ||
1700 | synaptics_module_init(); | ||
1701 | |||
1683 | kpsmoused_wq = create_singlethread_workqueue("kpsmoused"); | 1702 | kpsmoused_wq = create_singlethread_workqueue("kpsmoused"); |
1684 | if (!kpsmoused_wq) { | 1703 | if (!kpsmoused_wq) { |
1685 | printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n"); | 1704 | printk(KERN_ERR "psmouse: failed to create kpsmoused workqueue\n"); |
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index f84cbd97c884..77b9fd0b3fbf 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c | |||
@@ -836,6 +836,7 @@ int fsp_init(struct psmouse *psmouse) | |||
836 | priv->flags |= FSPDRV_FLAG_EN_OPC; | 836 | priv->flags |= FSPDRV_FLAG_EN_OPC; |
837 | 837 | ||
838 | /* Set up various supported input event bits */ | 838 | /* Set up various supported input event bits */ |
839 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
839 | __set_bit(BTN_BACK, psmouse->dev->keybit); | 840 | __set_bit(BTN_BACK, psmouse->dev->keybit); |
840 | __set_bit(BTN_FORWARD, psmouse->dev->keybit); | 841 | __set_bit(BTN_FORWARD, psmouse->dev->keybit); |
841 | __set_bit(REL_WHEEL, psmouse->dev->relbit); | 842 | __set_bit(REL_WHEEL, psmouse->dev->relbit); |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index f4a61252bcc9..05689e732191 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -24,6 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/dmi.h> | ||
27 | #include <linux/input.h> | 28 | #include <linux/input.h> |
28 | #include <linux/serio.h> | 29 | #include <linux/serio.h> |
29 | #include <linux/libps2.h> | 30 | #include <linux/libps2.h> |
@@ -629,25 +630,26 @@ static int synaptics_reconnect(struct psmouse *psmouse) | |||
629 | return 0; | 630 | return 0; |
630 | } | 631 | } |
631 | 632 | ||
632 | #if defined(__i386__) | 633 | static bool impaired_toshiba_kbc; |
633 | #include <linux/dmi.h> | 634 | |
634 | static const struct dmi_system_id toshiba_dmi_table[] = { | 635 | static const struct dmi_system_id __initconst toshiba_dmi_table[] = { |
636 | #if defined(CONFIG_DMI) && defined(CONFIG_X86) | ||
635 | { | 637 | { |
636 | .ident = "Toshiba Satellite", | 638 | /* Toshiba Satellite */ |
637 | .matches = { | 639 | .matches = { |
638 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 640 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
639 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"), | 641 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite"), |
640 | }, | 642 | }, |
641 | }, | 643 | }, |
642 | { | 644 | { |
643 | .ident = "Toshiba Dynabook", | 645 | /* Toshiba Dynabook */ |
644 | .matches = { | 646 | .matches = { |
645 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 647 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
646 | DMI_MATCH(DMI_PRODUCT_NAME, "dynabook"), | 648 | DMI_MATCH(DMI_PRODUCT_NAME, "dynabook"), |
647 | }, | 649 | }, |
648 | }, | 650 | }, |
649 | { | 651 | { |
650 | .ident = "Toshiba Portege M300", | 652 | /* Toshiba Portege M300 */ |
651 | .matches = { | 653 | .matches = { |
652 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 654 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
653 | DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"), | 655 | DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M300"), |
@@ -655,7 +657,7 @@ static const struct dmi_system_id toshiba_dmi_table[] = { | |||
655 | 657 | ||
656 | }, | 658 | }, |
657 | { | 659 | { |
658 | .ident = "Toshiba Portege M300", | 660 | /* Toshiba Portege M300 */ |
659 | .matches = { | 661 | .matches = { |
660 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 662 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
661 | DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"), | 663 | DMI_MATCH(DMI_PRODUCT_NAME, "Portable PC"), |
@@ -664,8 +666,13 @@ static const struct dmi_system_id toshiba_dmi_table[] = { | |||
664 | 666 | ||
665 | }, | 667 | }, |
666 | { } | 668 | { } |
667 | }; | ||
668 | #endif | 669 | #endif |
670 | }; | ||
671 | |||
672 | void __init synaptics_module_init(void) | ||
673 | { | ||
674 | impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table); | ||
675 | } | ||
669 | 676 | ||
670 | int synaptics_init(struct psmouse *psmouse) | 677 | int synaptics_init(struct psmouse *psmouse) |
671 | { | 678 | { |
@@ -718,18 +725,16 @@ int synaptics_init(struct psmouse *psmouse) | |||
718 | if (SYN_CAP_PASS_THROUGH(priv->capabilities)) | 725 | if (SYN_CAP_PASS_THROUGH(priv->capabilities)) |
719 | synaptics_pt_create(psmouse); | 726 | synaptics_pt_create(psmouse); |
720 | 727 | ||
721 | #if defined(__i386__) | ||
722 | /* | 728 | /* |
723 | * Toshiba's KBC seems to have trouble handling data from | 729 | * Toshiba's KBC seems to have trouble handling data from |
724 | * Synaptics as full rate, switch to lower rate which is roughly | 730 | * Synaptics as full rate, switch to lower rate which is roughly |
725 | * thye same as rate of standard PS/2 mouse. | 731 | * thye same as rate of standard PS/2 mouse. |
726 | */ | 732 | */ |
727 | if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) { | 733 | if (psmouse->rate >= 80 && impaired_toshiba_kbc) { |
728 | printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n", | 734 | printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n", |
729 | dmi_get_system_info(DMI_PRODUCT_NAME)); | 735 | dmi_get_system_info(DMI_PRODUCT_NAME)); |
730 | psmouse->rate = 40; | 736 | psmouse->rate = 40; |
731 | } | 737 | } |
732 | #endif | ||
733 | 738 | ||
734 | return 0; | 739 | return 0; |
735 | 740 | ||
@@ -740,6 +745,10 @@ int synaptics_init(struct psmouse *psmouse) | |||
740 | 745 | ||
741 | #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ | 746 | #else /* CONFIG_MOUSE_PS2_SYNAPTICS */ |
742 | 747 | ||
748 | void __init synaptics_module_init(void) | ||
749 | { | ||
750 | } | ||
751 | |||
743 | int synaptics_init(struct psmouse *psmouse) | 752 | int synaptics_init(struct psmouse *psmouse) |
744 | { | 753 | { |
745 | return -ENOSYS; | 754 | return -ENOSYS; |
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index 871f6fe377f9..838e7f2c9b30 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
@@ -105,6 +105,7 @@ struct synaptics_data { | |||
105 | int scroll; | 105 | int scroll; |
106 | }; | 106 | }; |
107 | 107 | ||
108 | void synaptics_module_init(void); | ||
108 | int synaptics_detect(struct psmouse *psmouse, bool set_properties); | 109 | int synaptics_detect(struct psmouse *psmouse, bool set_properties); |
109 | int synaptics_init(struct psmouse *psmouse); | 110 | int synaptics_init(struct psmouse *psmouse); |
110 | void synaptics_reset(struct psmouse *psmouse); | 111 | void synaptics_reset(struct psmouse *psmouse); |
diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c index 7283c78044af..9867dfe2a638 100644 --- a/drivers/input/mouse/synaptics_i2c.c +++ b/drivers/input/mouse/synaptics_i2c.c | |||
@@ -420,8 +420,8 @@ static void synaptics_i2c_check_params(struct synaptics_i2c *touch) | |||
420 | } | 420 | } |
421 | 421 | ||
422 | /* Control the Device polling rate / Work Handler sleep time */ | 422 | /* Control the Device polling rate / Work Handler sleep time */ |
423 | unsigned long synaptics_i2c_adjust_delay(struct synaptics_i2c *touch, | 423 | static unsigned long synaptics_i2c_adjust_delay(struct synaptics_i2c *touch, |
424 | bool have_data) | 424 | bool have_data) |
425 | { | 425 | { |
426 | unsigned long delay, nodata_count_thres; | 426 | unsigned long delay, nodata_count_thres; |
427 | 427 | ||
@@ -520,7 +520,7 @@ static void synaptics_i2c_set_input_params(struct synaptics_i2c *touch) | |||
520 | __set_bit(BTN_LEFT, input->keybit); | 520 | __set_bit(BTN_LEFT, input->keybit); |
521 | } | 521 | } |
522 | 522 | ||
523 | struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *client) | 523 | static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *client) |
524 | { | 524 | { |
525 | struct synaptics_i2c *touch; | 525 | struct synaptics_i2c *touch; |
526 | 526 | ||
diff --git a/drivers/input/mouse/touchkit_ps2.c b/drivers/input/mouse/touchkit_ps2.c index 0308a0faa94d..909431c31ab4 100644 --- a/drivers/input/mouse/touchkit_ps2.c +++ b/drivers/input/mouse/touchkit_ps2.c | |||
@@ -86,7 +86,8 @@ int touchkit_ps2_detect(struct psmouse *psmouse, bool set_properties) | |||
86 | 86 | ||
87 | if (set_properties) { | 87 | if (set_properties) { |
88 | dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 88 | dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
89 | __set_bit(BTN_TOUCH, dev->keybit); | 89 | dev->keybit[BIT_WORD(BTN_MOUSE)] = 0; |
90 | dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | ||
90 | input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0); | 91 | input_set_abs_params(dev, ABS_X, 0, TOUCHKIT_MAX_XC, 0, 0); |
91 | input_set_abs_params(dev, ABS_Y, 0, TOUCHKIT_MAX_YC, 0, 0); | 92 | input_set_abs_params(dev, ABS_Y, 0, TOUCHKIT_MAX_YC, 0, 0); |
92 | 93 | ||
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index e354362f2971..63d4a67830f2 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -284,7 +284,6 @@ static int trackpoint_reconnect(struct psmouse *psmouse) | |||
284 | 284 | ||
285 | int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | 285 | int trackpoint_detect(struct psmouse *psmouse, bool set_properties) |
286 | { | 286 | { |
287 | struct trackpoint_data *priv; | ||
288 | struct ps2dev *ps2dev = &psmouse->ps2dev; | 287 | struct ps2dev *ps2dev = &psmouse->ps2dev; |
289 | unsigned char firmware_id; | 288 | unsigned char firmware_id; |
290 | unsigned char button_info; | 289 | unsigned char button_info; |
@@ -301,8 +300,8 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
301 | button_info = 0; | 300 | button_info = 0; |
302 | } | 301 | } |
303 | 302 | ||
304 | psmouse->private = priv = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL); | 303 | psmouse->private = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL); |
305 | if (!priv) | 304 | if (!psmouse->private) |
306 | return -1; | 305 | return -1; |
307 | 306 | ||
308 | psmouse->vendor = "IBM"; | 307 | psmouse->vendor = "IBM"; |
@@ -311,7 +310,10 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
311 | psmouse->reconnect = trackpoint_reconnect; | 310 | psmouse->reconnect = trackpoint_reconnect; |
312 | psmouse->disconnect = trackpoint_disconnect; | 311 | psmouse->disconnect = trackpoint_disconnect; |
313 | 312 | ||
314 | trackpoint_defaults(priv); | 313 | if ((button_info & 0x0f) >= 3) |
314 | __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | ||
315 | |||
316 | trackpoint_defaults(psmouse->private); | ||
315 | trackpoint_sync(psmouse); | 317 | trackpoint_sync(psmouse); |
316 | 318 | ||
317 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); | 319 | error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group); |
@@ -319,7 +321,8 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties) | |||
319 | printk(KERN_ERR | 321 | printk(KERN_ERR |
320 | "trackpoint.c: failed to create sysfs attributes, error: %d\n", | 322 | "trackpoint.c: failed to create sysfs attributes, error: %d\n", |
321 | error); | 323 | error); |
322 | kfree(priv); | 324 | kfree(psmouse->private); |
325 | psmouse->private = NULL; | ||
323 | return -1; | 326 | return -1; |
324 | } | 327 | } |
325 | 328 | ||
diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c index 70111443678e..bf2c0c80d6cc 100644 --- a/drivers/input/mouse/vsxxxaa.c +++ b/drivers/input/mouse/vsxxxaa.c | |||
@@ -86,27 +86,28 @@ | |||
86 | 86 | ||
87 | #define DRIVER_DESC "Driver for DEC VSXXX-AA and -GA mice and VSXXX-AB tablet" | 87 | #define DRIVER_DESC "Driver for DEC VSXXX-AA and -GA mice and VSXXX-AB tablet" |
88 | 88 | ||
89 | MODULE_AUTHOR ("Jan-Benedict Glaw <jbglaw@lug-owl.de>"); | 89 | MODULE_AUTHOR("Jan-Benedict Glaw <jbglaw@lug-owl.de>"); |
90 | MODULE_DESCRIPTION (DRIVER_DESC); | 90 | MODULE_DESCRIPTION(DRIVER_DESC); |
91 | MODULE_LICENSE ("GPL"); | 91 | MODULE_LICENSE("GPL"); |
92 | 92 | ||
93 | #undef VSXXXAA_DEBUG | 93 | #undef VSXXXAA_DEBUG |
94 | #ifdef VSXXXAA_DEBUG | 94 | #ifdef VSXXXAA_DEBUG |
95 | #define DBG(x...) printk (x) | 95 | #define DBG(x...) printk(x) |
96 | #else | 96 | #else |
97 | #define DBG(x...) do {} while (0) | 97 | #define DBG(x...) do {} while (0) |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | #define VSXXXAA_INTRO_MASK 0x80 | 100 | #define VSXXXAA_INTRO_MASK 0x80 |
101 | #define VSXXXAA_INTRO_HEAD 0x80 | 101 | #define VSXXXAA_INTRO_HEAD 0x80 |
102 | #define IS_HDR_BYTE(x) (((x) & VSXXXAA_INTRO_MASK) \ | 102 | #define IS_HDR_BYTE(x) \ |
103 | == VSXXXAA_INTRO_HEAD) | 103 | (((x) & VSXXXAA_INTRO_MASK) == VSXXXAA_INTRO_HEAD) |
104 | 104 | ||
105 | #define VSXXXAA_PACKET_MASK 0xe0 | 105 | #define VSXXXAA_PACKET_MASK 0xe0 |
106 | #define VSXXXAA_PACKET_REL 0x80 | 106 | #define VSXXXAA_PACKET_REL 0x80 |
107 | #define VSXXXAA_PACKET_ABS 0xc0 | 107 | #define VSXXXAA_PACKET_ABS 0xc0 |
108 | #define VSXXXAA_PACKET_POR 0xa0 | 108 | #define VSXXXAA_PACKET_POR 0xa0 |
109 | #define MATCH_PACKET_TYPE(data, type) (((data) & VSXXXAA_PACKET_MASK) == (type)) | 109 | #define MATCH_PACKET_TYPE(data, type) \ |
110 | (((data) & VSXXXAA_PACKET_MASK) == (type)) | ||
110 | 111 | ||
111 | 112 | ||
112 | 113 | ||
@@ -123,52 +124,50 @@ struct vsxxxaa { | |||
123 | char phys[32]; | 124 | char phys[32]; |
124 | }; | 125 | }; |
125 | 126 | ||
126 | static void | 127 | static void vsxxxaa_drop_bytes(struct vsxxxaa *mouse, int num) |
127 | vsxxxaa_drop_bytes (struct vsxxxaa *mouse, int num) | ||
128 | { | 128 | { |
129 | if (num >= mouse->count) | 129 | if (num >= mouse->count) { |
130 | mouse->count = 0; | 130 | mouse->count = 0; |
131 | else { | 131 | } else { |
132 | memmove (mouse->buf, mouse->buf + num - 1, BUFLEN - num); | 132 | memmove(mouse->buf, mouse->buf + num - 1, BUFLEN - num); |
133 | mouse->count -= num; | 133 | mouse->count -= num; |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | static void | 137 | static void vsxxxaa_queue_byte(struct vsxxxaa *mouse, unsigned char byte) |
138 | vsxxxaa_queue_byte (struct vsxxxaa *mouse, unsigned char byte) | ||
139 | { | 138 | { |
140 | if (mouse->count == BUFLEN) { | 139 | if (mouse->count == BUFLEN) { |
141 | printk (KERN_ERR "%s on %s: Dropping a byte of full buffer.\n", | 140 | printk(KERN_ERR "%s on %s: Dropping a byte of full buffer.\n", |
142 | mouse->name, mouse->phys); | 141 | mouse->name, mouse->phys); |
143 | vsxxxaa_drop_bytes (mouse, 1); | 142 | vsxxxaa_drop_bytes(mouse, 1); |
144 | } | 143 | } |
145 | DBG (KERN_INFO "Queueing byte 0x%02x\n", byte); | 144 | |
145 | DBG(KERN_INFO "Queueing byte 0x%02x\n", byte); | ||
146 | 146 | ||
147 | mouse->buf[mouse->count++] = byte; | 147 | mouse->buf[mouse->count++] = byte; |
148 | } | 148 | } |
149 | 149 | ||
150 | static void | 150 | static void vsxxxaa_detection_done(struct vsxxxaa *mouse) |
151 | vsxxxaa_detection_done (struct vsxxxaa *mouse) | ||
152 | { | 151 | { |
153 | switch (mouse->type) { | 152 | switch (mouse->type) { |
154 | case 0x02: | 153 | case 0x02: |
155 | strlcpy (mouse->name, "DEC VSXXX-AA/-GA mouse", | 154 | strlcpy(mouse->name, "DEC VSXXX-AA/-GA mouse", |
156 | sizeof (mouse->name)); | 155 | sizeof(mouse->name)); |
157 | break; | 156 | break; |
158 | 157 | ||
159 | case 0x04: | 158 | case 0x04: |
160 | strlcpy (mouse->name, "DEC VSXXX-AB digitizer", | 159 | strlcpy(mouse->name, "DEC VSXXX-AB digitizer", |
161 | sizeof (mouse->name)); | 160 | sizeof(mouse->name)); |
162 | break; | 161 | break; |
163 | 162 | ||
164 | default: | 163 | default: |
165 | snprintf (mouse->name, sizeof (mouse->name), | 164 | snprintf(mouse->name, sizeof(mouse->name), |
166 | "unknown DEC pointer device (type = 0x%02x)", | 165 | "unknown DEC pointer device (type = 0x%02x)", |
167 | mouse->type); | 166 | mouse->type); |
168 | break; | 167 | break; |
169 | } | 168 | } |
170 | 169 | ||
171 | printk (KERN_INFO | 170 | printk(KERN_INFO |
172 | "Found %s version 0x%02x from country 0x%02x on port %s\n", | 171 | "Found %s version 0x%02x from country 0x%02x on port %s\n", |
173 | mouse->name, mouse->version, mouse->country, mouse->phys); | 172 | mouse->name, mouse->version, mouse->country, mouse->phys); |
174 | } | 173 | } |
@@ -176,42 +175,38 @@ vsxxxaa_detection_done (struct vsxxxaa *mouse) | |||
176 | /* | 175 | /* |
177 | * Returns number of bytes to be dropped, 0 if packet is okay. | 176 | * Returns number of bytes to be dropped, 0 if packet is okay. |
178 | */ | 177 | */ |
179 | static int | 178 | static int vsxxxaa_check_packet(struct vsxxxaa *mouse, int packet_len) |
180 | vsxxxaa_check_packet (struct vsxxxaa *mouse, int packet_len) | ||
181 | { | 179 | { |
182 | int i; | 180 | int i; |
183 | 181 | ||
184 | /* First byte must be a header byte */ | 182 | /* First byte must be a header byte */ |
185 | if (!IS_HDR_BYTE (mouse->buf[0])) { | 183 | if (!IS_HDR_BYTE(mouse->buf[0])) { |
186 | DBG ("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]); | 184 | DBG("vsck: len=%d, 1st=0x%02x\n", packet_len, mouse->buf[0]); |
187 | return 1; | 185 | return 1; |
188 | } | 186 | } |
189 | 187 | ||
190 | /* Check all following bytes */ | 188 | /* Check all following bytes */ |
191 | if (packet_len > 1) { | 189 | for (i = 1; i < packet_len; i++) { |
192 | for (i = 1; i < packet_len; i++) { | 190 | if (IS_HDR_BYTE(mouse->buf[i])) { |
193 | if (IS_HDR_BYTE (mouse->buf[i])) { | 191 | printk(KERN_ERR |
194 | printk (KERN_ERR "Need to drop %d bytes " | 192 | "Need to drop %d bytes of a broken packet.\n", |
195 | "of a broken packet.\n", | 193 | i - 1); |
196 | i - 1); | 194 | DBG(KERN_INFO "check: len=%d, b[%d]=0x%02x\n", |
197 | DBG (KERN_INFO "check: len=%d, b[%d]=0x%02x\n", | 195 | packet_len, i, mouse->buf[i]); |
198 | packet_len, i, mouse->buf[i]); | 196 | return i - 1; |
199 | return i - 1; | ||
200 | } | ||
201 | } | 197 | } |
202 | } | 198 | } |
203 | 199 | ||
204 | return 0; | 200 | return 0; |
205 | } | 201 | } |
206 | 202 | ||
207 | static __inline__ int | 203 | static inline int vsxxxaa_smells_like_packet(struct vsxxxaa *mouse, |
208 | vsxxxaa_smells_like_packet (struct vsxxxaa *mouse, unsigned char type, size_t len) | 204 | unsigned char type, size_t len) |
209 | { | 205 | { |
210 | return (mouse->count >= len) && MATCH_PACKET_TYPE (mouse->buf[0], type); | 206 | return mouse->count >= len && MATCH_PACKET_TYPE(mouse->buf[0], type); |
211 | } | 207 | } |
212 | 208 | ||
213 | static void | 209 | static void vsxxxaa_handle_REL_packet(struct vsxxxaa *mouse) |
214 | vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse) | ||
215 | { | 210 | { |
216 | struct input_dev *dev = mouse->dev; | 211 | struct input_dev *dev = mouse->dev; |
217 | unsigned char *buf = mouse->buf; | 212 | unsigned char *buf = mouse->buf; |
@@ -232,43 +227,42 @@ vsxxxaa_handle_REL_packet (struct vsxxxaa *mouse) | |||
232 | * 0, bit 4 of byte 0 is direction. | 227 | * 0, bit 4 of byte 0 is direction. |
233 | */ | 228 | */ |
234 | dx = buf[1] & 0x7f; | 229 | dx = buf[1] & 0x7f; |
235 | dx *= ((buf[0] >> 4) & 0x01)? 1: -1; | 230 | dx *= ((buf[0] >> 4) & 0x01) ? 1 : -1; |
236 | 231 | ||
237 | /* | 232 | /* |
238 | * Low 7 bit of byte 2 are abs(dy), bit 7 is | 233 | * Low 7 bit of byte 2 are abs(dy), bit 7 is |
239 | * 0, bit 3 of byte 0 is direction. | 234 | * 0, bit 3 of byte 0 is direction. |
240 | */ | 235 | */ |
241 | dy = buf[2] & 0x7f; | 236 | dy = buf[2] & 0x7f; |
242 | dy *= ((buf[0] >> 3) & 0x01)? -1: 1; | 237 | dy *= ((buf[0] >> 3) & 0x01) ? -1 : 1; |
243 | 238 | ||
244 | /* | 239 | /* |
245 | * Get button state. It's the low three bits | 240 | * Get button state. It's the low three bits |
246 | * (for three buttons) of byte 0. | 241 | * (for three buttons) of byte 0. |
247 | */ | 242 | */ |
248 | left = (buf[0] & 0x04)? 1: 0; | 243 | left = buf[0] & 0x04; |
249 | middle = (buf[0] & 0x02)? 1: 0; | 244 | middle = buf[0] & 0x02; |
250 | right = (buf[0] & 0x01)? 1: 0; | 245 | right = buf[0] & 0x01; |
251 | 246 | ||
252 | vsxxxaa_drop_bytes (mouse, 3); | 247 | vsxxxaa_drop_bytes(mouse, 3); |
253 | 248 | ||
254 | DBG (KERN_INFO "%s on %s: dx=%d, dy=%d, buttons=%s%s%s\n", | 249 | DBG(KERN_INFO "%s on %s: dx=%d, dy=%d, buttons=%s%s%s\n", |
255 | mouse->name, mouse->phys, dx, dy, | 250 | mouse->name, mouse->phys, dx, dy, |
256 | left? "L": "l", middle? "M": "m", right? "R": "r"); | 251 | left ? "L" : "l", middle ? "M" : "m", right ? "R" : "r"); |
257 | 252 | ||
258 | /* | 253 | /* |
259 | * Report what we've found so far... | 254 | * Report what we've found so far... |
260 | */ | 255 | */ |
261 | input_report_key (dev, BTN_LEFT, left); | 256 | input_report_key(dev, BTN_LEFT, left); |
262 | input_report_key (dev, BTN_MIDDLE, middle); | 257 | input_report_key(dev, BTN_MIDDLE, middle); |
263 | input_report_key (dev, BTN_RIGHT, right); | 258 | input_report_key(dev, BTN_RIGHT, right); |
264 | input_report_key (dev, BTN_TOUCH, 0); | 259 | input_report_key(dev, BTN_TOUCH, 0); |
265 | input_report_rel (dev, REL_X, dx); | 260 | input_report_rel(dev, REL_X, dx); |
266 | input_report_rel (dev, REL_Y, dy); | 261 | input_report_rel(dev, REL_Y, dy); |
267 | input_sync (dev); | 262 | input_sync(dev); |
268 | } | 263 | } |
269 | 264 | ||
270 | static void | 265 | static void vsxxxaa_handle_ABS_packet(struct vsxxxaa *mouse) |
271 | vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse) | ||
272 | { | 266 | { |
273 | struct input_dev *dev = mouse->dev; | 267 | struct input_dev *dev = mouse->dev; |
274 | unsigned char *buf = mouse->buf; | 268 | unsigned char *buf = mouse->buf; |
@@ -296,32 +290,31 @@ vsxxxaa_handle_ABS_packet (struct vsxxxaa *mouse) | |||
296 | /* | 290 | /* |
297 | * Get button state. It's bits <4..1> of byte 0. | 291 | * Get button state. It's bits <4..1> of byte 0. |
298 | */ | 292 | */ |
299 | left = (buf[0] & 0x02)? 1: 0; | 293 | left = buf[0] & 0x02; |
300 | middle = (buf[0] & 0x04)? 1: 0; | 294 | middle = buf[0] & 0x04; |
301 | right = (buf[0] & 0x08)? 1: 0; | 295 | right = buf[0] & 0x08; |
302 | touch = (buf[0] & 0x10)? 1: 0; | 296 | touch = buf[0] & 0x10; |
303 | 297 | ||
304 | vsxxxaa_drop_bytes (mouse, 5); | 298 | vsxxxaa_drop_bytes(mouse, 5); |
305 | 299 | ||
306 | DBG (KERN_INFO "%s on %s: x=%d, y=%d, buttons=%s%s%s%s\n", | 300 | DBG(KERN_INFO "%s on %s: x=%d, y=%d, buttons=%s%s%s%s\n", |
307 | mouse->name, mouse->phys, x, y, | 301 | mouse->name, mouse->phys, x, y, |
308 | left? "L": "l", middle? "M": "m", | 302 | left ? "L" : "l", middle ? "M" : "m", |
309 | right? "R": "r", touch? "T": "t"); | 303 | right ? "R" : "r", touch ? "T" : "t"); |
310 | 304 | ||
311 | /* | 305 | /* |
312 | * Report what we've found so far... | 306 | * Report what we've found so far... |
313 | */ | 307 | */ |
314 | input_report_key (dev, BTN_LEFT, left); | 308 | input_report_key(dev, BTN_LEFT, left); |
315 | input_report_key (dev, BTN_MIDDLE, middle); | 309 | input_report_key(dev, BTN_MIDDLE, middle); |
316 | input_report_key (dev, BTN_RIGHT, right); | 310 | input_report_key(dev, BTN_RIGHT, right); |
317 | input_report_key (dev, BTN_TOUCH, touch); | 311 | input_report_key(dev, BTN_TOUCH, touch); |
318 | input_report_abs (dev, ABS_X, x); | 312 | input_report_abs(dev, ABS_X, x); |
319 | input_report_abs (dev, ABS_Y, y); | 313 | input_report_abs(dev, ABS_Y, y); |
320 | input_sync (dev); | 314 | input_sync(dev); |
321 | } | 315 | } |
322 | 316 | ||
323 | static void | 317 | static void vsxxxaa_handle_POR_packet(struct vsxxxaa *mouse) |
324 | vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse) | ||
325 | { | 318 | { |
326 | struct input_dev *dev = mouse->dev; | 319 | struct input_dev *dev = mouse->dev; |
327 | unsigned char *buf = mouse->buf; | 320 | unsigned char *buf = mouse->buf; |
@@ -356,24 +349,24 @@ vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse) | |||
356 | * (for three buttons) of byte 0. Maybe even the bit <3> | 349 | * (for three buttons) of byte 0. Maybe even the bit <3> |
357 | * has some meaning if a tablet is attached. | 350 | * has some meaning if a tablet is attached. |
358 | */ | 351 | */ |
359 | left = (buf[0] & 0x04)? 1: 0; | 352 | left = buf[0] & 0x04; |
360 | middle = (buf[0] & 0x02)? 1: 0; | 353 | middle = buf[0] & 0x02; |
361 | right = (buf[0] & 0x01)? 1: 0; | 354 | right = buf[0] & 0x01; |
362 | 355 | ||
363 | vsxxxaa_drop_bytes (mouse, 4); | 356 | vsxxxaa_drop_bytes(mouse, 4); |
364 | vsxxxaa_detection_done (mouse); | 357 | vsxxxaa_detection_done(mouse); |
365 | 358 | ||
366 | if (error <= 0x1f) { | 359 | if (error <= 0x1f) { |
367 | /* No (serious) error. Report buttons */ | 360 | /* No (serious) error. Report buttons */ |
368 | input_report_key (dev, BTN_LEFT, left); | 361 | input_report_key(dev, BTN_LEFT, left); |
369 | input_report_key (dev, BTN_MIDDLE, middle); | 362 | input_report_key(dev, BTN_MIDDLE, middle); |
370 | input_report_key (dev, BTN_RIGHT, right); | 363 | input_report_key(dev, BTN_RIGHT, right); |
371 | input_report_key (dev, BTN_TOUCH, 0); | 364 | input_report_key(dev, BTN_TOUCH, 0); |
372 | input_sync (dev); | 365 | input_sync(dev); |
373 | 366 | ||
374 | if (error != 0) | 367 | if (error != 0) |
375 | printk (KERN_INFO "Your %s on %s reports error=0x%02x\n", | 368 | printk(KERN_INFO "Your %s on %s reports error=0x%02x\n", |
376 | mouse->name, mouse->phys, error); | 369 | mouse->name, mouse->phys, error); |
377 | 370 | ||
378 | } | 371 | } |
379 | 372 | ||
@@ -381,18 +374,18 @@ vsxxxaa_handle_POR_packet (struct vsxxxaa *mouse) | |||
381 | * If the mouse was hot-plugged, we need to force differential mode | 374 | * If the mouse was hot-plugged, we need to force differential mode |
382 | * now... However, give it a second to recover from it's reset. | 375 | * now... However, give it a second to recover from it's reset. |
383 | */ | 376 | */ |
384 | printk (KERN_NOTICE "%s on %s: Forceing standard packet format, " | 377 | printk(KERN_NOTICE |
385 | "incremental streaming mode and 72 samples/sec\n", | 378 | "%s on %s: Forcing standard packet format, " |
386 | mouse->name, mouse->phys); | 379 | "incremental streaming mode and 72 samples/sec\n", |
387 | serio_write (mouse->serio, 'S'); /* Standard format */ | 380 | mouse->name, mouse->phys); |
388 | mdelay (50); | 381 | serio_write(mouse->serio, 'S'); /* Standard format */ |
389 | serio_write (mouse->serio, 'R'); /* Incremental */ | 382 | mdelay(50); |
390 | mdelay (50); | 383 | serio_write(mouse->serio, 'R'); /* Incremental */ |
391 | serio_write (mouse->serio, 'L'); /* 72 samples/sec */ | 384 | mdelay(50); |
385 | serio_write(mouse->serio, 'L'); /* 72 samples/sec */ | ||
392 | } | 386 | } |
393 | 387 | ||
394 | static void | 388 | static void vsxxxaa_parse_buffer(struct vsxxxaa *mouse) |
395 | vsxxxaa_parse_buffer (struct vsxxxaa *mouse) | ||
396 | { | 389 | { |
397 | unsigned char *buf = mouse->buf; | 390 | unsigned char *buf = mouse->buf; |
398 | int stray_bytes; | 391 | int stray_bytes; |
@@ -409,122 +402,107 @@ vsxxxaa_parse_buffer (struct vsxxxaa *mouse) | |||
409 | * activity on the mouse. | 402 | * activity on the mouse. |
410 | */ | 403 | */ |
411 | while (mouse->count > 0 && !IS_HDR_BYTE(buf[0])) { | 404 | while (mouse->count > 0 && !IS_HDR_BYTE(buf[0])) { |
412 | printk (KERN_ERR "%s on %s: Dropping a byte to regain " | 405 | printk(KERN_ERR "%s on %s: Dropping a byte to regain " |
413 | "sync with mouse data stream...\n", | 406 | "sync with mouse data stream...\n", |
414 | mouse->name, mouse->phys); | 407 | mouse->name, mouse->phys); |
415 | vsxxxaa_drop_bytes (mouse, 1); | 408 | vsxxxaa_drop_bytes(mouse, 1); |
416 | } | 409 | } |
417 | 410 | ||
418 | /* | 411 | /* |
419 | * Check for packets we know about. | 412 | * Check for packets we know about. |
420 | */ | 413 | */ |
421 | 414 | ||
422 | if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_REL, 3)) { | 415 | if (vsxxxaa_smells_like_packet(mouse, VSXXXAA_PACKET_REL, 3)) { |
423 | /* Check for broken packet */ | 416 | /* Check for broken packet */ |
424 | stray_bytes = vsxxxaa_check_packet (mouse, 3); | 417 | stray_bytes = vsxxxaa_check_packet(mouse, 3); |
425 | if (stray_bytes > 0) { | 418 | if (!stray_bytes) |
426 | printk (KERN_ERR "Dropping %d bytes now...\n", | 419 | vsxxxaa_handle_REL_packet(mouse); |
427 | stray_bytes); | ||
428 | vsxxxaa_drop_bytes (mouse, stray_bytes); | ||
429 | continue; | ||
430 | } | ||
431 | |||
432 | vsxxxaa_handle_REL_packet (mouse); | ||
433 | continue; /* More to parse? */ | ||
434 | } | ||
435 | 420 | ||
436 | if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_ABS, 5)) { | 421 | } else if (vsxxxaa_smells_like_packet(mouse, |
422 | VSXXXAA_PACKET_ABS, 5)) { | ||
437 | /* Check for broken packet */ | 423 | /* Check for broken packet */ |
438 | stray_bytes = vsxxxaa_check_packet (mouse, 5); | 424 | stray_bytes = vsxxxaa_check_packet(mouse, 5); |
439 | if (stray_bytes > 0) { | 425 | if (!stray_bytes) |
440 | printk (KERN_ERR "Dropping %d bytes now...\n", | 426 | vsxxxaa_handle_ABS_packet(mouse); |
441 | stray_bytes); | ||
442 | vsxxxaa_drop_bytes (mouse, stray_bytes); | ||
443 | continue; | ||
444 | } | ||
445 | |||
446 | vsxxxaa_handle_ABS_packet (mouse); | ||
447 | continue; /* More to parse? */ | ||
448 | } | ||
449 | 427 | ||
450 | if (vsxxxaa_smells_like_packet (mouse, VSXXXAA_PACKET_POR, 4)) { | 428 | } else if (vsxxxaa_smells_like_packet(mouse, |
429 | VSXXXAA_PACKET_POR, 4)) { | ||
451 | /* Check for broken packet */ | 430 | /* Check for broken packet */ |
452 | stray_bytes = vsxxxaa_check_packet (mouse, 4); | 431 | stray_bytes = vsxxxaa_check_packet(mouse, 4); |
453 | if (stray_bytes > 0) { | 432 | if (!stray_bytes) |
454 | printk (KERN_ERR "Dropping %d bytes now...\n", | 433 | vsxxxaa_handle_POR_packet(mouse); |
455 | stray_bytes); | 434 | |
456 | vsxxxaa_drop_bytes (mouse, stray_bytes); | 435 | } else { |
457 | continue; | 436 | break; /* No REL, ABS or POR packet found */ |
458 | } | 437 | } |
459 | 438 | ||
460 | vsxxxaa_handle_POR_packet (mouse); | 439 | if (stray_bytes > 0) { |
461 | continue; /* More to parse? */ | 440 | printk(KERN_ERR "Dropping %d bytes now...\n", |
441 | stray_bytes); | ||
442 | vsxxxaa_drop_bytes(mouse, stray_bytes); | ||
462 | } | 443 | } |
463 | 444 | ||
464 | break; /* No REL, ABS or POR packet found */ | ||
465 | } while (1); | 445 | } while (1); |
466 | } | 446 | } |
467 | 447 | ||
468 | static irqreturn_t | 448 | static irqreturn_t vsxxxaa_interrupt(struct serio *serio, |
469 | vsxxxaa_interrupt (struct serio *serio, unsigned char data, unsigned int flags) | 449 | unsigned char data, unsigned int flags) |
470 | { | 450 | { |
471 | struct vsxxxaa *mouse = serio_get_drvdata (serio); | 451 | struct vsxxxaa *mouse = serio_get_drvdata(serio); |
472 | 452 | ||
473 | vsxxxaa_queue_byte (mouse, data); | 453 | vsxxxaa_queue_byte(mouse, data); |
474 | vsxxxaa_parse_buffer (mouse); | 454 | vsxxxaa_parse_buffer(mouse); |
475 | 455 | ||
476 | return IRQ_HANDLED; | 456 | return IRQ_HANDLED; |
477 | } | 457 | } |
478 | 458 | ||
479 | static void | 459 | static void vsxxxaa_disconnect(struct serio *serio) |
480 | vsxxxaa_disconnect (struct serio *serio) | ||
481 | { | 460 | { |
482 | struct vsxxxaa *mouse = serio_get_drvdata (serio); | 461 | struct vsxxxaa *mouse = serio_get_drvdata(serio); |
483 | 462 | ||
484 | serio_close (serio); | 463 | serio_close(serio); |
485 | serio_set_drvdata (serio, NULL); | 464 | serio_set_drvdata(serio, NULL); |
486 | input_unregister_device (mouse->dev); | 465 | input_unregister_device(mouse->dev); |
487 | kfree (mouse); | 466 | kfree(mouse); |
488 | } | 467 | } |
489 | 468 | ||
490 | static int | 469 | static int vsxxxaa_connect(struct serio *serio, struct serio_driver *drv) |
491 | vsxxxaa_connect (struct serio *serio, struct serio_driver *drv) | ||
492 | { | 470 | { |
493 | struct vsxxxaa *mouse; | 471 | struct vsxxxaa *mouse; |
494 | struct input_dev *input_dev; | 472 | struct input_dev *input_dev; |
495 | int err = -ENOMEM; | 473 | int err = -ENOMEM; |
496 | 474 | ||
497 | mouse = kzalloc (sizeof (struct vsxxxaa), GFP_KERNEL); | 475 | mouse = kzalloc(sizeof(struct vsxxxaa), GFP_KERNEL); |
498 | input_dev = input_allocate_device (); | 476 | input_dev = input_allocate_device(); |
499 | if (!mouse || !input_dev) | 477 | if (!mouse || !input_dev) |
500 | goto fail1; | 478 | goto fail1; |
501 | 479 | ||
502 | mouse->dev = input_dev; | 480 | mouse->dev = input_dev; |
503 | mouse->serio = serio; | 481 | mouse->serio = serio; |
504 | strlcat (mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer", | 482 | strlcat(mouse->name, "DEC VSXXX-AA/-GA mouse or VSXXX-AB digitizer", |
505 | sizeof (mouse->name)); | 483 | sizeof(mouse->name)); |
506 | snprintf (mouse->phys, sizeof (mouse->phys), "%s/input0", serio->phys); | 484 | snprintf(mouse->phys, sizeof(mouse->phys), "%s/input0", serio->phys); |
507 | 485 | ||
508 | input_dev->name = mouse->name; | 486 | input_dev->name = mouse->name; |
509 | input_dev->phys = mouse->phys; | 487 | input_dev->phys = mouse->phys; |
510 | input_dev->id.bustype = BUS_RS232; | 488 | input_dev->id.bustype = BUS_RS232; |
511 | input_dev->dev.parent = &serio->dev; | 489 | input_dev->dev.parent = &serio->dev; |
512 | 490 | ||
513 | set_bit (EV_KEY, input_dev->evbit); /* We have buttons */ | 491 | __set_bit(EV_KEY, input_dev->evbit); /* We have buttons */ |
514 | set_bit (EV_REL, input_dev->evbit); | 492 | __set_bit(EV_REL, input_dev->evbit); |
515 | set_bit (EV_ABS, input_dev->evbit); | 493 | __set_bit(EV_ABS, input_dev->evbit); |
516 | set_bit (BTN_LEFT, input_dev->keybit); /* We have 3 buttons */ | 494 | __set_bit(BTN_LEFT, input_dev->keybit); /* We have 3 buttons */ |
517 | set_bit (BTN_MIDDLE, input_dev->keybit); | 495 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
518 | set_bit (BTN_RIGHT, input_dev->keybit); | 496 | __set_bit(BTN_RIGHT, input_dev->keybit); |
519 | set_bit (BTN_TOUCH, input_dev->keybit); /* ...and Tablet */ | 497 | __set_bit(BTN_TOUCH, input_dev->keybit); /* ...and Tablet */ |
520 | set_bit (REL_X, input_dev->relbit); | 498 | __set_bit(REL_X, input_dev->relbit); |
521 | set_bit (REL_Y, input_dev->relbit); | 499 | __set_bit(REL_Y, input_dev->relbit); |
522 | input_set_abs_params (input_dev, ABS_X, 0, 1023, 0, 0); | 500 | input_set_abs_params(input_dev, ABS_X, 0, 1023, 0, 0); |
523 | input_set_abs_params (input_dev, ABS_Y, 0, 1023, 0, 0); | 501 | input_set_abs_params(input_dev, ABS_Y, 0, 1023, 0, 0); |
524 | 502 | ||
525 | serio_set_drvdata (serio, mouse); | 503 | serio_set_drvdata(serio, mouse); |
526 | 504 | ||
527 | err = serio_open (serio, drv); | 505 | err = serio_open(serio, drv); |
528 | if (err) | 506 | if (err) |
529 | goto fail2; | 507 | goto fail2; |
530 | 508 | ||
@@ -532,18 +510,18 @@ vsxxxaa_connect (struct serio *serio, struct serio_driver *drv) | |||
532 | * Request selftest. Standard packet format and differential | 510 | * Request selftest. Standard packet format and differential |
533 | * mode will be requested after the device ID'ed successfully. | 511 | * mode will be requested after the device ID'ed successfully. |
534 | */ | 512 | */ |
535 | serio_write (serio, 'T'); /* Test */ | 513 | serio_write(serio, 'T'); /* Test */ |
536 | 514 | ||
537 | err = input_register_device (input_dev); | 515 | err = input_register_device(input_dev); |
538 | if (err) | 516 | if (err) |
539 | goto fail3; | 517 | goto fail3; |
540 | 518 | ||
541 | return 0; | 519 | return 0; |
542 | 520 | ||
543 | fail3: serio_close (serio); | 521 | fail3: serio_close(serio); |
544 | fail2: serio_set_drvdata (serio, NULL); | 522 | fail2: serio_set_drvdata(serio, NULL); |
545 | fail1: input_free_device (input_dev); | 523 | fail1: input_free_device(input_dev); |
546 | kfree (mouse); | 524 | kfree(mouse); |
547 | return err; | 525 | return err; |
548 | } | 526 | } |
549 | 527 | ||
@@ -570,18 +548,16 @@ static struct serio_driver vsxxxaa_drv = { | |||
570 | .disconnect = vsxxxaa_disconnect, | 548 | .disconnect = vsxxxaa_disconnect, |
571 | }; | 549 | }; |
572 | 550 | ||
573 | static int __init | 551 | static int __init vsxxxaa_init(void) |
574 | vsxxxaa_init (void) | ||
575 | { | 552 | { |
576 | return serio_register_driver(&vsxxxaa_drv); | 553 | return serio_register_driver(&vsxxxaa_drv); |
577 | } | 554 | } |
578 | 555 | ||
579 | static void __exit | 556 | static void __exit vsxxxaa_exit(void) |
580 | vsxxxaa_exit (void) | ||
581 | { | 557 | { |
582 | serio_unregister_driver(&vsxxxaa_drv); | 558 | serio_unregister_driver(&vsxxxaa_drv); |
583 | } | 559 | } |
584 | 560 | ||
585 | module_init (vsxxxaa_init); | 561 | module_init(vsxxxaa_init); |
586 | module_exit (vsxxxaa_exit); | 562 | module_exit(vsxxxaa_exit); |
587 | 563 | ||