Alright, I think I have most of it (if all you care about is two buttons and change in location). The data is distributed as three or four bytes at a time. The first byte is a bunch of flags:
0 0 0 0 1 0 0 0
^ ^ ^ ^ ^ ^ ^ ^
| | | | | | | |
a b c d e f g h
I do not know what bits a and b do. Bit e is always 1 and is used as a marker for the `first byte' of a message. Bit h is 1 if the left button is down and 0 if it is up. Likewise, bit g is for the right mouse button, and bit f is for the middle mouse button. Bit d is 1, iff the value stored in the next byte is negative. Bit c is 1, iff the value stored in the third byte is negative.
If you haven't already guessed, the second byte holds dx (the change in x). The format is tricky (a signed
char). The third bit holds dy (as a signed char). There is no danger of overflow, since dx and dy are made sure not
to exceed 127 in magnitude.
My guess is that the fourth byte (if it exists) is for a scroll wheel (dz).
A brief refresher on signed chars:
38 = 00100110
-38 = 11011001