ReactOS 0.4.16-dev-125-g798ea90
keyboard.c File Reference
#include "i8042prt.h"
#include <poclass.h>
#include <ndk/kdfuncs.h>
#include <debug.h>
Include dependency graph for keyboard.c:

Go to the source code of this file.

Classes

struct  _LOCAL_KEYBOARD_INDICATOR_TRANSLATION
 

Typedefs

typedef struct _LOCAL_KEYBOARD_INDICATOR_TRANSLATION LOCAL_KEYBOARD_INDICATOR_TRANSLATION
 
typedef struct _LOCAL_KEYBOARD_INDICATOR_TRANSLATIONPLOCAL_KEYBOARD_INDICATOR_TRANSLATION
 

Functions

static VOID NTAPI i8042KbdQueuePacket (IN PVOID Context)
 
NTSTATUS NTAPI i8042SynchWritePortKbd (IN PVOID Context, IN UCHAR Value, IN BOOLEAN WaitForAck)
 
VOID NTAPI i8042KbdStartIo (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static VOID i8042PacketDpc (IN PPORT_DEVICE_EXTENSION DeviceExtension)
 
static VOID NTAPI i8042PowerWorkItem (IN PDEVICE_OBJECT DeviceObject, IN PVOID Context)
 
static BOOLEAN HandlePowerKeys (IN PI8042_KEYBOARD_EXTENSION DeviceExtension)
 
static VOID NTAPI i8042KbdDpcRoutine (IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
 
NTSTATUS NTAPI i8042KbdDeviceControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
VOID NTAPI i8042InitializeKeyboardAttributes (PI8042_KEYBOARD_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI i8042KbdInternalDeviceControl (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
 
static BOOLEAN i8042KbdCallIsrHook (IN PI8042_KEYBOARD_EXTENSION DeviceExtension, IN UCHAR Status, IN UCHAR Input, OUT PBOOLEAN ToReturn)
 
BOOLEAN NTAPI i8042KbdInterruptService (IN PKINTERRUPT Interrupt, PVOID Context)
 

Variables

static IO_WORKITEM_ROUTINE i8042PowerWorkItem
 
static KDEFERRED_ROUTINE i8042KbdDpcRoutine
 
static LOCAL_KEYBOARD_INDICATOR_TRANSLATION IndicatorTranslation
 

Typedef Documentation

◆ LOCAL_KEYBOARD_INDICATOR_TRANSLATION

◆ PLOCAL_KEYBOARD_INDICATOR_TRANSLATION

Function Documentation

◆ HandlePowerKeys()

static BOOLEAN HandlePowerKeys ( IN PI8042_KEYBOARD_EXTENSION  DeviceExtension)
static

Definition at line 279 of file keyboard.c.

281{
282 PKEYBOARD_INPUT_DATA InputData;
283 ULONG KeyPress;
284
285 InputData = DeviceExtension->KeyboardBuffer + DeviceExtension->KeysInBuffer - 1;
286 if (!(InputData->Flags & KEY_E0))
287 return FALSE;
288
289 switch (InputData->MakeCode)
290 {
292 KeyPress = SYS_BUTTON_POWER;
293 break;
295 KeyPress = SYS_BUTTON_SLEEP;
296 break;
298 KeyPress = SYS_BUTTON_WAKE;
299 break;
300 default:
301 return FALSE;
302 }
303
304 if (InputData->Flags & KEY_BREAK)
305 /* We already took care of the key press */
306 return TRUE;
307
308 /* Our work can only be done at passive level, so use a workitem */
309 DeviceExtension->NewCaps |= KeyPress;
310 InterlockedExchange((PLONG)&DeviceExtension->LastPowerKey, KeyPress);
312 DeviceExtension->PowerWorkItem,
315 DeviceExtension);
316 return TRUE;
317}
#define InterlockedExchange
Definition: armddk.h:54
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static IO_WORKITEM_ROUTINE i8042PowerWorkItem
Definition: keyboard.c:23
#define KEYBOARD_SLEEP_CODE
Definition: i8042prt.h:214
#define KEYBOARD_POWER_CODE
Definition: i8042prt.h:213
#define KEYBOARD_WAKE_CODE
Definition: i8042prt.h:215
VOID NTAPI IoQueueWorkItem(IN PIO_WORKITEM IoWorkItem, IN PIO_WORKITEM_ROUTINE WorkerRoutine, IN WORK_QUEUE_TYPE QueueType, IN PVOID Context)
Definition: iowork.c:40
#define KEY_BREAK
Definition: ntddkbd.h:71
#define KEY_E0
Definition: ntddkbd.h:72
#define SYS_BUTTON_SLEEP
Definition: poclass.h:84
#define SYS_BUTTON_POWER
Definition: poclass.h:83
#define SYS_BUTTON_WAKE
Definition: poclass.h:86
int32_t * PLONG
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
@ DelayedWorkQueue
Definition: extypes.h:190

Referenced by i8042KbdDpcRoutine().

◆ i8042InitializeKeyboardAttributes()

VOID NTAPI i8042InitializeKeyboardAttributes ( PI8042_KEYBOARD_EXTENSION  DeviceExtension)

Definition at line 483 of file keyboard.c.

485{
486 PPORT_DEVICE_EXTENSION PortDeviceExtension;
488 PKEYBOARD_ATTRIBUTES KeyboardAttributes;
489
490 PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension;
491 Settings = &PortDeviceExtension->Settings;
492
493 KeyboardAttributes = &DeviceExtension->KeyboardAttributes;
494
495 KeyboardAttributes->KeyboardIdentifier.Type = (UCHAR)Settings->OverrideKeyboardType;
496 KeyboardAttributes->KeyboardIdentifier.Subtype = (UCHAR)Settings->OverrideKeyboardSubtype;
497 KeyboardAttributes->NumberOfFunctionKeys = 4;
498 KeyboardAttributes->NumberOfIndicators = 3;
499 KeyboardAttributes->NumberOfKeysTotal = 101;
500 KeyboardAttributes->InputDataQueueLength = Settings->KeyboardDataQueueSize;
501 KeyboardAttributes->KeyRepeatMinimum.UnitId = 0;
502 KeyboardAttributes->KeyRepeatMinimum.Rate = (USHORT)Settings->SampleRate;
503 KeyboardAttributes->KeyRepeatMinimum.Delay = 0;
504 KeyboardAttributes->KeyRepeatMinimum.UnitId = 0;
505 KeyboardAttributes->KeyRepeatMinimum.Rate = (USHORT)Settings->SampleRate;
506 KeyboardAttributes->KeyRepeatMinimum.Delay = 0;
507}
unsigned short USHORT
Definition: pedump.c:61
PPORT_DEVICE_EXTENSION PortDeviceExtension
Definition: i8042prt.h:134
KEYBOARD_ATTRIBUTES KeyboardAttributes
Definition: i8042prt.h:144
FDO_DEVICE_EXTENSION Common
Definition: i8042prt.h:139
KEYBOARD_ID KeyboardIdentifier
Definition: ntddkbd.h:124
ULONG InputDataQueueLength
Definition: ntddkbd.h:129
USHORT NumberOfKeysTotal
Definition: ntddkbd.h:128
USHORT NumberOfIndicators
Definition: ntddkbd.h:127
KEYBOARD_TYPEMATIC_PARAMETERS KeyRepeatMinimum
Definition: ntddkbd.h:130
USHORT NumberOfFunctionKeys
Definition: ntddkbd.h:126
UCHAR Subtype
Definition: ntddkbd.h:102
UCHAR Type
Definition: ntddkbd.h:101
I8042_SETTINGS Settings
Definition: i8042prt.h:81
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_POWER_POLICY_IDLE_SETTINGS Settings
Definition: wdfdevice.h:2595
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by i8042KbdInternalDeviceControl().

◆ i8042KbdCallIsrHook()

static BOOLEAN i8042KbdCallIsrHook ( IN PI8042_KEYBOARD_EXTENSION  DeviceExtension,
IN UCHAR  Status,
IN UCHAR  Input,
OUT PBOOLEAN  ToReturn 
)
static

Definition at line 758 of file keyboard.c.

763{
764 BOOLEAN HookReturn, HookContinue;
765
766 HookContinue = FALSE;
767
768 if (DeviceExtension->KeyboardHook.IsrRoutine)
769 {
770 HookReturn = DeviceExtension->KeyboardHook.IsrRoutine(
771 DeviceExtension->KeyboardHook.Context,
772 DeviceExtension->KeyboardBuffer + DeviceExtension->KeysInBuffer,
773 &DeviceExtension->Common.PortDeviceExtension->Packet,
774 Status,
775 &Input,
776 &HookContinue,
777 &DeviceExtension->KeyboardScanState);
778
779 if (!HookContinue)
780 {
781 *ToReturn = HookReturn;
782 return TRUE;
783 }
784 }
785 return FALSE;
786}
unsigned char BOOLEAN
Status
Definition: gdiplustypes.h:25
@ Input
Definition: arc.h:84

Referenced by i8042KbdInterruptService().

◆ i8042KbdDeviceControl()

NTSTATUS NTAPI i8042KbdDeviceControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 384 of file keyboard.c.

387{
389 PI8042_KEYBOARD_EXTENSION DeviceExtension;
391
393 Irp->IoStatus.Information = 0;
394 DeviceExtension = (PI8042_KEYBOARD_EXTENSION)DeviceObject->DeviceExtension;
395
396 switch (Stack->Parameters.DeviceIoControl.IoControlCode)
397 {
399 {
400 /* Part of GUID_DEVICE_SYS_BUTTON interface */
401 PULONG pCaps;
402 TRACE_(I8042PRT, "IOCTL_GET_SYS_BUTTON_CAPS\n");
403
404 if (Stack->Parameters.DeviceIoControl.OutputBufferLength != sizeof(ULONG))
406 else
407 {
408 pCaps = (PULONG)Irp->AssociatedIrp.SystemBuffer;
409 *pCaps = DeviceExtension->NewCaps;
410 DeviceExtension->ReportedCaps = DeviceExtension->NewCaps;
411 Irp->IoStatus.Information = sizeof(ULONG);
413 }
414 break;
415 }
417 {
418 /* Part of GUID_DEVICE_SYS_BUTTON interface */
419 PIRP WaitingIrp;
420 TRACE_(I8042PRT, "IOCTL_GET_SYS_BUTTON_EVENT\n");
421
422 if (Stack->Parameters.DeviceIoControl.OutputBufferLength != sizeof(ULONG))
424 else
425 {
427 (PVOID)&DeviceExtension->PowerIrp,
428 Irp,
429 NULL);
430 /* Check if an Irp is already pending */
431 if (WaitingIrp)
432 {
433 /* Unable to have a 2nd pending IRP for this IOCTL */
434 WARN_(I8042PRT, "Unable to pend a second IRP for IOCTL_GET_SYS_BUTTON_EVENT\n");
436 Irp->IoStatus.Status = Status;
438 }
439 else
440 {
441 ULONG PowerKey;
442 PowerKey = InterlockedExchange((PLONG)&DeviceExtension->LastPowerKey, 0);
443 if (PowerKey != 0)
444 {
446 *(PULONG)Irp->AssociatedIrp.SystemBuffer = PowerKey;
448 Irp->IoStatus.Status = Status;
449 Irp->IoStatus.Information = sizeof(ULONG);
451 }
452 else
453 {
454 TRACE_(I8042PRT, "Pending IOCTL_GET_SYS_BUTTON_EVENT\n");
456 Irp->IoStatus.Status = Status;
458 }
459 }
460 return Status;
461 }
462 break;
463 }
464 default:
465 {
466 ERR_(I8042PRT, "IRP_MJ_DEVICE_CONTROL / unknown ioctl code 0x%lx\n",
467 Stack->Parameters.DeviceIoControl.IoControlCode);
469 }
470 }
471
472 if (Status != STATUS_PENDING)
473 {
474 Irp->IoStatus.Status = Status;
476 }
477
478 return Status;
479}
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
#define VOID
Definition: acefi.h:82
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define TRACE_(x)
Definition: compat.h:76
switch(r->id)
Definition: btrfs.c:3046
struct _I8042_KEYBOARD_EXTENSION * PI8042_KEYBOARD_EXTENSION
Definition: i8042prt.h:63
DRIVER_DISPATCH ForwardIrpAndForget
Definition: i8042prt.h:341
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
IoMarkIrpPending(Irp)
#define IoCompleteRequest
Definition: irp.c:1240
#define STATUS_PENDING
Definition: ntstatus.h:82
#define IOCTL_GET_SYS_BUTTON_CAPS
Definition: poclass.h:59
#define IOCTL_GET_SYS_BUTTON_EVENT
Definition: poclass.h:62
#define ERR_(ch,...)
Definition: debug.h:156
#define WARN_(ch,...)
Definition: debug.h:157
#define STATUS_SUCCESS
Definition: shellext.h:65
uint32_t * PULONG
Definition: typedefs.h:59
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
#define IO_NO_INCREMENT
Definition: iotypes.h:598

◆ i8042KbdDpcRoutine()

static VOID NTAPI i8042KbdDpcRoutine ( IN PKDPC  Dpc,
IN PVOID  DeferredContext,
IN PVOID  SystemArgument1,
IN PVOID  SystemArgument2 
)
static

Definition at line 320 of file keyboard.c.

325{
326 PI8042_KEYBOARD_EXTENSION DeviceExtension;
327 PPORT_DEVICE_EXTENSION PortDeviceExtension;
328 ULONG KeysTransferred = 0;
329 ULONG KeysInBufferCopy;
330 KIRQL Irql;
331
335
337 DeviceExtension = DeferredContext;
338 PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension;
339
340 if (HandlePowerKeys(DeviceExtension))
341 {
342 DeviceExtension->KeyComplete = FALSE;
343 return;
344 }
345
346 i8042PacketDpc(PortDeviceExtension);
347 if (!DeviceExtension->KeyComplete)
348 return;
349 /* We got the interrupt as it was being enabled, too bad */
350 if (!PortDeviceExtension->HighestDIRQLInterrupt)
351 return;
352
354
355 DeviceExtension->KeyComplete = FALSE;
356 KeysInBufferCopy = DeviceExtension->KeysInBuffer;
357
359
360 TRACE_(I8042PRT, "Send a key\n");
361
362 if (!DeviceExtension->KeyboardData.ClassService)
363 return;
364
365 INFO_(I8042PRT, "Sending %lu key(s)\n", KeysInBufferCopy);
367 DeviceExtension->KeyboardData.ClassDeviceObject,
368 DeviceExtension->KeyboardBuffer,
369 DeviceExtension->KeyboardBuffer + KeysInBufferCopy,
370 &KeysTransferred);
371
372 /* Validate that the callback didn't change the Irql. */
374
376 DeviceExtension->KeysInBuffer -= KeysTransferred;
378}
_Out_ PKIRQL Irql
Definition: csq.h:179
static BOOLEAN HandlePowerKeys(IN PI8042_KEYBOARD_EXTENSION DeviceExtension)
Definition: keyboard.c:279
static VOID i8042PacketDpc(IN PPORT_DEVICE_EXTENSION DeviceExtension)
Definition: keyboard.c:154
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
VOID(STDAPICALLTYPE * PSERVICE_CALLBACK_ROUTINE)(IN PVOID NormalContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2, IN OUT PVOID SystemArgument3)
Definition: kbdmou.h:86
#define ASSERT(a)
Definition: mode.c:44
#define __analysis_assume(expr)
Definition: ms_sal.h:2893
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
KIRQL NTAPI KeAcquireInterruptSpinLock(IN PKINTERRUPT Interrupt)
Definition: spinlock.c:154
VOID NTAPI KeReleaseInterruptSpinLock(IN PKINTERRUPT Interrupt, IN KIRQL OldIrql)
Definition: spinlock.c:171
#define INFO_(ch,...)
Definition: debug.h:159
PVOID ClassService
Definition: kbdmou.h:82
PDEVICE_OBJECT ClassDeviceObject
Definition: kbdmou.h:81
CONNECT_DATA KeyboardData
Definition: i8042prt.h:140
PKEYBOARD_INPUT_DATA KeyboardBuffer
Definition: i8042prt.h:150
PKINTERRUPT HighestDIRQLInterrupt
Definition: i8042prt.h:88
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
Definition: wdfdpc.h:112
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
Definition: ketypes.h:688
_In_opt_ PVOID DeferredContext
Definition: ketypes.h:687
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
Definition: ketypes.h:689

◆ i8042KbdInternalDeviceControl()

NTSTATUS NTAPI i8042KbdInternalDeviceControl ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 513 of file keyboard.c.

516{
518 PI8042_KEYBOARD_EXTENSION DeviceExtension;
520
522 Irp->IoStatus.Information = 0;
523 DeviceExtension = (PI8042_KEYBOARD_EXTENSION)DeviceObject->DeviceExtension;
524
525 switch (Stack->Parameters.DeviceIoControl.IoControlCode)
526 {
528 {
529 SIZE_T Size;
531 PI8042_HOOK_WORKITEM WorkItemData = NULL;
532
533 TRACE_(I8042PRT, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_KEYBOARD_CONNECT\n");
534 if (Stack->Parameters.DeviceIoControl.InputBufferLength != sizeof(CONNECT_DATA))
535 {
537 goto cleanup;
538 }
539
540 DeviceExtension->KeyboardData =
541 *((PCONNECT_DATA)Stack->Parameters.DeviceIoControl.Type3InputBuffer);
542
543 /* Send IOCTL_INTERNAL_I8042_HOOK_KEYBOARD to device stack */
545 if (!WorkItem)
546 {
547 WARN_(I8042PRT, "IoAllocateWorkItem() failed\n");
549 goto cleanup;
550 }
551 WorkItemData = ExAllocatePoolWithTag(
553 sizeof(I8042_HOOK_WORKITEM),
555 if (!WorkItemData)
556 {
557 WARN_(I8042PRT, "ExAllocatePoolWithTag() failed\n");
559 goto cleanup;
560 }
561 WorkItemData->WorkItem = WorkItem;
562 WorkItemData->Irp = Irp;
563
564 /* Initialize extension */
565 DeviceExtension->Common.Type = Keyboard;
567 DeviceExtension->KeyboardBuffer = ExAllocatePoolWithTag(
569 Size,
571 if (!DeviceExtension->KeyboardBuffer)
572 {
573 WARN_(I8042PRT, "ExAllocatePoolWithTag() failed\n");
575 goto cleanup;
576 }
577 RtlZeroMemory(DeviceExtension->KeyboardBuffer, Size);
579 &DeviceExtension->DpcKeyboard,
581 DeviceExtension);
583 if (!DeviceExtension->PowerWorkItem)
584 {
585 WARN_(I8042PRT, "IoAllocateWorkItem() failed\n");
587 goto cleanup;
588 }
590 if (!DeviceExtension->DebugWorkItem)
591 {
592 WARN_(I8042PRT, "IoAllocateWorkItem() failed\n");
594 goto cleanup;
595 }
596 DeviceExtension->Common.PortDeviceExtension->KeyboardExtension = DeviceExtension;
598
599 i8042InitializeKeyboardAttributes(DeviceExtension);
600
602 /* FIXME: DeviceExtension->KeyboardHook.IsrWritePort = ; */
604 DeviceExtension->KeyboardHook.CallContext = DeviceExtension;
608 WorkItemData);
610 break;
611
612cleanup:
613 if (DeviceExtension->KeyboardBuffer)
615 if (DeviceExtension->PowerWorkItem)
616 IoFreeWorkItem(DeviceExtension->PowerWorkItem);
617 if (DeviceExtension->DebugWorkItem)
618 IoFreeWorkItem(DeviceExtension->DebugWorkItem);
619 if (WorkItem)
621 if (WorkItemData)
622 ExFreePoolWithTag(WorkItemData, I8042PRT_TAG);
623 break;
624 }
626 {
627 TRACE_(I8042PRT, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_KEYBOARD_DISCONNECT\n");
628 /* MSDN says that operation is to implemented.
629 * To implement it, we just have to do:
630 * DeviceExtension->KeyboardData.ClassService = NULL;
631 */
633 break;
634 }
636 {
637 TRACE_(I8042PRT, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_INTERNAL_I8042_HOOK_KEYBOARD\n");
638 /* Nothing to do here */
640 break;
641 }
643 {
644 PKEYBOARD_ATTRIBUTES KeyboardAttributes;
645
646 /* FIXME: KeyboardAttributes are not initialized anywhere */
647 TRACE_(I8042PRT, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_KEYBOARD_QUERY_ATTRIBUTES\n");
648 if (Stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_ATTRIBUTES))
649 {
651 break;
652 }
653
654 KeyboardAttributes = Irp->AssociatedIrp.SystemBuffer;
655 *KeyboardAttributes = DeviceExtension->KeyboardAttributes;
656
657 Irp->IoStatus.Information = sizeof(KEYBOARD_ATTRIBUTES);
659 break;
660 }
662 {
663 DPRINT1("IOCTL_KEYBOARD_QUERY_TYPEMATIC not implemented\n");
665 break;
666 }
668 {
669 DPRINT1("IOCTL_KEYBOARD_SET_TYPEMATIC not implemented\n");
671 break;
672 }
674 {
675 TRACE_(I8042PRT, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION\n");
676
677 /* We should check the UnitID, but it's kind of pointless as
678 * all keyboards are supposed to have the same one
679 */
680 if (Stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION))
681 {
683 }
684 else
685 {
687 Irp->AssociatedIrp.SystemBuffer,
690 Irp->IoStatus.Information = sizeof(LOCAL_KEYBOARD_INDICATOR_TRANSLATION);
692 }
693 break;
694 }
696 {
697 TRACE_(I8042PRT, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_KEYBOARD_QUERY_INDICATORS\n");
698
699 if (Stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS))
700 {
702 }
703 else
704 {
706 Irp->AssociatedIrp.SystemBuffer,
707 &DeviceExtension->KeyboardIndicators,
709 Irp->IoStatus.Information = sizeof(KEYBOARD_INDICATOR_PARAMETERS);
711 }
712 break;
713 }
715 {
716 TRACE_(I8042PRT, "IRP_MJ_INTERNAL_DEVICE_CONTROL / IOCTL_KEYBOARD_SET_INDICATORS\n");
717
718 if (Stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(KEYBOARD_INDICATOR_PARAMETERS))
719 {
721 }
722 else
723 {
725 &DeviceExtension->KeyboardIndicators,
726 Irp->AssociatedIrp.SystemBuffer,
731 }
732 break;
733 }
734 default:
735 {
736 ERR_(I8042PRT, "IRP_MJ_INTERNAL_DEVICE_CONTROL / unknown ioctl code 0x%lx\n",
737 Stack->Parameters.DeviceIoControl.IoControlCode);
738 ASSERT(FALSE);
740 }
741 }
742
743 if (Status != STATUS_PENDING)
744 {
745 Irp->IoStatus.Status = Status;
747 }
748 return Status;
749}
#define DPRINT1
Definition: precomp.h:8
static void cleanup(void)
Definition: main.c:1335
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
Definition: dpc.c:712
static VOID NTAPI i8042KbdQueuePacket(IN PVOID Context)
Definition: keyboard.c:63
struct _LOCAL_KEYBOARD_INDICATOR_TRANSLATION LOCAL_KEYBOARD_INDICATOR_TRANSLATION
static KDEFERRED_ROUTINE i8042KbdDpcRoutine
Definition: keyboard.c:24
VOID NTAPI i8042InitializeKeyboardAttributes(PI8042_KEYBOARD_EXTENSION DeviceExtension)
Definition: keyboard.c:483
static LOCAL_KEYBOARD_INDICATOR_TRANSLATION IndicatorTranslation
Definition: keyboard.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
#define KEYBOARD_CONNECTED
Definition: i8042prt.h:69
IO_WORKITEM_ROUTINE i8042SendHookWorkItem
Definition: i8042prt.h:295
@ Keyboard
Definition: i8042prt.h:115
#define I8042PRT_TAG
Definition: i8042prt.h:12
VOID NTAPI IoFreeWorkItem(IN PIO_WORKITEM IoWorkItem)
Definition: iowork.c:64
PIO_WORKITEM NTAPI IoAllocateWorkItem(IN PDEVICE_OBJECT DeviceObject)
Definition: iowork.c:75
struct _CONNECT_DATA * PCONNECT_DATA
#define IOCTL_INTERNAL_KEYBOARD_CONNECT
Definition: kbdmou.h:56
#define IOCTL_INTERNAL_KEYBOARD_DISCONNECT
Definition: kbdmou.h:59
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define IOCTL_INTERNAL_I8042_HOOK_KEYBOARD
Definition: ntdd8042.h:36
struct _KEYBOARD_INPUT_DATA KEYBOARD_INPUT_DATA
#define IOCTL_KEYBOARD_QUERY_TYPEMATIC
Definition: ntddkbd.h:41
#define IOCTL_KEYBOARD_QUERY_INDICATORS
Definition: ntddkbd.h:35
#define IOCTL_KEYBOARD_SET_INDICATORS
Definition: ntddkbd.h:47
#define IOCTL_KEYBOARD_QUERY_ATTRIBUTES
Definition: ntddkbd.h:32
#define IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION
Definition: ntddkbd.h:38
#define IOCTL_KEYBOARD_SET_TYPEMATIC
Definition: ntddkbd.h:44
struct _KEYBOARD_ATTRIBUTES KEYBOARD_ATTRIBUTES
struct _KEYBOARD_INDICATOR_PARAMETERS KEYBOARD_INDICATOR_PARAMETERS
VOID NTAPI IoStartPacket(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PULONG Key, IN PDRIVER_CANCEL CancelFunction)
Definition: device.c:1876
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
I8042_DEVICE_TYPE Type
Definition: i8042prt.h:122
PIO_WORKITEM WorkItem
Definition: i8042prt.h:203
PIO_WORKITEM DebugWorkItem
Definition: i8042prt.h:163
INTERNAL_I8042_HOOK_KEYBOARD KeyboardHook
Definition: i8042prt.h:141
KEYBOARD_INDICATOR_PARAMETERS KeyboardIndicators
Definition: i8042prt.h:146
PIO_WORKITEM PowerWorkItem
Definition: i8042prt.h:158
ULONG KeyboardDataQueueSize
Definition: i8042prt.h:26
IN PI8042_QUEUE_PACKET QueueKeyboardPacket
Definition: ntdd8042.h:181
PI8042_KEYBOARD_EXTENSION KeyboardExtension
Definition: i8042prt.h:84
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
_Must_inspect_result_ _In_ PWDF_WORKITEM_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWORKITEM * WorkItem
Definition: wdfworkitem.h:115

◆ i8042KbdInterruptService()

BOOLEAN NTAPI i8042KbdInterruptService ( IN PKINTERRUPT  Interrupt,
PVOID  Context 
)

Definition at line 789 of file keyboard.c.

792{
793 PI8042_KEYBOARD_EXTENSION DeviceExtension;
794 PPORT_DEVICE_EXTENSION PortDeviceExtension;
795 PKEYBOARD_INPUT_DATA InputData;
797 UCHAR PortStatus = 0, Output = 0;
798 BOOLEAN ToReturn = FALSE;
800
802
804 DeviceExtension = Context;
805 PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension;
806 InputData = DeviceExtension->KeyboardBuffer + DeviceExtension->KeysInBuffer;
807 Counter = PortDeviceExtension->Settings.PollStatusIterations;
808
809 while (Counter)
810 {
811 Status = i8042ReadStatus(PortDeviceExtension, &PortStatus);
812 if (!NT_SUCCESS(Status))
813 {
814 WARN_(I8042PRT, "i8042ReadStatus() failed with status 0x%08lx\n", Status);
815 return FALSE;
816 }
817 Status = i8042ReadKeyboardData(PortDeviceExtension, &Output);
818 if (NT_SUCCESS(Status))
819 break;
821 Counter--;
822 }
823 if (Counter == 0)
824 {
825 WARN_(I8042PRT, "Spurious i8042 keyboard interrupt\n");
826 return FALSE;
827 }
828
829 INFO_(I8042PRT, "Got: 0x%02x\n", Output);
830
831 if (PortDeviceExtension->Settings.CrashOnCtrlScroll)
832 {
833 /* Test for CTRL + SCROLL LOCK twice */
834 static const UCHAR ScanCodes[] = { 0x1d, 0x46, 0xc6, 0x46, 0 };
835
836 if (Output == ScanCodes[DeviceExtension->ComboPosition])
837 {
838 DeviceExtension->ComboPosition++;
839 if (ScanCodes[DeviceExtension->ComboPosition] == 0)
840 KeBugCheck(MANUALLY_INITIATED_CRASH);
841 }
842 else if (Output == 0xfa)
843 {
844 /* Ignore ACK */
845 }
846 else if (Output == ScanCodes[0])
847 DeviceExtension->ComboPosition = 1;
848 else
849 DeviceExtension->ComboPosition = 0;
850
851 /* Test for TAB + key combination */
852 if (InputData->MakeCode == 0x0F)
853 DeviceExtension->TabPressed = !(InputData->Flags & KEY_BREAK);
854 else if (DeviceExtension->TabPressed)
855 {
856 DeviceExtension->TabPressed = FALSE;
857
858 /* Check which action to do */
859 if (InputData->MakeCode == 0x25)
860 {
861 /* k - Breakpoint */
863 }
864 else if (InputData->MakeCode == 0x30)
865 {
866 /* b - Bugcheck */
867 KeBugCheck(MANUALLY_INITIATED_CRASH);
868 }
869 else
870 {
871 /* Send request to the kernel debugger.
872 * Unknown requests will be ignored. */
874 (PVOID)(ULONG_PTR)InputData->MakeCode,
875 0,
876 NULL,
877 0,
878 NULL,
879 KernelMode);
880 }
881 }
882 }
883
884 if (i8042KbdCallIsrHook(DeviceExtension, PortStatus, Output, &ToReturn))
885 return ToReturn;
886
887 if (i8042PacketIsr(PortDeviceExtension, Output))
888 {
889 if (PortDeviceExtension->PacketComplete)
890 {
891 TRACE_(I8042PRT, "Packet complete\n");
892 KeInsertQueueDpc(&DeviceExtension->DpcKeyboard, NULL, NULL);
893 }
894 TRACE_(I8042PRT, "Irq eaten by packet\n");
895 return TRUE;
896 }
897
898 TRACE_(I8042PRT, "Irq is keyboard input\n");
899
900 if (DeviceExtension->KeyboardScanState == Normal)
901 {
902 switch (Output)
903 {
904 case 0xe0:
905 DeviceExtension->KeyboardScanState = GotE0;
906 return TRUE;
907 case 0xe1:
908 DeviceExtension->KeyboardScanState = GotE1;
909 return TRUE;
910 default:
911 break;
912 }
913 }
914
915 /* Update InputData */
916 InputData->Flags = 0;
917 switch (DeviceExtension->KeyboardScanState)
918 {
919 case GotE0:
920 InputData->Flags |= KEY_E0;
921 break;
922 case GotE1:
923 InputData->Flags |= KEY_E1;
924 break;
925 default:
926 break;
927 }
928 DeviceExtension->KeyboardScanState = Normal;
929 if (Output & 0x80)
930 InputData->Flags |= KEY_BREAK;
931 else
932 InputData->Flags |= KEY_MAKE;
933 InputData->MakeCode = Output & 0x7f;
934 InputData->Reserved = 0;
935
936 DeviceExtension->KeyboardHook.QueueKeyboardPacket(DeviceExtension->KeyboardHook.CallContext);
937
938 return TRUE;
939}
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
Definition: bug.c:1430
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
BOOLEAN NTAPI KeInsertQueueDpc(IN PKDPC Dpc, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
Definition: dpc.c:725
static BOOLEAN i8042KbdCallIsrHook(IN PI8042_KEYBOARD_EXTENSION DeviceExtension, IN UCHAR Status, IN UCHAR Input, OUT PBOOLEAN ToReturn)
Definition: keyboard.c:758
_Outptr_ PUSB_DEVICE_HANDLE _In_ PUSB_DEVICE_HANDLE _In_ USHORT PortStatus
Definition: hubbusif.h:42
BOOLEAN i8042PacketIsr(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR Output)
Definition: i8042prt.c:271
NTSTATUS i8042ReadStatus(IN PPORT_DEVICE_EXTENSION DeviceExtension, OUT PUCHAR Status)
Definition: readwrite.c:82
#define i8042ReadKeyboardData(DeviceExtension, Data)
Definition: i8042prt.h:403
NTSTATUS NTAPI KdSystemDebugControl(_In_ SYSDBG_COMMAND Command, _In_ PVOID InputBuffer, _In_ ULONG InputBufferLength, _Out_ PVOID OutputBuffer, _In_ ULONG OutputBufferLength, _Inout_ PULONG ReturnLength, _In_ KPROCESSOR_MODE PreviousMode)
Definition: kdapi.c:2183
#define KeStallExecutionProcessor(MicroSeconds)
Definition: precomp.h:27
#define KernelMode
Definition: asm.h:34
#define DBG_STATUS_SYSRQ
Definition: kdtypes.h:40
@ GotE0
Definition: ntdd8042.h:75
@ GotE1
Definition: ntdd8042.h:76
#define KEY_E1
Definition: ntddkbd.h:73
#define KEY_MAKE
Definition: ntddkbd.h:70
@ Normal
Definition: sacdrv.h:1378
@ Output
Definition: arc.h:85
KEYBOARD_SCAN_STATE KeyboardScanState
Definition: i8042prt.h:148
ULONG CrashOnCtrlScroll
Definition: i8042prt.h:40
ULONG PollStatusIterations
Definition: i8042prt.h:33
BOOLEAN PacketComplete
Definition: i8042prt.h:94
static LARGE_INTEGER Counter
Definition: clock.c:43
uint32_t ULONG_PTR
Definition: typedefs.h:65
__analysis_noreturn NTSYSAPI VOID NTAPI DbgBreakPointWithStatus(_In_ ULONG Status)
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_INTERRUPT_CONFIG _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFINTERRUPT * Interrupt
Definition: wdfinterrupt.h:379

◆ i8042KbdQueuePacket()

static VOID NTAPI i8042KbdQueuePacket ( IN PVOID  Context)
static

Definition at line 63 of file keyboard.c.

65{
66 PI8042_KEYBOARD_EXTENSION DeviceExtension;
67
68 DeviceExtension = (PI8042_KEYBOARD_EXTENSION)Context;
69
70 DeviceExtension->KeyComplete = TRUE;
71 DeviceExtension->KeysInBuffer++;
72 if (DeviceExtension->KeysInBuffer > DeviceExtension->Common.PortDeviceExtension->Settings.KeyboardDataQueueSize)
73 {
74 WARN_(I8042PRT, "Keyboard buffer overflow\n");
75 DeviceExtension->KeysInBuffer--;
76 }
77
78 TRACE_(I8042PRT, "Irq completes key\n");
79 KeInsertQueueDpc(&DeviceExtension->DpcKeyboard, NULL, NULL);
80}

Referenced by i8042KbdInternalDeviceControl().

◆ i8042KbdStartIo()

VOID NTAPI i8042KbdStartIo ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp 
)

Definition at line 103 of file keyboard.c.

106{
108 PI8042_KEYBOARD_EXTENSION DeviceExtension;
109 PPORT_DEVICE_EXTENSION PortDeviceExtension;
110
112 DeviceExtension = (PI8042_KEYBOARD_EXTENSION)DeviceObject->DeviceExtension;
113 PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension;
114
115 switch (Stack->Parameters.DeviceIoControl.IoControlCode)
116 {
118 {
119 TRACE_(I8042PRT, "IOCTL_KEYBOARD_SET_INDICATORS\n");
120 INFO_(I8042PRT, "Leds: {%s%s%s }\n",
121 DeviceExtension->KeyboardIndicators.LedFlags & KEYBOARD_CAPS_LOCK_ON ? " CAPSLOCK" : "",
122 DeviceExtension->KeyboardIndicators.LedFlags & KEYBOARD_NUM_LOCK_ON ? " NUMLOCK" : "",
123 DeviceExtension->KeyboardIndicators.LedFlags & KEYBOARD_SCROLL_LOCK_ON ? " SCROLLLOCK" : "");
124
125 PortDeviceExtension->PacketBuffer[0] = KBD_CMD_SET_LEDS;
126 PortDeviceExtension->PacketBuffer[1] = 0;
128 PortDeviceExtension->PacketBuffer[1] |= KBD_LED_CAPS;
129
130 if (DeviceExtension->KeyboardIndicators.LedFlags & KEYBOARD_NUM_LOCK_ON)
131 PortDeviceExtension->PacketBuffer[1] |= KBD_LED_NUM;
132
134 PortDeviceExtension->PacketBuffer[1] |= KBD_LED_SCROLL;
135
137 PortDeviceExtension,
138 &DeviceExtension->Common,
139 PortDeviceExtension->PacketBuffer,
140 2,
141 Irp);
142 break;
143 }
144 default:
145 {
146 ERR_(I8042PRT, "Unknown ioctl code 0x%lx\n",
147 Stack->Parameters.DeviceIoControl.IoControlCode);
148 ASSERT(FALSE);
149 }
150 }
151}
NTSTATUS i8042StartPacket(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN PFDO_DEVICE_EXTENSION FdoDeviceExtension, IN PUCHAR Bytes, IN ULONG ByteCount, IN PIRP Irp)
Definition: i8042prt.c:329
#define KBD_LED_CAPS
Definition: i8042prt.h:272
#define KBD_LED_SCROLL
Definition: i8042prt.h:270
#define KBD_CMD_SET_LEDS
Definition: i8042prt.h:234
#define KBD_LED_NUM
Definition: i8042prt.h:271
#define KEYBOARD_CAPS_LOCK_ON
Definition: ntddkbd.h:81
#define KEYBOARD_SCROLL_LOCK_ON
Definition: ntddkbd.h:83
#define KEYBOARD_NUM_LOCK_ON
Definition: ntddkbd.h:82
UCHAR PacketBuffer[16]
Definition: i8042prt.h:96

◆ i8042PacketDpc()

static VOID i8042PacketDpc ( IN PPORT_DEVICE_EXTENSION  DeviceExtension)
static

Definition at line 154 of file keyboard.c.

156{
157 BOOLEAN FinishIrp = FALSE;
158 KIRQL Irql;
159 NTSTATUS Result = STATUS_INTERNAL_ERROR; /* Shouldn't happen */
160
161 /* If the interrupt happens before this is setup, the key
162 * was already in the buffer. Too bad! */
163 if (!DeviceExtension->HighestDIRQLInterrupt)
164 return;
165
166 Irql = KeAcquireInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt);
167
168 if (DeviceExtension->Packet.State == Idle
169 && DeviceExtension->PacketComplete)
170 {
171 FinishIrp = TRUE;
172 Result = DeviceExtension->PacketResult;
173 DeviceExtension->PacketComplete = FALSE;
174 }
175
176 KeReleaseInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt, Irql);
177
178 if (!FinishIrp)
179 return;
180
181 if (DeviceExtension->CurrentIrp)
182 {
183 DeviceExtension->CurrentIrp->IoStatus.Status = Result;
184 IoCompleteRequest(DeviceExtension->CurrentIrp, IO_NO_INCREMENT);
185 IoStartNextPacket(DeviceExtension->CurrentIrpDevice, FALSE);
186 DeviceExtension->CurrentIrp = NULL;
187 DeviceExtension->CurrentIrpDevice = NULL;
188 }
189}
@ Idle
Definition: ntdd8042.h:62
VOID NTAPI IoStartNextPacket(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN Cancelable)
Definition: device.c:1847
#define STATUS_INTERNAL_ERROR
Definition: ntstatus.h:465
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409

