TianoCore EDK2 master
Loading...
Searching...
No Matches
VirtualKeyboard.c File Reference
#include "VirtualKeyboard.h"

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI VirtualKeyboardDriverBindingSupported (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI VirtualKeyboardDriverBindingStart (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
 
EFI_STATUS EFIAPI VirtualKeyboardDriverBindingStop (IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
 
EFI_STATUS Enqueue (IN SIMPLE_QUEUE *Queue, IN EFI_KEY_DATA *KeyData)
 
EFI_STATUS Dequeue (IN SIMPLE_QUEUE *Queue, IN EFI_KEY_DATA *KeyData)
 
EFI_STATUS CheckQueue (IN SIMPLE_QUEUE *Queue)
 
EFI_STATUS EFIAPI VirtualKeyboardCheckForKey (IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This)
 
EFI_STATUS VirtualKeyboardFreeNotifyList (IN OUT LIST_ENTRY *ListHead)
 
BOOLEAN IsKeyRegistered (IN EFI_KEY_DATA *RegsiteredData, IN EFI_KEY_DATA *InputData)
 
VOID EFIAPI VirtualKeyboardWaitForKey (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI VirtualKeyboardWaitForKeyEx (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI VirtualKeyboardReset (IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
 
EFI_STATUS EFIAPI VirtualKeyboardResetEx (IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
 
EFI_STATUS KeyboardReadKeyStrokeWorker (IN VIRTUAL_KEYBOARD_DEV *VirtualKeyboardPrivate, OUT EFI_KEY_DATA *KeyData)
 
EFI_STATUS EFIAPI VirtualKeyboardReadKeyStroke (IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL *This, OUT EFI_INPUT_KEY *Key)
 
EFI_STATUS EFIAPI VirtualKeyboardReadKeyStrokeEx (IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, OUT EFI_KEY_DATA *KeyData)
 
EFI_STATUS EFIAPI VirtualKeyboardSetState (IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_TOGGLE_STATE *KeyToggleState)
 
EFI_STATUS EFIAPI VirtualKeyboardRegisterKeyNotify (IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN EFI_KEY_DATA *KeyData, IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, OUT VOID **NotifyHandle)
 
EFI_STATUS EFIAPI VirtualKeyboardUnregisterKeyNotify (IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, IN VOID *NotificationHandle)
 
VOID EFIAPI VirtualKeyboardTimerHandler (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI KeyNotifyProcessHandler (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS EFIAPI InitializeVirtualKeyboard (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

EFI_DRIVER_BINDING_PROTOCOL gVirtualKeyboardDriverBinding
 

Detailed Description

VirtualKeyboard driver

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
Copyright (c) 2018, Linaro Ltd. All rights reserved.

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file VirtualKeyboard.c.

Function Documentation

◆ CheckQueue()

EFI_STATUS CheckQueue ( IN SIMPLE_QUEUE Queue)

Check whether the queue is empty.

Parameters
QueueThe queue to be checked.
Return values
EFI_NOT_READYThe queue is empty.
EFI_SUCCESSThe queue is not empty.

Definition at line 366 of file VirtualKeyboard.c.

◆ Dequeue()

EFI_STATUS Dequeue ( IN SIMPLE_QUEUE Queue,
IN EFI_KEY_DATA KeyData 
)

Dequeue the key.

Parameters
QueueThe queue to be dequeued.
KeyDataThe key data to be dequeued.
Return values
EFI_NOT_READYThe queue is empty.
EFI_SUCCESSSuccessfully dequeued the key data.

Definition at line 341 of file VirtualKeyboard.c.

◆ Enqueue()

EFI_STATUS Enqueue ( IN SIMPLE_QUEUE Queue,
IN EFI_KEY_DATA KeyData 
)

Enqueue the key.

Parameters
QueueThe queue to be enqueued.
KeyDataThe key data to be enqueued.
Return values
EFI_NOT_READYThe queue is full.
EFI_SUCCESSSuccessfully enqueued the key data.

Definition at line 315 of file VirtualKeyboard.c.

◆ InitializeVirtualKeyboard()

EFI_STATUS EFIAPI InitializeVirtualKeyboard ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

The user Entry Point for module VirtualKeyboard. The user code starts with this function.

Parameters
[in]ImageHandleThe firmware allocated handle for the EFI image.
[in]SystemTableA pointer to the EFI System Table.
Return values
EFI_SUCCESSThe entry point is executed successfully.
otherSome error occurs when executing this entry point.

Definition at line 1143 of file VirtualKeyboard.c.

◆ IsKeyRegistered()

BOOLEAN IsKeyRegistered ( IN EFI_KEY_DATA RegsiteredData,
IN EFI_KEY_DATA InputData 
)

Judge whether is a registed key

Parameters
RegsiteredDataA pointer to a buffer that is filled in with the keystroke state data for the key that was registered.
InputDataA pointer to a buffer that is filled in with the keystroke state data for the key that was pressed.
Return values
TRUEKey be pressed matches a registered key.
FALSEMatch failed.

Definition at line 448 of file VirtualKeyboard.c.

◆ KeyboardReadKeyStrokeWorker()

EFI_STATUS KeyboardReadKeyStrokeWorker ( IN VIRTUAL_KEYBOARD_DEV VirtualKeyboardPrivate,
OUT EFI_KEY_DATA KeyData 
)

Reads the next keystroke from the input device. The WaitForKey Event can be used to test for existence of a keystroke via WaitForEvent () call.

Parameters
VirtualKeyboardPrivateVirtualkeyboard driver private structure.
KeyDataA pointer to a buffer that is filled in with the keystroke state data for the key that was pressed.
Return values
EFI_SUCCESSThe keystroke information was returned.
EFI_NOT_READYThere was no keystroke data available.
EFI_DEVICE_ERRORThe keystroke information was not returned due to hardware errors.
EFI_INVALID_PARAMETERKeyData is NULL.

Definition at line 646 of file VirtualKeyboard.c.

◆ KeyNotifyProcessHandler()

VOID EFIAPI KeyNotifyProcessHandler ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Process key notify.

Parameters
EventIndicates the event that invoke this function.
ContextIndicates the calling context.

Definition at line 1080 of file VirtualKeyboard.c.

◆ VirtualKeyboardCheckForKey()

EFI_STATUS EFIAPI VirtualKeyboardCheckForKey ( IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL This)

Check key buffer to get the key stroke status.

Parameters
ThisPointer of the protocol EFI_SIMPLE_TEXT_IN_PROTOCOL.
Return values
EFI_SUCCESSA key is being pressed now.
OtherNo key is now pressed.

Definition at line 388 of file VirtualKeyboard.c.

◆ VirtualKeyboardDriverBindingStart()

EFI_STATUS EFIAPI VirtualKeyboardDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Starts the device with this driver.

Parameters
ThisThe driver binding instance.
ControllerHandle of device to bind driver to.
RemainingDevicePathOptional parameter use to pick a specific child device to start.
Return values
EFI_SUCCESSThe controller is controlled by the driver.
OtherThis controller cannot be started.

Definition at line 86 of file VirtualKeyboard.c.

◆ VirtualKeyboardDriverBindingStop()

EFI_STATUS EFIAPI VirtualKeyboardDriverBindingStop ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN UINTN  NumberOfChildren,
IN EFI_HANDLE ChildHandleBuffer 
)

Stop the device handled by this driver.

Parameters
ThisThe driver binding protocol.
ControllerThe controller to release.
NumberOfChildrenThe number of handles in ChildHandleBuffer.
ChildHandleBufferThe array of child handle.
Return values
EFI_SUCCESSThe device was stopped.
EFI_DEVICE_ERRORThe device could not be stopped due to a device error.
OthersFail to uninstall protocols attached on the device.

Definition at line 294 of file VirtualKeyboard.c.

◆ VirtualKeyboardDriverBindingSupported()

EFI_STATUS EFIAPI VirtualKeyboardDriverBindingSupported ( IN EFI_DRIVER_BINDING_PROTOCOL This,
IN EFI_HANDLE  Controller,
IN EFI_DEVICE_PATH_PROTOCOL RemainingDevicePath 
)

Check whether the driver supports this device.

Parameters
ThisThe Udriver binding protocol.
ControllerThe controller handle to check.
RemainingDevicePathThe remaining device path.
Return values
EFI_SUCCESSThe driver supports this controller.
otherThis device isn't supported.

Definition at line 42 of file VirtualKeyboard.c.

◆ VirtualKeyboardFreeNotifyList()

EFI_STATUS VirtualKeyboardFreeNotifyList ( IN OUT LIST_ENTRY ListHead)

Free keyboard notify list.

Parameters
ListHeadThe list head
Return values
EFI_SUCCESSFree the notify list successfully
EFI_INVALID_PARAMETERListHead is invalid.

Definition at line 409 of file VirtualKeyboard.c.

◆ VirtualKeyboardReadKeyStroke()

EFI_STATUS EFIAPI VirtualKeyboardReadKeyStroke ( IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL This,
OUT EFI_INPUT_KEY Key 
)

Read out the scan code of the key that has just been stroked.

Parameters
ThisPointer of simple text Protocol.
KeyPointer for store the key that read out.
Return values
EFI_SUCCESSThe key is read out successfully.
otherThe key reading failed.
EFI_UNSUPPORTEDThe device does not support the ability to read keystroke data.

Definition at line 707 of file VirtualKeyboard.c.

◆ VirtualKeyboardReadKeyStrokeEx()

EFI_STATUS EFIAPI VirtualKeyboardReadKeyStrokeEx ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This,
OUT EFI_KEY_DATA KeyData 
)

Reads the next keystroke from the input device. The WaitForKey Event can be used to test for existence of a keystroke via WaitForEvent () call.

Parameters
ThisProtocol instance pointer.
KeyDataA pointer to a buffer that is filled in with the keystroke state data for the key that was pressed.
Return values
EFI_SUCCESSThe keystroke information was returned.
EFI_NOT_READYThere was no keystroke data available.
EFI_DEVICE_ERRORThe keystroke information was not returned due to hardware errors.
EFI_INVALID_PARAMETERKeyData is NULL.
EFI_UNSUPPORTEDThe device does not support the ability to read keystroke data.

Definition at line 761 of file VirtualKeyboard.c.

◆ VirtualKeyboardRegisterKeyNotify()

EFI_STATUS EFIAPI VirtualKeyboardRegisterKeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This,
IN EFI_KEY_DATA KeyData,
IN EFI_KEY_NOTIFY_FUNCTION  KeyNotificationFunction,
OUT VOID **  NotifyHandle 
)

Register a notification function for a particular keystroke for the input device.

Parameters
ThisProtocol instance pointer.
KeyDataA pointer to a buffer that is filled in with the keystroke information data for the key that was pressed.
KeyNotificationFunctionPoints to the function to be called when the key sequence is typed specified by KeyData.
NotifyHandlePoints to the unique handle assigned to the registered notification.
Return values
EFI_SUCCESSThe notification function was registered successfully.
EFI_OUT_OF_RESOURCESUnable to allocate resources for necessary data structures.
EFI_INVALID_PARAMETERKeyData or NotifyHandle is NULL.

Definition at line 829 of file VirtualKeyboard.c.

◆ VirtualKeyboardReset()

EFI_STATUS EFIAPI VirtualKeyboardReset ( IN EFI_SIMPLE_TEXT_INPUT_PROTOCOL This,
IN BOOLEAN  ExtendedVerification 
)

Reset the Keyboard and do BAT test for it, if (ExtendedVerification == TRUE) then do some extra keyboard validations.

Parameters
ThisPointer of simple text Protocol.
ExtendedVerificationWhether perform the extra validation of keyboard. True: perform; FALSE: skip.
Return values
EFI_SUCCESSThe command byte is written successfully.
EFI_DEVICE_ERRORErrors occurred during resetting keyboard.

Definition at line 558 of file VirtualKeyboard.c.

◆ VirtualKeyboardResetEx()

EFI_STATUS EFIAPI VirtualKeyboardResetEx ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This,
IN BOOLEAN  ExtendedVerification 
)

Reset the input device and optionally run diagnostics

Parameters
ThisProtocol instance pointer.
ExtendedVerificationDriver may perform diagnostics on reset.
Return values
EFI_SUCCESSThe device was reset.
EFI_DEVICE_ERRORThe device is not functioning properly and could not be reset.

Definition at line 603 of file VirtualKeyboard.c.

◆ VirtualKeyboardSetState()

EFI_STATUS EFIAPI VirtualKeyboardSetState ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This,
IN EFI_KEY_TOGGLE_STATE KeyToggleState 
)

Set certain state for the input device.

Parameters
ThisProtocol instance pointer.
KeyToggleStateA pointer to the EFI_KEY_TOGGLE_STATE to set the state for the input device.
Return values
EFI_SUCCESSThe device state was set successfully.
EFI_DEVICE_ERRORThe device is not functioning correctly and could not have the setting adjusted.
EFI_UNSUPPORTEDThe device does not have the ability to set its state.
EFI_INVALID_PARAMETERKeyToggleState is NULL.

Definition at line 794 of file VirtualKeyboard.c.

◆ VirtualKeyboardTimerHandler()

VOID EFIAPI VirtualKeyboardTimerHandler ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Timer event handler: read a series of scancodes from 8042 and put them into memory scancode buffer. it read as much scancodes to either fill the memory buffer or empty the keyboard buffer. It is registered as running under TPL_NOTIFY

Parameters
EventThe timer event
ContextA KEYBOARD_CONSOLE_IN_DEV pointer

Definition at line 998 of file VirtualKeyboard.c.

◆ VirtualKeyboardUnregisterKeyNotify()

EFI_STATUS EFIAPI VirtualKeyboardUnregisterKeyNotify ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL This,
IN VOID *  NotificationHandle 
)

Remove a registered notification function from a particular keystroke.

Parameters
ThisProtocol instance pointer.
NotificationHandleThe handle of the notification function being unregistered.
Return values
EFI_SUCCESSThe notification function was unregistered successfully.
EFI_INVALID_PARAMETERThe NotificationHandle is invalid.

Definition at line 920 of file VirtualKeyboard.c.

◆ VirtualKeyboardWaitForKey()

VOID EFIAPI VirtualKeyboardWaitForKey ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Event notification function for SIMPLE_TEXT_IN.WaitForKey event Signal the event if there is key available

Parameters
Eventthe event object
Contextwaiting context

Definition at line 491 of file VirtualKeyboard.c.

◆ VirtualKeyboardWaitForKeyEx()

VOID EFIAPI VirtualKeyboardWaitForKeyEx ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

Event notification function for SIMPLE_TEXT_INPUT_EX_PROTOCOL.WaitForKeyEx event. Signal the event if there is key available

Parameters
Eventevent object
Contextwaiting context

Definition at line 528 of file VirtualKeyboard.c.

Variable Documentation

◆ gVirtualKeyboardDriverBinding

EFI_DRIVER_BINDING_PROTOCOL gVirtualKeyboardDriverBinding
Initial value:
= {
0x10,
}
#define NULL
Definition: Base.h:319
EFI_STATUS EFIAPI VirtualKeyboardDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI VirtualKeyboardDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI VirtualKeyboardDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)

Definition at line 16 of file VirtualKeyboard.c.