Re: uniform input device packets?

Albert D. Cahalan (acahalan@cs.uml.edu)
Sat, 27 Jun 1998 06:35:11 -0400 (EDT)


David Lang writes:

> but what about multiple events? (move the mouse diagnally while
> clicking a button) 3 2/4 byte reads+mangle could be combined
> to 1 cache read while 3 16 byte reads would be 3 cache reads.

You are dealing with devices that typically transmit at 1200 bps.
There is a human (slow carbon-based lifeform) operating them.
Overclocking the human won't help much, and may be illegal.

Here is what X seems to use:

int type;
unsigned long milliseconds; /* use the same thing in the kernel */
int x,y;
unsigned int button; /* or keycode for the keyboard */

That is 20 or 24 bytes. No big deal. Xlib puts it in a union
with 24 longs, so the size is 96 to 192 bytes long.

64 bytes is good for reasonable future expansion.

Oh, use the milliseconds. There must be some math to convert
from jiffies or CPU cycles to the milliseconds that X uses.
The kernel must do that, because the kernel knows the clock
speed in use. If you transmit nanoseconds, that just adds
more conversion overhead.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu