Revert r39517, as there is no reason for such a change: files are consistently formatted, don't belong to ntoskrnl, use tabs only for indenting and not for formatting, and formatting revisions complicate svn blame feature usage.

svn path=/trunk/; revision=39553
This commit is contained in:
Hervé Poussineau 2009-02-11 17:21:10 +00:00
parent b4f50046ff
commit 0560eef6ec
11 changed files with 3380 additions and 3295 deletions

View file

@ -13,7 +13,8 @@
/* FUNCTIONS *****************************************************************/
NTSTATUS NTAPI
i8042Create(IN PDEVICE_OBJECT DeviceObject,
i8042Create(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
TRACE_(I8042PRT, "IRP_MJ_CREATE\n");
@ -25,7 +26,8 @@ i8042Create(IN PDEVICE_OBJECT DeviceObject,
}
NTSTATUS NTAPI
i8042Cleanup(IN PDEVICE_OBJECT DeviceObject,
i8042Cleanup(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
TRACE_(I8042PRT, "IRP_MJ_CLEANUP\n");
@ -37,7 +39,8 @@ i8042Cleanup(IN PDEVICE_OBJECT DeviceObject,
}
NTSTATUS NTAPI
i8042Close(IN PDEVICE_OBJECT DeviceObject,
i8042Close(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
TRACE_(I8042PRT, "IRP_MJ_CLOSE\n");

View file

@ -23,7 +23,8 @@ static DRIVER_DISPATCH i8042InternalDeviceControl;
DRIVER_INITIALIZE DriverEntry;
NTSTATUS NTAPI
i8042AddDevice(IN PDRIVER_OBJECT DriverObject,
i8042AddDevice(
IN PDRIVER_OBJECT DriverObject,
IN PDEVICE_OBJECT Pdo)
{
PI8042_DRIVER_EXTENSION DriverExtension;
@ -90,7 +91,8 @@ cleanup:
}
VOID NTAPI
i8042SendHookWorkItem(IN PDEVICE_OBJECT DeviceObject,
i8042SendHookWorkItem(
IN PDEVICE_OBJECT DeviceObject,
IN PVOID Context)
{
PI8042_HOOK_WORKITEM WorkItemData;
@ -214,7 +216,8 @@ cleanup:
}
static VOID NTAPI
i8042StartIo(IN PDEVICE_OBJECT DeviceObject,
i8042StartIo(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PFDO_DEVICE_EXTENSION DeviceExtension;
@ -233,10 +236,11 @@ i8042StartIo(IN PDEVICE_OBJECT DeviceObject,
}
/* Write the current byte of the packet. Returns FALSE in case
* of problems.
*/
* of problems.
*/
static BOOLEAN
i8042PacketWrite(IN PPORT_DEVICE_EXTENSION DeviceExtension)
i8042PacketWrite(
IN PPORT_DEVICE_EXTENSION DeviceExtension)
{
UCHAR Port = DeviceExtension->PacketPort;
@ -258,7 +262,8 @@ i8042PacketWrite(IN PPORT_DEVICE_EXTENSION DeviceExtension)
}
BOOLEAN
i8042PacketIsr(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042PacketIsr(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN UCHAR Output)
{
if (DeviceExtension->Packet.State == Idle)
@ -311,11 +316,12 @@ i8042PacketIsr(IN PPORT_DEVICE_EXTENSION DeviceExtension,
}
/*
* This function starts a packet. It must be called with the
* correct DIRQL.
*/
* This function starts a packet. It must be called with the
* correct DIRQL.
*/
NTSTATUS
i8042StartPacket(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042StartPacket(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN PFDO_DEVICE_EXTENSION FdoDeviceExtension,
IN PUCHAR Bytes,
IN ULONG ByteCount,
@ -375,7 +381,8 @@ done:
}
static NTSTATUS NTAPI
IrpStub(IN PDEVICE_OBJECT DeviceObject,
IrpStub(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
NTSTATUS Status = Irp->IoStatus.Status;
@ -387,7 +394,8 @@ IrpStub(IN PDEVICE_OBJECT DeviceObject,
}
static NTSTATUS NTAPI
i8042DeviceControl(IN PDEVICE_OBJECT DeviceObject,
i8042DeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PFDO_DEVICE_EXTENSION DeviceExtension;
@ -409,7 +417,8 @@ i8042DeviceControl(IN PDEVICE_OBJECT DeviceObject,
}
static NTSTATUS NTAPI
i8042InternalDeviceControl(IN PDEVICE_OBJECT DeviceObject,
i8042InternalDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PFDO_DEVICE_EXTENSION DeviceExtension;
@ -458,7 +467,8 @@ i8042InternalDeviceControl(IN PDEVICE_OBJECT DeviceObject,
}
NTSTATUS NTAPI
DriverEntry(IN PDRIVER_OBJECT DriverObject,
DriverEntry(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath)
{
PI8042_DRIVER_EXTENSION DriverExtension;

View file

@ -11,8 +11,8 @@
#include <debug.h>
/*-----------------------------------------------------
* Structures
* --------------------------------------------------*/
* Structures
* --------------------------------------------------*/
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
#define I8042PRT_TAG TAG('8', '0', '4', '2')
@ -209,8 +209,8 @@ typedef struct _I8042_HOOK_WORKITEM
} I8042_HOOK_WORKITEM, *PI8042_HOOK_WORKITEM;
/*-----------------------------------------------------
* Some defines
* --------------------------------------------------*/
* Some defines
* --------------------------------------------------*/
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
@ -219,8 +219,8 @@ typedef struct _I8042_HOOK_WORKITEM
#define KEYBOARD_WAKE_CODE 0x63
/*-----------------------------------------------------
* Controller commands
* --------------------------------------------------*/
* Controller commands
* --------------------------------------------------*/
#define KBD_READ_MODE 0x20
#define KBD_WRITE_MODE 0x60
@ -230,15 +230,15 @@ typedef struct _I8042_HOOK_WORKITEM
#define CTRL_WRITE_MOUSE 0xD4
/*-----------------------------------------------------
* Keyboard commands
* --------------------------------------------------*/
* Keyboard commands
* --------------------------------------------------*/
#define KBD_CMD_SET_LEDS 0xED
#define KBD_CMD_GET_ID 0xF2
/*-----------------------------------------------------
* Keyboard responses
* --------------------------------------------------*/
* Keyboard responses
* --------------------------------------------------*/
#define KBD_SELF_TEST_OK 0x55
#define KBD_ACK 0xFA
@ -246,8 +246,8 @@ typedef struct _I8042_HOOK_WORKITEM
#define KBD_RESEND 0xFE
/*-----------------------------------------------------
* Controller status register bits
* --------------------------------------------------*/
* Controller status register bits
* --------------------------------------------------*/
#define KBD_OBF 0x01
#define KBD_IBF 0x02
@ -255,8 +255,8 @@ typedef struct _I8042_HOOK_WORKITEM
#define KBD_PERR 0x80
/*-----------------------------------------------------
* Controller command byte bits
* --------------------------------------------------*/
* Controller command byte bits
* --------------------------------------------------*/
#define CCB_KBD_INT_ENAB 0x01
#define CCB_MOUSE_INT_ENAB 0x02
@ -266,31 +266,31 @@ typedef struct _I8042_HOOK_WORKITEM
#define CCB_TRANSLATE 0x40
/*-----------------------------------------------------
* LED bits
* --------------------------------------------------*/
* LED bits
* --------------------------------------------------*/
#define KBD_LED_SCROLL 0x01
#define KBD_LED_NUM 0x02
#define KBD_LED_CAPS 0x04
/*-----------------------------------------------------
* Mouse commands
* --------------------------------------------------*/
* Mouse commands
* --------------------------------------------------*/
#define MOU_ENAB 0xF4
#define MOU_CMD_RESET 0xFF
/*-----------------------------------------------------
* Mouse responses
* --------------------------------------------------*/
* Mouse responses
* --------------------------------------------------*/
#define MOUSE_ACK 0xFA
#define MOUSE_ERROR 0xFC
#define MOUSE_NACK 0xFE
/*-----------------------------------------------------
* Prototypes
* --------------------------------------------------*/
* Prototypes
* --------------------------------------------------*/
/* createclose.c */
@ -305,7 +305,8 @@ DRIVER_DISPATCH i8042Close;
/* keyboard.c */
NTSTATUS NTAPI
i8042SynchWritePortKbd(IN PVOID Context,
i8042SynchWritePortKbd(
IN PVOID Context,
IN UCHAR Value,
IN BOOLEAN WaitForAck);
@ -322,11 +323,13 @@ KSERVICE_ROUTINE i8042KbdInterruptService;
DRIVER_ADD_DEVICE i8042AddDevice;
BOOLEAN
i8042PacketIsr(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042PacketIsr(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN UCHAR Output);
NTSTATUS
i8042StartPacket(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042StartPacket(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN PFDO_DEVICE_EXTENSION FdoDeviceExtension,
IN PUCHAR Bytes,
IN ULONG ByteCount,
@ -339,22 +342,26 @@ DRIVER_DISPATCH ForwardIrpAndForget;
DRIVER_DISPATCH ForwardIrpAndWait;
NTSTATUS
DuplicateUnicodeString(IN ULONG Flags,
DuplicateUnicodeString(
IN ULONG Flags,
IN PCUNICODE_STRING SourceString,
OUT PUNICODE_STRING DestinationString);
/* mouse.c */
VOID
i8042MouHandle(IN PI8042_MOUSE_EXTENSION DeviceExtension,
i8042MouHandle(
IN PI8042_MOUSE_EXTENSION DeviceExtension,
IN UCHAR Output);
VOID
i8042MouHandleButtons(IN PI8042_MOUSE_EXTENSION DeviceExtension,
i8042MouHandleButtons(
IN PI8042_MOUSE_EXTENSION DeviceExtension,
IN USHORT Mask);
NTSTATUS
i8042MouInitialize(IN PI8042_MOUSE_EXTENSION DeviceExtension);
i8042MouInitialize(
IN PI8042_MOUSE_EXTENSION DeviceExtension);
DRIVER_DISPATCH i8042MouInternalDeviceControl;
@ -363,7 +370,8 @@ KSERVICE_ROUTINE i8042MouInterruptService;
/* pnp.c */
BOOLEAN
i8042ChangeMode(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042ChangeMode(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN UCHAR FlagsToDisable,
IN UCHAR FlagsToEnable);
@ -371,21 +379,25 @@ DRIVER_DISPATCH i8042Pnp;
/* ps2pp.c */
VOID
i8042MouHandlePs2pp(IN PI8042_MOUSE_EXTENSION DeviceExtension,
i8042MouHandlePs2pp(
IN PI8042_MOUSE_EXTENSION DeviceExtension,
IN UCHAR Input);
/* readwrite.c */
VOID
i8042Flush(IN PPORT_DEVICE_EXTENSION DeviceExtension);
i8042Flush(
IN PPORT_DEVICE_EXTENSION DeviceExtension);
BOOLEAN
i8042IsrWritePort(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042IsrWritePort(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN UCHAR Value,
IN UCHAR SelectCmd OPTIONAL);
NTSTATUS
i8042ReadData(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042ReadData(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN UCHAR StatusFlags,
OUT PUCHAR Data);
#define i8042ReadKeyboardData(DeviceExtension, Data) \
@ -394,42 +406,50 @@ i8042ReadData(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042ReadData(DeviceExtension, MOU_OBF, Data)
NTSTATUS
i8042ReadDataWait(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042ReadDataWait(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
OUT PUCHAR Data);
NTSTATUS
i8042ReadStatus(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042ReadStatus(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
OUT PUCHAR Status);
NTSTATUS NTAPI
i8042SynchReadPort(IN PVOID Context,
i8042SynchReadPort(
IN PVOID Context,
OUT PUCHAR Value,
IN BOOLEAN WaitForAck);
NTSTATUS NTAPI
i8042SynchWritePort(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042SynchWritePort(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN UCHAR Port,
IN UCHAR Value,
IN BOOLEAN WaitForAck);
BOOLEAN
i8042Write(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042Write(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN PUCHAR addr,
IN UCHAR data);
/* registry.c */
NTSTATUS
ReadRegistryEntries(IN PUNICODE_STRING RegistryPath,
ReadRegistryEntries(
IN PUNICODE_STRING RegistryPath,
OUT PI8042_SETTINGS Settings);
/* setup.c */
BOOLEAN
IsFirstStageSetup(VOID);
IsFirstStageSetup(
VOID);
NTSTATUS
i8042AddLegacyKeyboard(IN PDRIVER_OBJECT DriverObject,
i8042AddLegacyKeyboard(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath);
#endif // _I8042PRT_H_

View file

@ -35,7 +35,8 @@ static LOCAL_KEYBOARD_INDICATOR_TRANSLATION IndicatorTranslation = { 3, {
#define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
static VOID NTAPI
i8042DebugWorkItem(IN PDEVICE_OBJECT DeviceObject,
i8042DebugWorkItem(
IN PDEVICE_OBJECT DeviceObject,
IN PVOID Key)
{
INFO_(I8042PRT, "Debug key: p\n", Key);
@ -50,30 +51,31 @@ i8042DebugWorkItem(IN PDEVICE_OBJECT DeviceObject,
}
/*
* These functions are callbacks for filter driver custom interrupt
* service routines.
*/
* These functions are callbacks for filter driver custom interrupt
* service routines.
*/
/*static VOID NTAPI
i8042KbdIsrWritePort(
IN PVOID Context,
IN UCHAR Value)
IN PVOID Context,
IN UCHAR Value)
{
PI8042_KEYBOARD_EXTENSION DeviceExtension;
PI8042_KEYBOARD_EXTENSION DeviceExtension;
DeviceExtension = (PI8042_KEYBOARD_EXTENSION)Context;
DeviceExtension = (PI8042_KEYBOARD_EXTENSION)Context;
if (DeviceExtension->KeyboardHook.IsrWritePort)
{
DeviceExtension->KeyboardHook.IsrWritePort(
DeviceExtension->KeyboardHook.CallContext,
Value);
}
else
i8042IsrWritePort(Context, Value, 0);
if (DeviceExtension->KeyboardHook.IsrWritePort)
{
DeviceExtension->KeyboardHook.IsrWritePort(
DeviceExtension->KeyboardHook.CallContext,
Value);
}
else
i8042IsrWritePort(Context, Value, 0);
}*/
static VOID NTAPI
i8042KbdQueuePacket(IN PVOID Context)
i8042KbdQueuePacket(
IN PVOID Context)
{
PI8042_KEYBOARD_EXTENSION DeviceExtension;
@ -92,25 +94,28 @@ i8042KbdQueuePacket(IN PVOID Context)
}
/*
* These functions are callbacks for filter driver custom
* initialization routines.
*/
* These functions are callbacks for filter driver custom
* initialization routines.
*/
NTSTATUS NTAPI
i8042SynchWritePortKbd(IN PVOID Context,
i8042SynchWritePortKbd(
IN PVOID Context,
IN UCHAR Value,
IN BOOLEAN WaitForAck)
{
return i8042SynchWritePort((PPORT_DEVICE_EXTENSION)Context,
return i8042SynchWritePort(
(PPORT_DEVICE_EXTENSION)Context,
0,
Value,
WaitForAck);
}
/*
* Process the keyboard internal device requests
*/
* Process the keyboard internal device requests
*/
VOID NTAPI
i8042KbdStartIo(IN PDEVICE_OBJECT DeviceObject,
i8042KbdStartIo(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
@ -160,7 +165,8 @@ i8042KbdStartIo(IN PDEVICE_OBJECT DeviceObject,
}
static VOID
i8042PacketDpc(IN PPORT_DEVICE_EXTENSION DeviceExtension)
i8042PacketDpc(
IN PPORT_DEVICE_EXTENSION DeviceExtension)
{
BOOLEAN FinishIrp = FALSE;
KIRQL Irql;
@ -197,7 +203,8 @@ i8042PacketDpc(IN PPORT_DEVICE_EXTENSION DeviceExtension)
}
static VOID NTAPI
i8042PowerWorkItem(IN PDEVICE_OBJECT DeviceObject,
i8042PowerWorkItem(
IN PDEVICE_OBJECT DeviceObject,
IN PVOID Context)
{
PI8042_KEYBOARD_EXTENSION DeviceExtension;
@ -280,7 +287,8 @@ i8042PowerWorkItem(IN PDEVICE_OBJECT DeviceObject,
/* Return TRUE if it was a power key */
static BOOLEAN
HandlePowerKeys(IN PI8042_KEYBOARD_EXTENSION DeviceExtension)
HandlePowerKeys(
IN PI8042_KEYBOARD_EXTENSION DeviceExtension)
{
PKEYBOARD_INPUT_DATA InputData;
ULONG KeyPress;
@ -320,7 +328,8 @@ HandlePowerKeys(IN PI8042_KEYBOARD_EXTENSION DeviceExtension)
}
static VOID NTAPI
i8042KbdDpcRoutine(IN PKDPC Dpc,
i8042KbdDpcRoutine(
IN PKDPC Dpc,
IN PVOID DeferredContext,
IN PVOID SystemArgument1,
IN PVOID SystemArgument2)
@ -392,10 +401,11 @@ i8042KbdDpcRoutine(IN PKDPC Dpc,
}
/*
* Runs the keyboard IOCTL dispatch.
*/
* Runs the keyboard IOCTL dispatch.
*/
NTSTATUS NTAPI
i8042KbdDeviceControl(IN PDEVICE_OBJECT DeviceObject,
i8042KbdDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
@ -493,10 +503,11 @@ i8042KbdDeviceControl(IN PDEVICE_OBJECT DeviceObject,
}
/*
* Runs the keyboard IOCTL_INTERNAL dispatch.
*/
* Runs the keyboard IOCTL_INTERNAL dispatch.
*/
NTSTATUS NTAPI
i8042KbdInternalDeviceControl(IN PDEVICE_OBJECT DeviceObject,
i8042KbdInternalDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
@ -699,13 +710,14 @@ cleanup:
}
/*
* Call the customization hook. The ToReturn parameter is about wether
* we should go on with the interrupt. The return value is what
* we should return (indicating to the system wether someone else
* should try to handle the interrupt)
*/
* Call the customization hook. The ToReturn parameter is about wether
* we should go on with the interrupt. The return value is what
* we should return (indicating to the system wether someone else
* should try to handle the interrupt)
*/
static BOOLEAN
i8042KbdCallIsrHook(IN PI8042_KEYBOARD_EXTENSION DeviceExtension,
i8042KbdCallIsrHook(
IN PI8042_KEYBOARD_EXTENSION DeviceExtension,
IN UCHAR Status,
IN UCHAR Input,
OUT PBOOLEAN ToReturn)
@ -735,7 +747,8 @@ i8042KbdCallIsrHook(IN PI8042_KEYBOARD_EXTENSION DeviceExtension,
}
BOOLEAN NTAPI
i8042KbdInterruptService(IN PKINTERRUPT Interrupt,
i8042KbdInterruptService(
IN PKINTERRUPT Interrupt,
PVOID Context)
{
PI8042_KEYBOARD_EXTENSION DeviceExtension;

View file

@ -13,7 +13,8 @@
/* FUNCTIONS *****************************************************************/
NTSTATUS NTAPI
ForwardIrpAndWait(IN PDEVICE_OBJECT DeviceObject,
ForwardIrpAndWait(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PDEVICE_OBJECT LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
@ -27,7 +28,8 @@ ForwardIrpAndWait(IN PDEVICE_OBJECT DeviceObject,
}
NTSTATUS NTAPI
ForwardIrpAndForget(IN PDEVICE_OBJECT DeviceObject,
ForwardIrpAndForget(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PDEVICE_OBJECT LowerDevice = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->LowerDevice;
@ -39,7 +41,8 @@ ForwardIrpAndForget(IN PDEVICE_OBJECT DeviceObject,
}
NTSTATUS
DuplicateUnicodeString(IN ULONG Flags,
DuplicateUnicodeString(
IN ULONG Flags,
IN PCUNICODE_STRING SourceString,
OUT PUNICODE_STRING DestinationString)
{

View file

@ -17,11 +17,12 @@
/* FUNCTIONS *****************************************************************/
/*
* These functions are callbacks for filter driver custom interrupt
* service routines.
*/
* These functions are callbacks for filter driver custom interrupt
* service routines.
*/
static VOID NTAPI
i8042MouIsrWritePort(IN PVOID Context,
i8042MouIsrWritePort(
IN PVOID Context,
IN UCHAR Value)
{
PI8042_MOUSE_EXTENSION DeviceExtension;
@ -39,7 +40,8 @@ i8042MouIsrWritePort(IN PVOID Context,
}
static VOID NTAPI
i8042MouQueuePacket(IN PVOID Context)
i8042MouQueuePacket(
IN PVOID Context)
{
PI8042_MOUSE_EXTENSION DeviceExtension;
@ -58,7 +60,8 @@ i8042MouQueuePacket(IN PVOID Context)
}
VOID
i8042MouHandle(IN PI8042_MOUSE_EXTENSION DeviceExtension,
i8042MouHandle(
IN PI8042_MOUSE_EXTENSION DeviceExtension,
IN UCHAR Output)
{
PMOUSE_INPUT_DATA MouseInput;
@ -176,11 +179,12 @@ i8042MouHandle(IN PI8042_MOUSE_EXTENSION DeviceExtension,
}
/*
* Updates ButtonFlags according to RawButtons and a saved state;
* Only takes in account the bits that are set in Mask
*/
* Updates ButtonFlags according to RawButtons and a saved state;
* Only takes in account the bits that are set in Mask
*/
VOID
i8042MouHandleButtons(IN PI8042_MOUSE_EXTENSION DeviceExtension,
i8042MouHandleButtons(
IN PI8042_MOUSE_EXTENSION DeviceExtension,
IN USHORT Mask)
{
PMOUSE_INPUT_DATA MouseInput;
@ -209,10 +213,11 @@ i8042MouHandleButtons(IN PI8042_MOUSE_EXTENSION DeviceExtension,
}
/* Does lastest initializations for the mouse. This method
* is called just before connecting the interrupt.
*/
* is called just before connecting the interrupt.
*/
NTSTATUS
i8042MouInitialize(IN PI8042_MOUSE_EXTENSION DeviceExtension)
i8042MouInitialize(
IN PI8042_MOUSE_EXTENSION DeviceExtension)
{
NTSTATUS Status;
UCHAR Value;
@ -245,7 +250,8 @@ i8042MouInitialize(IN PI8042_MOUSE_EXTENSION DeviceExtension)
}
static VOID NTAPI
i8042MouDpcRoutine(IN PKDPC Dpc,
i8042MouDpcRoutine(
IN PKDPC Dpc,
IN PVOID DeferredContext,
IN PVOID SystemArgument1,
IN PVOID SystemArgument2)
@ -328,11 +334,12 @@ i8042MouDpcRoutine(IN PKDPC Dpc,
}
/* This timer DPC will be called when the mouse reset times out.
* I'll just send the 'disable mouse port' command to the controller
* and say the mouse doesn't exist.
*/
* I'll just send the 'disable mouse port' command to the controller
* and say the mouse doesn't exist.
*/
static VOID NTAPI
i8042DpcRoutineMouseTimeout(IN PKDPC Dpc,
i8042DpcRoutineMouseTimeout(
IN PKDPC Dpc,
IN PVOID DeferredContext,
IN PVOID SystemArgument1,
IN PVOID SystemArgument2)
@ -359,10 +366,11 @@ i8042DpcRoutineMouseTimeout(IN PKDPC Dpc,
}
/*
* Runs the mouse IOCTL_INTERNAL dispatch.
*/
* Runs the mouse IOCTL_INTERNAL dispatch.
*/
NTSTATUS NTAPI
i8042MouInternalDeviceControl(IN PDEVICE_OBJECT DeviceObject,
i8042MouInternalDeviceControl(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;
@ -495,17 +503,18 @@ cleanup:
}
/* Test if packets are taking too long to come in. If they do, we
* might have gotten out of sync and should just drop what we have.
*
* If we want to be totally right, we'd also have to keep a count of
* errors, and totally reset the mouse after too much of them (can
* happen if the user is using a KVM switch and an OS on another port
* resets the mouse, or if the user hotplugs the mouse, or if we're just
* generally unlucky). Also note the input parsing routine where we
* drop invalid input packets.
*/
* might have gotten out of sync and should just drop what we have.
*
* If we want to be totally right, we'd also have to keep a count of
* errors, and totally reset the mouse after too much of them (can
* happen if the user is using a KVM switch and an OS on another port
* resets the mouse, or if the user hotplugs the mouse, or if we're just
* generally unlucky). Also note the input parsing routine where we
* drop invalid input packets.
*/
static VOID
i8042MouInputTestTimeout(IN PI8042_MOUSE_EXTENSION DeviceExtension)
i8042MouInputTestTimeout(
IN PI8042_MOUSE_EXTENSION DeviceExtension)
{
ULARGE_INTEGER Now;
@ -530,13 +539,14 @@ i8042MouInputTestTimeout(IN PI8042_MOUSE_EXTENSION DeviceExtension)
}
/*
* Call the customization hook. The ToReturn parameter is about wether
* we should go on with the interrupt. The return value is what
* we should return (indicating to the system wether someone else
* should try to handle the interrupt)
*/
* Call the customization hook. The ToReturn parameter is about wether
* we should go on with the interrupt. The return value is what
* we should return (indicating to the system wether someone else
* should try to handle the interrupt)
*/
static BOOLEAN
i8042MouCallIsrHook(IN PI8042_MOUSE_EXTENSION DeviceExtension,
i8042MouCallIsrHook(
IN PI8042_MOUSE_EXTENSION DeviceExtension,
IN UCHAR Status,
IN UCHAR Input,
OUT PBOOLEAN ToReturn)
@ -567,7 +577,8 @@ i8042MouCallIsrHook(IN PI8042_MOUSE_EXTENSION DeviceExtension,
}
static BOOLEAN
i8042MouResetIsr(IN PI8042_MOUSE_EXTENSION DeviceExtension,
i8042MouResetIsr(
IN PI8042_MOUSE_EXTENSION DeviceExtension,
IN UCHAR Status,
IN UCHAR Value)
{
@ -817,7 +828,8 @@ i8042MouResetIsr(IN PI8042_MOUSE_EXTENSION DeviceExtension,
}
BOOLEAN NTAPI
i8042MouInterruptService(IN PKINTERRUPT Interrupt,
i8042MouInterruptService(
IN PKINTERRUPT Interrupt,
PVOID Context)
{
PI8042_MOUSE_EXTENSION DeviceExtension;

View file

@ -14,25 +14,26 @@
/* FUNCTIONS *****************************************************************/
/* This is all pretty confusing. There's more than one way to
* disable/enable the keyboard. You can send KBD_ENABLE to the
* keyboard, and it will start scanning keys. Sending KBD_DISABLE
* will disable the key scanning but also reset the parameters to
* defaults.
*
* You can also send 0xAE to the controller for enabling the
* keyboard clock line and 0xAD for disabling it. Then it'll
* automatically get turned on at the next command. The last
* way is by modifying the bit that drives the clock line in the
* 'command byte' of the controller. This is almost, but not quite,
* the same as the AE/AD thing. The difference can be used to detect
* some really old broken keyboard controllers which I hope won't be
* necessary.
*
* We change the command byte, sending KBD_ENABLE/DISABLE seems to confuse
* some kvm switches.
*/
* disable/enable the keyboard. You can send KBD_ENABLE to the
* keyboard, and it will start scanning keys. Sending KBD_DISABLE
* will disable the key scanning but also reset the parameters to
* defaults.
*
* You can also send 0xAE to the controller for enabling the
* keyboard clock line and 0xAD for disabling it. Then it'll
* automatically get turned on at the next command. The last
* way is by modifying the bit that drives the clock line in the
* 'command byte' of the controller. This is almost, but not quite,
* the same as the AE/AD thing. The difference can be used to detect
* some really old broken keyboard controllers which I hope won't be
* necessary.
*
* We change the command byte, sending KBD_ENABLE/DISABLE seems to confuse
* some kvm switches.
*/
BOOLEAN
i8042ChangeMode(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042ChangeMode(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN UCHAR FlagsToDisable,
IN UCHAR FlagsToEnable)
{
@ -71,7 +72,8 @@ i8042ChangeMode(IN PPORT_DEVICE_EXTENSION DeviceExtension,
}
static NTSTATUS
i8042BasicDetect(IN PPORT_DEVICE_EXTENSION DeviceExtension)
i8042BasicDetect(
IN PPORT_DEVICE_EXTENSION DeviceExtension)
{
NTSTATUS Status;
ULONG ResendIterations;
@ -122,7 +124,8 @@ i8042BasicDetect(IN PPORT_DEVICE_EXTENSION DeviceExtension)
}
static VOID
i8042DetectKeyboard(IN PPORT_DEVICE_EXTENSION DeviceExtension)
i8042DetectKeyboard(
IN PPORT_DEVICE_EXTENSION DeviceExtension)
{
NTSTATUS Status;
@ -157,7 +160,8 @@ i8042DetectKeyboard(IN PPORT_DEVICE_EXTENSION DeviceExtension)
}
static VOID
i8042DetectMouse(IN PPORT_DEVICE_EXTENSION DeviceExtension)
i8042DetectMouse(
IN PPORT_DEVICE_EXTENSION DeviceExtension)
{
NTSTATUS Status;
UCHAR Value;
@ -258,7 +262,8 @@ failure:
}
static NTSTATUS
i8042ConnectKeyboardInterrupt(IN PI8042_KEYBOARD_EXTENSION DeviceExtension)
i8042ConnectKeyboardInterrupt(
IN PI8042_KEYBOARD_EXTENSION DeviceExtension)
{
PPORT_DEVICE_EXTENSION PortDeviceExtension;
KIRQL DirqlMax;
@ -303,7 +308,8 @@ i8042ConnectKeyboardInterrupt(IN PI8042_KEYBOARD_EXTENSION DeviceExtension)
}
static NTSTATUS
i8042ConnectMouseInterrupt(IN PI8042_MOUSE_EXTENSION DeviceExtension)
i8042ConnectMouseInterrupt(
IN PI8042_MOUSE_EXTENSION DeviceExtension)
{
PPORT_DEVICE_EXTENSION PortDeviceExtension;
KIRQL DirqlMax;
@ -365,7 +371,8 @@ cleanup:
}
static NTSTATUS
EnableInterrupts(IN PPORT_DEVICE_EXTENSION DeviceExtension,
EnableInterrupts(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN UCHAR FlagsToDisable,
IN UCHAR FlagsToEnable)
{
@ -388,7 +395,8 @@ EnableInterrupts(IN PPORT_DEVICE_EXTENSION DeviceExtension,
}
static NTSTATUS
StartProcedure(IN PPORT_DEVICE_EXTENSION DeviceExtension)
StartProcedure(
IN PPORT_DEVICE_EXTENSION DeviceExtension)
{
NTSTATUS Status;
UCHAR FlagsToDisable = 0;
@ -468,7 +476,8 @@ StartProcedure(IN PPORT_DEVICE_EXTENSION DeviceExtension)
}
static NTSTATUS
i8042PnpStartDevice(IN PDEVICE_OBJECT DeviceObject,
i8042PnpStartDevice(
IN PDEVICE_OBJECT DeviceObject,
IN PCM_RESOURCE_LIST AllocatedResources,
IN PCM_RESOURCE_LIST AllocatedResourcesTranslated)
{
@ -622,7 +631,8 @@ i8042PnpStartDevice(IN PDEVICE_OBJECT DeviceObject,
}
NTSTATUS NTAPI
i8042Pnp(IN PDEVICE_OBJECT DeviceObject,
i8042Pnp(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
PIO_STACK_LOCATION Stack;

View file

@ -14,7 +14,8 @@
/* FUNCTIONS *****************************************************************/
VOID
i8042MouHandlePs2pp(IN PI8042_MOUSE_EXTENSION DeviceExtension,
i8042MouHandlePs2pp(
IN PI8042_MOUSE_EXTENSION DeviceExtension,
IN UCHAR Input)
{
UCHAR PktType;

View file

@ -16,7 +16,8 @@
/* FUNCTIONS *****************************************************************/
VOID
i8042Flush(IN PPORT_DEVICE_EXTENSION DeviceExtension)
i8042Flush(
IN PPORT_DEVICE_EXTENSION DeviceExtension)
{
UCHAR Ignore;
@ -34,7 +35,8 @@ i8042Flush(IN PPORT_DEVICE_EXTENSION DeviceExtension)
}
BOOLEAN
i8042IsrWritePort(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042IsrWritePort(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN UCHAR Value,
IN UCHAR SelectCmd OPTIONAL)
{
@ -46,10 +48,11 @@ i8042IsrWritePort(IN PPORT_DEVICE_EXTENSION DeviceExtension,
}
/*
* FUNCTION: Read data from port 0x60
*/
* FUNCTION: Read data from port 0x60
*/
NTSTATUS
i8042ReadData(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042ReadData(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN UCHAR StatusFlags,
OUT PUCHAR Data)
{
@ -74,7 +77,8 @@ i8042ReadData(IN PPORT_DEVICE_EXTENSION DeviceExtension,
}
NTSTATUS
i8042ReadStatus(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042ReadStatus(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
OUT PUCHAR Status)
{
ASSERT(DeviceExtension->ControlPort != NULL);
@ -83,10 +87,11 @@ i8042ReadStatus(IN PPORT_DEVICE_EXTENSION DeviceExtension,
}
/*
* FUNCTION: Read data from data port
*/
* FUNCTION: Read data from data port
*/
NTSTATUS
i8042ReadDataWait(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042ReadDataWait(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
OUT PUCHAR Data)
{
ULONG Counter;
@ -109,13 +114,14 @@ i8042ReadDataWait(IN PPORT_DEVICE_EXTENSION DeviceExtension,
}
/*
* This one reads a value from the port; You don't have to specify
* which one, it'll always be from the one you talked to, so one function
* is enough this time. Note how MSDN specifies the
* WaitForAck parameter to be ignored.
*/
* This one reads a value from the port; You don't have to specify
* which one, it'll always be from the one you talked to, so one function
* is enough this time. Note how MSDN specifies the
* WaitForAck parameter to be ignored.
*/
NTSTATUS NTAPI
i8042SynchReadPort(IN PVOID Context,
i8042SynchReadPort(
IN PVOID Context,
OUT PUCHAR Value,
IN BOOLEAN WaitForAck)
{
@ -127,11 +133,12 @@ i8042SynchReadPort(IN PVOID Context,
}
/*
* These functions are callbacks for filter driver custom
* initialization routines.
*/
* These functions are callbacks for filter driver custom
* initialization routines.
*/
NTSTATUS NTAPI
i8042SynchWritePort(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042SynchWritePort(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN UCHAR Port,
IN UCHAR Value,
IN BOOLEAN WaitForAck)
@ -182,10 +189,11 @@ i8042SynchWritePort(IN PPORT_DEVICE_EXTENSION DeviceExtension,
}
/*
* FUNCTION: Write data to a port, waiting first for it to become ready
*/
* FUNCTION: Write data to a port, waiting first for it to become ready
*/
BOOLEAN
i8042Write(IN PPORT_DEVICE_EXTENSION DeviceExtension,
i8042Write(
IN PPORT_DEVICE_EXTENSION DeviceExtension,
IN PUCHAR addr,
IN UCHAR data)
{

View file

@ -16,7 +16,8 @@
/* FUNCTIONS *****************************************************************/
NTSTATUS
ReadRegistryEntries(IN PUNICODE_STRING RegistryPath,
ReadRegistryEntries(
IN PUNICODE_STRING RegistryPath,
OUT PI8042_SETTINGS Settings)
{
RTL_QUERY_REGISTRY_TABLE Parameters[17];

View file

@ -7,8 +7,8 @@
*/
/* NOTE:
* All this file is a big hack and should be removed one day...
*/
* All this file is a big hack and should be removed one day...
*/
/* INCLUDES ******************************************************************/
@ -23,7 +23,8 @@
/* FUNCTIONS *****************************************************************/
BOOLEAN
IsFirstStageSetup(VOID)
IsFirstStageSetup(
VOID)
{
UNICODE_STRING PathU = RTL_CONSTANT_STRING(L"\\REGISTRY\\MACHINE\\SYSTEM\\Setup");
OBJECT_ATTRIBUTES ObjectAttributes;
@ -46,7 +47,8 @@ IsFirstStageSetup(VOID)
}
static VOID NTAPI
SendStartDevice(IN PDRIVER_OBJECT DriverObject,
SendStartDevice(
IN PDRIVER_OBJECT DriverObject,
IN PVOID Context,
IN ULONG Count)
{
@ -162,7 +164,8 @@ cleanup:
}
static NTSTATUS
AddRegistryEntry(IN PCWSTR PortTypeName,
AddRegistryEntry(
IN PCWSTR PortTypeName,
IN PUNICODE_STRING DeviceName,
IN PCWSTR RegistryPath)
{
@ -208,7 +211,8 @@ cleanup:
}
NTSTATUS
i8042AddLegacyKeyboard(IN PDRIVER_OBJECT DriverObject,
i8042AddLegacyKeyboard(
IN PDRIVER_OBJECT DriverObject,
IN PUNICODE_STRING RegistryPath)
{
UNICODE_STRING KeyboardName = RTL_CONSTANT_STRING(L"\\Device\\KeyboardPort8042");