Re: uniform input device packets?

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Thu, 25 Jun 1998 13:01:38 +0100


> > > Timestamping isn't silly, as I explain in another reply to you.
> > > It's actually very much needed.
> > Indeed. However, I think a simple jiffy-count will do nicely.
>
> However, jiffy count isn't directly real time related, because not
> all machines use the same timer interrupt speed. (PCs - 100 Hz,
> Alphas - 1024 Hz). It'd be better to define it's either in miliseconds,
> or microseconds. However, on machines without better timers, the
> number could be purely based on jiffy count, only multiplied with a
> constant.

For drawing curves with a high resolution tablet, 100Hz timestamps
aren't fast enough. I suggest microseconds because it is compatible
with gettimeofday().

> * for axis events everything will stay as is
> * for buttons we define three new event types press, release, and repeat
> * for buttons we put the number into new_state field instead of number field

The application will want to know the current state of buttons when it
opens the device. After that it can track changes it finds interesting.
One way is to use another event type, only sent when the device is opened
or an ioctl() called:

* button X has state Y.

This is distinguished from a press event because it doesn't imply the
button was just pressed. Absolute axes need to be sent too for
initialisation, but the existing event will do for that.

> I think the event size should ALWAYS be the constant. And I think that on
> each read we can return as many events as we want, but it should be a whole
> number of events.

That will solve protocol synchronisation.
And the ioctl() I mentioned will solve getting from an unknown state.

To account for the future, perhaps an ioctl() to get/set protocol
version & packet size?

There is also the issue of typeahead. If someone has a second keyboard
used by a particular app, they start the app and type some things on the
keyboard before the app is up and running. It would be nice if the
events were stored ready for the app before it opens the device, just
like the primary console keyboard. The app has an option to flush of
course (another ioctl(), or repeated reads).

-- Jamie

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