Mouse Input Time Quantization

Hello,

For a project I require accurate millisecond timestamps on mouse click data or keyboard press data on Windows 2000/XP. These are part of the problem statement.

Currently, I timestamp MOUSE_INPUT_DATA packets with a modified moufiltr driver. These timestamps come from KeQueryPerformanceCounter, and more recently the RDTSC x86 instruction. Also, I have used USB and PS/2 mice, the following results are the same, regardless of the timer or port.

Testing occurs by hooking up a pulse train generator to close the SPDT switch of a mouse via a relay at a known time interval.

When I range this interval from 35 to 25 milliseconds, I receive severely quantized data. The 31 millisecond interval will register consistently, and so will the 25 millisecond interval. In the middle, however, interval results are either those of the 25 millisecond interval or the 31 millisecond interval, never an intermediate value.

I am out of ideas as to why this is happening or as to how to approach the problem.

Any input is very much appreciated.
Thanks,

A. Frolenkov.

xxxxx@hotmail.com wrote:

Hello,

For a project I require accurate millisecond timestamps on mouse click data or keyboard press data on Windows 2000/XP. These are part of the problem statement.

Currently, I timestamp MOUSE_INPUT_DATA packets with a modified moufiltr driver. These timestamps come from KeQueryPerformanceCounter, and more recently the RDTSC x86 instruction. Also, I have used USB and PS/2 mice, the following results are the same, regardless of the timer or port.

Testing occurs by hooking up a pulse train generator to close the SPDT switch of a mouse via a relay at a known time interval.

When I range this interval from 35 to 25 milliseconds, I receive severely quantized data. The 31 millisecond interval will register consistently, and so will the 25 millisecond interval. In the middle, however, interval results are either those of the 25 millisecond interval or the 31 millisecond interval, never an intermediate value.

I am out of ideas as to why this is happening or as to how to approach the problem.

USB keyboards and mice use “interrupt” pipes on USB, which are
periodically polled with a relatively long interval. My Microsoft
Comfort Curve 2000 keyboard and my Microsoft Wireless Laser Mouse 6000
both have an interval of 10, which means 512 microframes or 64
milliseconds. Thus, you can never get events more often than once every
64 milliseconds.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

xxxxx@hotmail.com wrote:

For a project I require accurate millisecond timestamps on mouse click
data or keyboard press data on Windows 2000/XP. […]

The only way to measure the time very exactly and in guaranteed
intervals - unaffected by internal Windows process timings - is to
offload polling and timestamping to an external device.

If you need control over the internal accuracy of the device as well,
you will probably have to build your own mouse and keyboard (if a device
can be polled 1000 times a second from a to PC this does not guarantee
that it internally samples its hardware that often).

Please note that the polling interval can be different (as seen in Tims
post). Bear this in mind if you want to compile data sets for biometric
uses.

That said, I found two interesting links:

http://www.ngohq.com/news/12163-how-force-1000hz-usb-sample-rate-windows-vista.html
(How to Force 1000Hz USB Sample Rate in Windows Vista)

http://www.ngohq.com/home.php?page=dseo
(Driver Signature Enforcement Overrider 1.0)