2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
5 * PURPOSE: Keyboard emulation
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
9 /* INCLUDES *******************************************************************/
17 /* PRIVATE VARIABLES **********************************************************/
19 static BYTE PS2Port
= 0;
21 /* PRIVATE FUNCTIONS **********************************************************/
23 static VOID WINAPI
KeyboardCommand(LPVOID Param
, BYTE Command
)
28 /* PUBLIC FUNCTIONS ***********************************************************/
30 VOID
KeyboardEventHandler(PKEY_EVENT_RECORD KeyEvent
)
33 BYTE ScanCode
= (BYTE
)KeyEvent
->wVirtualScanCode
;
35 /* If this is a key release, set the highest bit in the scan code */
36 if (!KeyEvent
->bKeyDown
) ScanCode
|= 0x80;
38 /* Push the scan code into the PS/2 queue */
39 for (i
= 0; i
< KeyEvent
->wRepeatCount
; i
++)
41 PS2QueuePush(PS2Port
, ScanCode
);
44 DPRINT("Press 0x%X\n", ScanCode
);
47 BOOLEAN
KeyboardInit(BYTE PS2Connector
)
49 /* Finish to plug the keyboard to the specified PS/2 port */
50 PS2Port
= PS2Connector
;
51 PS2SetDeviceCmdProc(PS2Port
, NULL
, KeyboardCommand
);