1 // All or parts of this file are from CHAOS (http://www.se.chaosdev.org/).
2 // CHAOS is also under the GNU General Public License.
5 #define MOUSE_SET_RESOLUTION 0xE8 // Set resolution
6 #define MOUSE_SET_SCALE11 0xE6 // Set 1:1 scaling
7 #define MOUSE_SET_SCALE21 0xE7 // Set 2:1 scaling
8 #define MOUSE_GET_SCALE 0xE9 // Get scaling factor
9 #define MOUSE_SET_STREAM 0xEA // Set stream mode
10 #define MOUSE_SET_SAMPLE_RATE 0xF3 /* Set sample rate (number of times
11 * the controller will poll the port
13 #define MOUSE_ENABLE_DEVICE 0xF4 // Enable mouse device
14 #define MOUSE_DISABLE_DEVICE 0xF5 // Disable mouse device
15 #define MOUSE_RESET 0xFF // Reset aux device
16 #define MOUSE_ACK 0xFA // Command byte ACK
18 #define MOUSE_INTERRUPTS_OFF (CONTROLLER_MODE_KCC | \
19 CONTROLLER_MODE_DISABLE_MOUSE | \
20 CONTROLLER_MODE_SYS | \
21 CONTROLLER_MODE_KEYBOARD_INTERRUPT)
23 #define MOUSE_INTERRUPTS_ON (CONTROLLER_MODE_KCC | \
24 CONTROLLER_MODE_SYS | \
25 CONTROLLER_MODE_MOUSE_INTERRUPT | \
26 CONTROLLER_MODE_KEYBOARD_INTERRUPT)
28 // Used with mouse buttons
31 #define GPM_B_MIDDLE 4
33 // Some aux operations take long time
34 #define MAX_RETRIES 60
38 #define MOUSE_WRAP_MASK 0x1F
40 static PIRP CurrentIrp;
41 static ULONG MouseDataRead;
42 static ULONG MouseDataRequired;
43 static BOOLEAN AlreadyOpened = FALSE;
46 static VOID MouseDpcRoutine(PKDPC Dpc,
47 PVOID DeferredContext,
48 PVOID SystemArgument1,
49 PVOID SystemArgument2);