KeyboardImpl.cpp revision 390b6e3a16f6886c75ddcd7d94481b4065bc1e85
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * VBox frontends: Basic Frontend (BFE):
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Implementation of Keyboard class and related things
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * available from http://www.virtualbox.org. This file is free software;
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * you can redistribute it and/or modify it under the terms of the GNU
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * General Public License (GPL) as published by the Free Software
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * additional information or have any questions.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync//# include <VBox/com/array.h>
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync////////////////////////////////////////////////////////////////////////////////
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync////////////////////////////////////////////////////////////////////////////////
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Keyboard driver instance data.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Pointer to the keyboard object. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Pointer to the driver instance structure. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Pointer to the keyboard port interface of the driver/device above us. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /** Our mouse connector interface. */
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync// constructor / destructor
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync////////////////////////////////////////////////////////////////////////////////
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync// public methods
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync////////////////////////////////////////////////////////////////////////////////
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Sends a scancode to the keyboard.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @returns COM status code
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param scancode The scancode to send
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync int rcVBox = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)scancode);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Sends a list of scancodes to the keyboard.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @returns COM status code
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param scancodes Safe array of scancodes
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @param codesStored Address of variable to store the number
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * of scancodes that were sent to the keyboard.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync This value can be NULL.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsyncSTDMETHODIMP Keyboard::PutScancodes(ComSafeArrayIn (LONG, scancodes),
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync com::SafeArray <LONG> keys(ComSafeArrayInArg(scancodes));
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync for (uint32_t i = 0; (i < keys.size()) && VBOX_SUCCESS(rcVBox); i++)
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync rcVBox = mpDrv->pUpPort->pfnPutEvent(mpDrv->pUpPort, (uint8_t)keys[i]);
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync /// @todo is it actually possible that not all scancodes can be transmitted?
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * Sends Control-Alt-Delete to the keyboard. This could be done otherwise
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * but it's so common that we'll be nice and supply a convenience API.
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync * @returns COM status code
0b74a2f80aba476dc8be8bc1c63891fc53945986vboxsync return PutScancodes (ComSafeArrayAsInParam(cadSequence), NULL);
switch (enmInterface)
case PDMINTERFACE_BASE:
return NULL;
return VERR_PDM_DRVINS_NO_ATTACH;
pData->pUpPort = (PPDMIKEYBOARDPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_KEYBOARD_PORT);
return VERR_PDM_MISSING_INTERFACE_ABOVE;
void *pv;
return rc;
return VINF_SUCCESS;
sizeof(DRVMAINKEYBOARD),
NULL,
NULL,
NULL,
NULL,
NULL,