-
Notifications
You must be signed in to change notification settings - Fork 1.7k
IBM PC Mouse
Set mouse sample rate in Hz.
Param: {10d, 20d, 40d, 60d, 80d, 100d, 200d}
This command is followed by a byte indicating the resolution (0, 1, 2, 3: 1, 2, 4, 8 units per mm, respectively).
Param: {00, 01, 02, 03}
Responds with 3-byte status report.
Byte0:
Bit | Description |
---|---|
Bit 7 | 0 = Always (Reserved for future use) |
Bit 6 | 0 = Stream mode / 1 = Remote mode |
Bit 5 | 0 = Disable / 1 = Enable |
Bit 4 | 0 = Scaling 1:1 / 1 = Scaling 2:1 |
Bit 3 | 0 = Always (Reserved for future use) |
Bit 2 | 1 = Left button depressed (TrackPoint system or external device) |
Bit 1 | 1 = Middle button depressed (TrackPoint system or external device) |
Bit 0 | 1 = Right button depressed (TrackPoint system or external device) |
Byte 1: Current resolution setting (Same format as second byte of ”E8” command)
Byte 2: Current sampling rate (Same format as second byte of ”F3” command)
/* Data format:
* byte|7 6 5 4 3 2 1 0
* ----+--------------------------------------------------------------
* 0|Yovflw Xovflw Ysign Xsign 1 Middle Right Left
* 1| X movement
* 2| Y movement
*/
https://www.win.tue.nl/~aeb/linux/kbd/scancodes-13.html
https://en.wikipedia.org/wiki/IntelliMouse
Logitech PS/2++ protocol
https://www.win.tue.nl/~aeb/linux/kbd/scancodes-13.html
- X: 9-bit, -255(0x101) to 255(0x0FF)
- Y: 9-bit, -255(0x101) to 255(0x0FF)
- Wheel: 5-bit, -15(0x11) to 15(0x0F)
- Buttons: Left, Right, Middle, Back, Forward, Up, Down, Task, ...
Byte0:
Bit | Description |
---|---|
Bit 7 | Y-overflow |
Bit 6 | X-overflow |
Bit 5 | Y-sign |
Bit 4 | X-sign |
Bit 3 | 1 |
Bit 2 | Middle button |
Bit 1 | Right button |
Bit 0 | Left button |
Logitech mouse doesn't overflow on X and Y count, the overflow bits are useded to discriminate data kind.
When both Bit7 and Bit6 is 0(Byte0 == XY-sign | 0x08 | 3-buttons)
Byte0:
Bit | Description |
---|---|
Bit 7 | 0 |
Bit 6 | 0 |
Bit 5 | Y-sign |
Bit 4 | X-sign |
Bit 3 | 1 |
Bit 2 | Middle button |
Bit 1 | Right button |
Bit 0 | Left button |
Byte1: X movement, 8-bit
Byte2: Y movement, 8-bit
When Overflow bits are 1(Byte0 == 0xC8|3-buttons) and Byte1 is 0xD2 Byte2: Bit4: Back button, Bit5: Forward button
Byte2:
Bit | Description |
---|---|
Bit 7 | 0 |
Bit 6 | 0 |
Bit 5 | Forward button |
Bit 4 | Back button |
Bit 3 | 0 |
Bit 2 | 0 |
Bit 1 | 0 |
Bit 0 | 0 |
When Overflow bits are 1(Byte0 == 0xC8|3-buttons) and Byte1 is 0xE2
Byte2:
Bit | Description |
---|---|
Bit 7 | 0 |
Bit 6 | 0 |
Bit 5 | 0 |
Bit 4 | Down button |
Bit 3 | Up button |
Bit 2 | Task button |
Bit 1 | ??? button |
Bit 0 | ??? button |
When Overflow bits are 1(Byte0 == 0xC8|3-buttons), Byte1 is 0xD6 or 0xDE
Wheel movement: 5-bit, -1(0x1F) or 1(0x01) [-15(0x11) to 15(0x0F) in theory]
Byte1:
Bit | Description |
---|---|
Bit 7 | 1 |
Bit 6 | 1 |
Bit 5 | 0 |
Bit 4 | 1 |
Bit 3 | Wheel-Sign |
Bit 2 | 1 |
Bit 1 | 1 |
Bit 0 | 0 |
Byte2:
Bit | Description |
---|---|
Bit 7 | 0 |
Bit 6 | 1 = virtual scroll by Up/Down button |
Bit 5 | 0 |
Bit 4 | 0 |
Bit 3 | Wheel-3 |
Bit 2 | Wheel-2 |
Bit 1 | Wheel-1 |
Bit 0 | Wheel-0 |