Referenced by i8042KbdDpcRoutine().

◆ i8042PowerWorkItem()

static VOID NTAPI i8042PowerWorkItem ( IN PDEVICE_OBJECT  DeviceObject,
IN PVOID  Context 
)
static

Definition at line 192 of file keyboard.c.

195{
196 PI8042_KEYBOARD_EXTENSION DeviceExtension;
197 PIRP WaitingIrp;
199
201
203 DeviceExtension = Context;
204
205 /* See http://blogs.msdn.com/doronh/archive/2006/09/08/746961.aspx */
206
207 /* Register GUID_DEVICE_SYS_BUTTON interface and report capability */
208 if (DeviceExtension->NewCaps != DeviceExtension->ReportedCaps)
209 {
210 WaitingIrp = InterlockedExchangePointer((PVOID)&DeviceExtension->PowerIrp, NULL);
211 if (WaitingIrp)
212 {
213 /* Cancel the current power irp, as capability changed */
214 WaitingIrp->IoStatus.Status = STATUS_UNSUCCESSFUL;
215 WaitingIrp->IoStatus.Information = sizeof(ULONG);
217 }
218
219 if (DeviceExtension->PowerInterfaceName.MaximumLength == 0)
220 {
221 /* We have never registered this interface ; do it */
223 DeviceExtension->Common.Pdo,
224 &GUID_DEVICE_SYS_BUTTON,
225 NULL,
226 &DeviceExtension->PowerInterfaceName);
227 if (!NT_SUCCESS(Status))
228 {
229 /* We can't do more yet, ignore the keypress... */
230 WARN_(I8042PRT, "IoRegisterDeviceInterface(GUID_DEVICE_SYS_BUTTON) failed with status 0x%08lx\n",
231 Status);
232 DeviceExtension->PowerInterfaceName.MaximumLength = 0;
233 return;
234 }
235 }
236 else
237 {
238 /* Disable the interface. Once activated again, capabilities would be asked again */
240 &DeviceExtension->PowerInterfaceName,
241 FALSE);
242 if (!NT_SUCCESS(Status))
243 {
244 /* Ignore the key press... */
245 WARN_(I8042PRT, "Disabling interface %wZ failed with status 0x%08lx\n",
246 &DeviceExtension->PowerInterfaceName, Status);
247 return;
248 }
249 }
250 /* Enable the interface. This leads to receiving a IOCTL_GET_SYS_BUTTON_CAPS,
251 * so we can report new capability */
253 &DeviceExtension->PowerInterfaceName,
254 TRUE);
255 if (!NT_SUCCESS(Status))
256 {
257 /* Ignore the key press... */
258 WARN_(I8042PRT, "Enabling interface %wZ failed with status 0x%08lx\n",
259 &DeviceExtension->PowerInterfaceName, Status);
260 return;
261 }
262 }
263
264 /* Directly complete the IOCTL_GET_SYS_BUTTON_EVENT Irp (if any) */
265 WaitingIrp = InterlockedExchangePointer((PVOID)&DeviceExtension->PowerIrp, NULL);
266 if (WaitingIrp)
267 {
268 PULONG pEvent = (PULONG)WaitingIrp->AssociatedIrp.SystemBuffer;
269
270 WaitingIrp->IoStatus.Status = STATUS_SUCCESS;
271 WaitingIrp->IoStatus.Information = sizeof(ULONG);
272 *pEvent = InterlockedExchange((PLONG)&DeviceExtension->LastPowerKey, 0);
274 }
275}
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
NTSTATUS NTAPI IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, IN CONST GUID *InterfaceClassGuid, IN PUNICODE_STRING ReferenceString OPTIONAL, OUT PUNICODE_STRING SymbolicLinkName)
Definition: deviface.c:955
NTSTATUS NTAPI IoSetDeviceInterfaceState(IN PUNICODE_STRING SymbolicLinkName, IN BOOLEAN Enable)
Definition: deviface.c:1311
PDEVICE_OBJECT Pdo
Definition: i8042prt.h:128
UNICODE_STRING PowerInterfaceName
Definition: i8042prt.h:157
union _IRP::@1577 AssociatedIrp
PVOID SystemBuffer
IO_STATUS_BLOCK IoStatus
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132

