Re: [RFC/RFT] PS/2 mouse resync for KVM users

From: Vojtech Pavlik
Date: Wed Jun 23 2004 - 02:41:53 EST


Hi!

I really like this approach, and it's something I wanted to implement,
but never found the time to do it.

Another heuristic I planned to implement would be interbyte timing - not
just timeouts, but qualify the validity of a packet both on how close
its bytes arrived together and whether it's separated from other
packets by some time. We could even keep an estimate on both the
interbyte and interpacket timing and classify each byte as based on the
probability of a packet boundary. It might be a little overkill, though.




> + if (psmouse->pktcnt == 1) {
> +/*
> + * If go by the letter of PS/2 protcol 4th bit in 1st byte should always be set.
> + */
> + if (psmouse_strict && !(packet[0] & 0x08))
> + return PSMOUSE_BAD_DATA;

This bit actually says 'internal/external', and can be used to
differentiate between data from an internal trackpoint and an external
mouse on older notebooks.

All newer devices have it at '1'.

> +/*
> + * Overflows should happen rarely.
> + */
> + if (packet[0] & 0xc0)
> + return PSMOUSE_SUSPECT_DATA;

Very rarely indeed. It should be next to impossible to generate an
overflow at a reasonable report rate (> 80 reports/sec). For higher
resolutions (> 400 dpi) it might be reasonable to up the report rate
accordingly.

> +/*
> + * Having left or right button together with middle is somewhat unusual.
> + */
> + if ((packet[0] & 0x07) > 4)
> + return PSMOUSE_SUSPECT_DATA;
> + }
> +
> if (psmouse->pktcnt < 3 + (psmouse->type >= PSMOUSE_GENPS))
> return PSMOUSE_GOOD_DATA;

--
Vojtech Pavlik
SuSE Labs, SuSE CR
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/