Author: hpoussin
Date: Tue Oct 3 01:14:40 2006
New Revision: 24368
URL:
http://svn.reactos.org/svn/reactos?rev=24368&view=rev
Log:
Disable keyboard and mouse before checking the i8042 controller.
Flush queue before enabling them
Modified:
trunk/reactos/drivers/input/i8042prt/pnp.c
Modified: trunk/reactos/drivers/input/i8042prt/pnp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/input/i8042prt/pnp…
==============================================================================
--- trunk/reactos/drivers/input/i8042prt/pnp.c (original)
+++ trunk/reactos/drivers/input/i8042prt/pnp.c Tue Oct 3 01:14:40 2006
@@ -80,30 +80,30 @@
NTSTATUS Status;
UCHAR Value = 0;
- i8042Flush(DeviceExtension);
-
- if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, CTRL_SELF_TEST))
- {
- DPRINT1("Writing CTRL_SELF_TEST command failed\n");
- return STATUS_IO_TIMEOUT;
- }
-
- Status = i8042ReadDataWait(DeviceExtension, &Value);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to read CTRL_SELF_TEST response, status 0x%08lx\n", Status);
- return Status;
- }
-
- if (Value != 0x55)
- {
- DPRINT1("Got 0x%02x instead of 0x55\n", Value);
- return STATUS_IO_DEVICE_ERROR;
- }
-
/* Don't enable keyboard and mouse interrupts, disable keyboard/mouse */
if (!i8042ChangeMode(DeviceExtension, CCB_KBD_INT_ENAB | CCB_MOUSE_INT_ENAB,
CCB_KBD_DISAB | CCB_MOUSE_DISAB))
return STATUS_IO_DEVICE_ERROR;
+
+ i8042Flush(DeviceExtension);
+
+ if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, CTRL_SELF_TEST))
+ {
+ DPRINT1("Writing CTRL_SELF_TEST command failed\n");
+ return STATUS_IO_TIMEOUT;
+ }
+
+ Status = i8042ReadDataWait(DeviceExtension, &Value);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("Failed to read CTRL_SELF_TEST response, status 0x%08lx\n", Status);
+ return Status;
+ }
+
+ if (Value != 0x55)
+ {
+ DPRINT1("Got 0x%02x instead of 0x55\n", Value);
+ return STATUS_IO_DEVICE_ERROR;
+ }
/*
* We used to send a KBD_LINE_TEST (0xAB) command here, but on at least HP
@@ -131,11 +131,6 @@
IN PPORT_DEVICE_EXTENSION DeviceExtension)
{
NTSTATUS Status;
-
- if (!i8042ChangeMode(DeviceExtension, 0, CCB_KBD_DISAB))
- return FALSE;
-
- i8042Flush(DeviceExtension);
/* Set LEDs (that is not fatal if some error occurs) */
Status = i8042SynchWritePort(DeviceExtension, 0, KBD_CMD_SET_LEDS, TRUE);
@@ -332,6 +327,8 @@
{
UCHAR FlagsToDisable = 0;
UCHAR FlagsToEnable = 0;
+
+ i8042Flush(DeviceExtension);
/* Select the devices we have */
if (DeviceExtension->Flags & KEYBOARD_PRESENT)