Serial mouse `driver'

bill@taniwha.org
Sat, 11 Sep 1999 15:01:15 +1200


First off, I'm a linux kernel newby, but I've done timing and driver
stuff in other environments (DJGPP ie dos (totally different univers:))

I am working on a kernel driver for serial mice that will hopefully be
able to auto-resync with the mouse when bytes are lost (happens to me
occasionally, especially in q3test). My plan is to write the driver
such that it collects the packets from the serial port, checking that
they come in groups sized consistently with the protocol (ie 5 bytes for
mouse systems). I want to do this by discarding partial packets if the
next byte doesn't arrive within one or two byte timeslots (dependent on
the line speed as not all mice operate at 1200 bps). The collected
packets will then be passed to userland unmollested (ie minimal changes
to gpm, X, etc). This means that my mouse driver will be as simple as
possible: no cursor, no cut&paste, etc, just packet
validation/syncronization.

Here are my questions:
o Is using a tty line discipline the right way to do this?
My current efforts are based on assuming so.

o What timers are available to me? async (interrupts) is
preferable (O(1ms) is tight enough). If async is unavailable,
how do I get hold of the time in something usable. 10ms is too
course, I think.

o How do I write the ldics poll function? I'm totally clueless
when it coems to the semantics of this.

0 What is the best way of using the tty_struct? Being able to
support multiple mice would probably be a good thing.

o What's the `file' parameter to the ldisc functions used for?

o What do I do about ioctl numbers? Or is there another interface
I should use to control things like the type of mouse attached
(I will *not* be using auto-detect as I was never able to ficure
out how to detect a mouse systems mouse)?

The code I've got at the moment isn't worth posting at the moment. It's
just a fleshed out tty_ldisc structure and some stub functions (some
semi coded), but if asked, I'll post it.

Bill

-- 
Leave others their otherness.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/