◆ i8042SynchWritePortKbd()

NTSTATUS NTAPI i8042SynchWritePortKbd ( IN PVOID  Context,
IN UCHAR  Value,
IN BOOLEAN  WaitForAck 
)

Definition at line 87 of file keyboard.c.

91{
94 0,
95 Value,
96 WaitForAck);
97}
NTSTATUS NTAPI i8042SynchWritePort(IN PPORT_DEVICE_EXTENSION DeviceExtension, IN UCHAR Port, IN UCHAR Value, IN BOOLEAN WaitForAck)
Definition: readwrite.c:144
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413

Referenced by i8042SendHookWorkItem().

Variable Documentation

◆ i8042KbdDpcRoutine

KDEFERRED_ROUTINE i8042KbdDpcRoutine
static

Definition at line 24 of file keyboard.c.

Referenced by i8042KbdInternalDeviceControl().

◆ i8042PowerWorkItem

IO_WORKITEM_ROUTINE i8042PowerWorkItem
static

Definition at line 23 of file keyboard.c.

Referenced by HandlePowerKeys().

◆ IndicatorTranslation

LOCAL_KEYBOARD_INDICATOR_TRANSLATION IndicatorTranslation
static
Initial value:

Definition at line 32 of file keyboard.c.

Referenced by i8042KbdInternalDeviceControl().