Changes based on the patch by Logan_V8_TT.

- Formating changes (TABs/spaces)
- Don't set 'Output Line 2' bit while power-uping the mouse during initalization.
- Restore 'Line Control' register at the end of mouse detection.
- Wait only 150000 millisecons (instead of 500000) for mouse power down.
- Enable detection of mouse on COM2 by default.

svn path=/trunk/; revision=7786
This commit is contained in:
Filip Navara 2004-01-20 15:18:27 +00:00
parent 526b9ea0bc
commit 0d1556f869

View file

@ -1,5 +1,5 @@
/*
* Serial Mouse driver 0.0.8
* Serial Mouse driver 0.0.9
* Written by Jason Filby (jasonfilby@yahoo.com)
* And heavily rewritten by Filip Navara (xnavara@volny.cz)
* For ReactOS (www.reactos.com)
@ -20,7 +20,7 @@
/* Check for mouse on COM1? */
#define SERMOUSE_COM1_SUPPORT
/* Check for mouse on COM2? */
//#define SERMOUSE_COM2_SUPPORT
#define SERMOUSE_COM2_SUPPORT
/* Create \??\Mouse* symlink for device? */
#define SERMOUSE_MOUSESYMLINK_SUPPORT
@ -393,18 +393,23 @@ ULONG DetectMicrosoftMouse(ULONG Port)
ULONG TimeOut = 250;
UCHAR LineControl;
/* Shutdown mouse or something like that */
/* Save original control */
LineControl = READ_PORT_UCHAR((PUCHAR)Port + 4);
/* Inactivate RTS and set DTR */
WRITE_PORT_UCHAR((PUCHAR)Port + 4, (LineControl & ~0x02) | 0x01);
KeStallExecutionProcessor(500000);
KeStallExecutionProcessor(150000); /* Wait > 100 ms */
/* Clear buffer */
while (READ_PORT_UCHAR((PUCHAR)Port + 5) & 0x01)
(void)READ_PORT_UCHAR((PUCHAR)Port);
/* Send modem control with 'Data Terminal Ready', 'Request To Send' and
* 'Output Line 2' message. This enables mouse to identify. */
WRITE_PORT_UCHAR((PUCHAR)Port + 4, 0x0b);
/*
* Send modem control with 'Data Terminal Ready' and 'Request To Send'
* message. This enables mouse to identify.
*/
WRITE_PORT_UCHAR((PUCHAR)Port + 4, 0x03);
/* Wait 10 milliseconds for the mouse getting ready */
KeStallExecutionProcessor(10000);
@ -421,6 +426,9 @@ ULONG DetectMicrosoftMouse(ULONG Port)
Buffer[i] = READ_PORT_UCHAR((PUCHAR)Port);
}
/* Restore control */
WRITE_PORT_UCHAR((PUCHAR)Port + 4, LineControl);
/* Check that four bytes for signs */
for (i = 0; i < 4; ++i)
{
@ -594,7 +602,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
{
BOOL MouseFound = FALSE;
DbgPrint("Serial Mouse Driver 0.0.8\n");
DbgPrint("Serial Mouse Driver 0.0.9\n");
#ifdef SERMOUSE_COM1_SUPPORT
DbgPrint("Trying to find mouse on COM1\n");
MouseFound |= InitializeMouse(MOUSE_PORT_COM1, MOUSE_IRQ_COM1, DriverObject);