From cba6f25d3d895e70dfa3d7dafa97a0e6e42617da Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 23 Dec 2009 18:43:27 +0000 Subject: [PATCH] [i8042prt] - Fix Ctrl-Scroll key combination, by ignoring ACK codes and not relying on a 0xe0 sequence code, which is not being sent at least on VBox. - Fix Tab-K handling at high irql, by moving it out of the DPC routine into the ISR. svn path=/trunk/; revision=44743 --- reactos/drivers/input/i8042prt/keyboard.c | 62 +++++++++-------------- 1 file changed, 23 insertions(+), 39 deletions(-) diff --git a/reactos/drivers/input/i8042prt/keyboard.c b/reactos/drivers/input/i8042prt/keyboard.c index 3168508c803..3aa2b1b24b4 100644 --- a/reactos/drivers/input/i8042prt/keyboard.c +++ b/reactos/drivers/input/i8042prt/keyboard.c @@ -15,7 +15,6 @@ /* GLOBALS *******************************************************************/ -static IO_WORKITEM_ROUTINE i8042DebugWorkItem; static IO_WORKITEM_ROUTINE i8042PowerWorkItem; /* This structure starts with the same layout as KEYBOARD_INDICATOR_TRANSLATION */ @@ -31,23 +30,6 @@ static LOCAL_KEYBOARD_INDICATOR_TRANSLATION IndicatorTranslation = { 3, { /* FUNCTIONS *****************************************************************/ -static VOID NTAPI -i8042DebugWorkItem( - IN PDEVICE_OBJECT DeviceObject, - IN PVOID Key) -{ - UNREFERENCED_PARAMETER(DeviceObject); - INFO_(I8042PRT, "Debug key: p\n", Key); - - if (!Key) - return; - - /* We hope kernel would understand this. If - * that's not the case, nothing would happen. - */ - KdSystemDebugControl(' soR', Key, 0, NULL, 0, NULL, KernelMode); -} - /* * These functions are callbacks for filter driver custom interrupt * service routines. @@ -367,26 +349,6 @@ i8042KbdDpcRoutine( KeReleaseInterruptSpinLock(PortDeviceExtension->HighestDIRQLInterrupt, Irql); - if (PortDeviceExtension->Settings.CrashOnCtrlScroll) - { - PKEYBOARD_INPUT_DATA InputData; - InputData = DeviceExtension->KeyboardBuffer + KeysInBufferCopy - 1; - - /* Test for TAB + key combination */ - if (InputData->MakeCode == 0x0F) - DeviceExtension->TabPressed = !(InputData->Flags & KEY_BREAK); - else if (DeviceExtension->TabPressed) - { - DeviceExtension->TabPressed = FALSE; - - IoQueueWorkItem( - DeviceExtension->DebugWorkItem, - &i8042DebugWorkItem, - DelayedWorkQueue, - (PVOID)(ULONG_PTR)InputData->MakeCode); - } - } - TRACE_(I8042PRT, "Send a key\n"); if (!DeviceExtension->KeyboardData.ClassService) @@ -827,7 +789,7 @@ i8042KbdInterruptService( if (PortDeviceExtension->Settings.CrashOnCtrlScroll) { /* Test for CTRL + SCROLL LOCK twice */ - static const UCHAR ScanCodes[] = { 0xe0, 0x1d, 0x46, 0xc6, 0x46, 0 }; + static const UCHAR ScanCodes[] = { 0x1d, 0x46, 0xc6, 0x46, 0 }; if (Output == ScanCodes[DeviceExtension->ComboPosition]) { @@ -835,10 +797,32 @@ i8042KbdInterruptService( if (ScanCodes[DeviceExtension->ComboPosition] == 0) KeBugCheck(MANUALLY_INITIATED_CRASH); } + else if (Output == 0xfa) + { + /* Ignore ACK */ + } else if (Output == ScanCodes[0]) DeviceExtension->ComboPosition = 1; else DeviceExtension->ComboPosition = 0; + + /* Test for TAB + key combination */ + if (InputData->MakeCode == 0x0F) + DeviceExtension->TabPressed = !(InputData->Flags & KEY_BREAK); + else if (DeviceExtension->TabPressed) + { + DeviceExtension->TabPressed = FALSE; + + /* Send request to the kernel debugger. + * Unknown requests will be ignored. */ + KdSystemDebugControl(' soR', + (PVOID)(ULONG_PTR)InputData->MakeCode, + 0, + NULL, + 0, + NULL, + KernelMode); + } } if (i8042KbdCallIsrHook(DeviceExtension, PortStatus, Output, &ToReturn))