Reputation: 1173
I am using the hexdump -C to show realtime data from a pointing device on a linux box. The information it returns is 16 bytes of hex per line. Like this:
000001b0 a9 1c fd 4e f1 2c 0f 00 01 00 3e 00 01 00 00 00 |...N.,....>.....| 000001c0 a9 1c fd 4e 0e 2d 0f 00 01 00 3e 00 00 00 00 00 |...N.-....>.....| 000001d0 a9 1c fd 4e 16 2d 0f 00 00 00 00 00 00 00 00 00 |...N.-..........| 000001e0 aa 1c fd 4e b1 9a 05 00 01 00 3d 00 01 00 00 00 |...N......=.....| 000001f0 aa 1c fd 4e ce 9a 05 00 01 00 3d 00 00 00 00 00 |...N......=.....| 00000200 aa 1c fd 4e d5 9a 05 00 00 00 00 00 00 00 00 00 |...N............|
My question is, how do I know how to translate this string to the coordinate data from the mouse pointer?
Upvotes: 0
Views: 446
Reputation: 9278
Trial and error maybe? You know your screen's resolution so that may help. You could try putting the mouse pointer in the top left corner (0, 0) and record what data you get. Hopefuly it should not change if you try and scroll further past the screen (or the data repeats). Then move it to the lower right corner and record what data you get there. Again you're hoping that the values don't change if you try scroll off the screen. Then you can look at the data, fiddle with endianess until the values look right and figure out if there's any scaling going on.
Maybe
Upvotes: 0
Reputation: 979
you need to find what is the periodicity and the size (in bytes) of x and y coordinate
you can write a progam that calculates the frequency of the coordinates are written(while moving the device). then you have to calibrate... move the pointer and see the coordinates change... it is globally how i would have done.
Upvotes: 0