aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/alps.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2006-01-14 00:27:37 -0500
committerDmitry Torokhov <dtor_core@ameritech.net>2006-01-14 00:27:37 -0500
commitf0d5c6f419d3a10443f66d6835855837eae4ac4b (patch)
treeedbaf897d4618095a69865f198d26d2d017813d4 /drivers/input/mouse/alps.c
parentb65d0d1bacfdbb4a134a7ebd16f280d5d42241cb (diff)
Input: psmouse - attempt to re-synchronize mouse every 5 seconds
This should help driver to deal vith KVMs that reset mice when switching between boxes. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/alps.c')
-rw-r--r--drivers/input/mouse/alps.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 24474335dfd1..2141501e9f2e 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -348,6 +348,40 @@ static int alps_tap_mode(struct psmouse *psmouse, int enable)
348 return 0; 348 return 0;
349} 349}
350 350
351/*
352 * alps_poll() - poll the touchpad for current motion packet.
353 * Used in resync.
354 */
355static int alps_poll(struct psmouse *psmouse)
356{
357 struct alps_data *priv = psmouse->private;
358 unsigned char buf[6];
359 int poll_failed;
360
361 if (priv->i->flags & ALPS_PASS)
362 alps_passthrough_mode(psmouse, 1);
363
364 poll_failed = ps2_command(&psmouse->ps2dev, buf,
365 PSMOUSE_CMD_POLL | (psmouse->pktsize << 8)) < 0;
366
367 if (priv->i->flags & ALPS_PASS)
368 alps_passthrough_mode(psmouse, 0);
369
370 if (poll_failed || (buf[0] & priv->i->mask0) != priv->i->byte0)
371 return -1;
372
373 if ((psmouse->badbyte & 0xc8) == 0x08) {
374/*
375 * Poll the track stick ...
376 */
377 if (ps2_command(&psmouse->ps2dev, buf, PSMOUSE_CMD_POLL | (3 << 8)))
378 return -1;
379 }
380
381 memcpy(psmouse->packet, buf, sizeof(buf));
382 return 0;
383}
384
351static int alps_reconnect(struct psmouse *psmouse) 385static int alps_reconnect(struct psmouse *psmouse)
352{ 386{
353 struct alps_data *priv = psmouse->private; 387 struct alps_data *priv = psmouse->private;
@@ -451,10 +485,14 @@ int alps_init(struct psmouse *psmouse)
451 input_register_device(priv->dev2); 485 input_register_device(priv->dev2);
452 486
453 psmouse->protocol_handler = alps_process_byte; 487 psmouse->protocol_handler = alps_process_byte;
488 psmouse->poll = alps_poll;
454 psmouse->disconnect = alps_disconnect; 489 psmouse->disconnect = alps_disconnect;
455 psmouse->reconnect = alps_reconnect; 490 psmouse->reconnect = alps_reconnect;
456 psmouse->pktsize = 6; 491 psmouse->pktsize = 6;
457 492
493 /* We are having trouble resyncing ALPS touchpads so disable it for now */
494 psmouse->resync_time = 0;
495
458 return 0; 496 return 0;
459 497
460init_fail: 498init_fail: