OpenCore  1.0.4
OpenCore Bootloader
Loading...
Searching...
No Matches
OcAppleKeyMapLib.h File Reference
#include <Protocol/AppleKeyMapDatabase.h>
#include <Protocol/AppleKeyMapAggregator.h>
#include <Library/DebugLib.h>

Go to the source code of this file.

Data Structures

struct  OC_KEY_REPEAT_CONTEXT
 

Macros

#define OC_TRACE_UPDOWNKEYS   DEBUG_VERBOSE
 
#define OC_KEY_MAP_DEFAULT_SIZE   8
 
#define OC_HELD_KEYS_DEFAULT_SIZE   8
 
#define OC_DOWNKEYS_DEFAULT_INITIAL_DELAY   350
 
#define OC_DOWNKEYS_DEFAULT_SUBSEQUENT_DELAY   80
 

Functions

VOID OcFreeKeyRepeatContext (OC_KEY_REPEAT_CONTEXT **Context)
 
EFI_STATUS OcInitKeyRepeatContext (OUT OC_KEY_REPEAT_CONTEXT **Context, IN APPLE_KEY_MAP_AGGREGATOR_PROTOCOL *KeyMap, IN UINTN MaxKeysHeld, IN UINT64 InitialDelay, IN UINT64 SubsequentDelay, IN BOOLEAN PreventInitialRepeat)
 
EFI_STATUS EFIAPI OcGetUpDownKeys (IN OUT OC_KEY_REPEAT_CONTEXT *RepeatContext, OUT APPLE_MODIFIER_MAP *Modifiers, IN OUT UINTN *NumKeysUp, OUT APPLE_KEY_CODE *KeysUp OPTIONAL, IN OUT UINTN *NumKeysDown, OUT APPLE_KEY_CODE *KeysDown OPTIONAL, IN UINT64 CurrentTime)
 
APPLE_KEY_MAP_DATABASE_PROTOCOLOcAppleKeyMapGetDatabase (VOID)
 
APPLE_KEY_MAP_AGGREGATOR_PROTOCOLOcAppleKeyMapInstallProtocols (IN BOOLEAN Reinstall)
 
BOOLEAN OcKeyMapHasKeys (IN CONST APPLE_KEY_CODE *Keys, IN UINTN NumKeys, IN CONST APPLE_KEY_CODE *CheckKeys, IN UINTN NumCheckKeys, IN BOOLEAN ExactMatch)
 
BOOLEAN OcKeyMapHasKey (IN CONST APPLE_KEY_CODE *Keys, IN UINTN NumKeys, IN CONST APPLE_KEY_CODE KeyCode)
 
VOID OcKeyMapFlush (IN APPLE_KEY_MAP_AGGREGATOR_PROTOCOL *KeyMap, IN APPLE_KEY_CODE Key, IN BOOLEAN FlushConsole)
 

Detailed Description

Copyright (C) 2019, Download-Fritz. All rights reserved.
Copyright (C) 2021, Mike Beaton. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause

Definition in file OcAppleKeyMapLib.h.

Macro Definition Documentation

◆ OC_DOWNKEYS_DEFAULT_INITIAL_DELAY

#define OC_DOWNKEYS_DEFAULT_INITIAL_DELAY   350

Default initial and subsequent key repeat delays in milliseconds.

Definition at line 31 of file OcAppleKeyMapLib.h.

◆ OC_DOWNKEYS_DEFAULT_SUBSEQUENT_DELAY

#define OC_DOWNKEYS_DEFAULT_SUBSEQUENT_DELAY   80

Definition at line 32 of file OcAppleKeyMapLib.h.

◆ OC_HELD_KEYS_DEFAULT_SIZE

#define OC_HELD_KEYS_DEFAULT_SIZE   8

Default buffer size for held keys in downkeys support.

Definition at line 26 of file OcAppleKeyMapLib.h.

◆ OC_KEY_MAP_DEFAULT_SIZE

#define OC_KEY_MAP_DEFAULT_SIZE   8

Default buffer size for key map.

Definition at line 21 of file OcAppleKeyMapLib.h.

◆ OC_TRACE_UPDOWNKEYS

#define OC_TRACE_UPDOWNKEYS   DEBUG_VERBOSE

Definition at line 15 of file OcAppleKeyMapLib.h.

Function Documentation

◆ OcAppleKeyMapGetDatabase()

APPLE_KEY_MAP_DATABASE_PROTOCOL * OcAppleKeyMapGetDatabase ( VOID )

Returns the previously install Apple Key Map Database protocol.

Return values
installedor located protocol or NULL

Definition at line 575 of file OcAppleKeyMapLib.c.

◆ OcAppleKeyMapInstallProtocols()

APPLE_KEY_MAP_AGGREGATOR_PROTOCOL * OcAppleKeyMapInstallProtocols ( IN BOOLEAN Reinstall)

Install and initialise Apple Key Map protocols.

Parameters
[in]ReinstallOverwrite installed protocols.
Return values
installedor located protocol or NULL

Definition at line 590 of file OcAppleKeyMapLib.c.

◆ OcFreeKeyRepeatContext()

VOID OcFreeKeyRepeatContext ( OC_KEY_REPEAT_CONTEXT ** Context)

Free key repeat context.

Parameters
[in]ContextKey repeat context to free.

Definition at line 21 of file UpDownDetection.c.

◆ OcGetUpDownKeys()

EFI_STATUS EFIAPI OcGetUpDownKeys ( IN OUT OC_KEY_REPEAT_CONTEXT * RepeatContext,
OUT APPLE_MODIFIER_MAP * Modifiers,
IN OUT UINTN * NumKeysUp,
OUT APPLE_KEY_CODE *KeysUp OPTIONAL,
IN OUT UINTN * NumKeysDown,
OUT APPLE_KEY_CODE *KeysDown OPTIONAL,
IN UINT64 CurrentTime )

Returns all key transitions and key modifiers into the appropiate buffers.

Parameters
[in,out]RepeatContextOn input the previous (or newly initialised) repeat context. On output the newly updated key repeat context; values of interest to the caller are not intended to be read from the context, but from the other parameters above.
[out]ModifiersThe key modifiers currently applicable.
[in,out]NumKeysUpOn input the number of keys allocated for KeysUp. Ignored if KeysUp is null. On output the number of up keys detected, with their keycodes returned into KeysUp if present.
[out]KeysUpA Pointer to a optional caller-allocated buffer in which new up keycodes get returned.
[in,out]NumKeysDownOn input with KeysDown non-null, the number of keys allocated for KeysDown and the total number of keys to check. On input and with KeysDown null, this parameter still represents the total number of keys to check. On output the number of down keys detected, with their keycodes returned into KeysDown if present.
[out]KeysDownA Pointer to an optional caller-allocated buffer in which new down keycodes get returned.
[in]CurrentTimeCurrent time (arbitrary units with sufficient resolution). Need not be valid on initial call only.
Return values
EFI_SUCCESSThe requested key transitions and states have been returned or updated as requested in the various out parameters.
EFI_UNSUPPORTEDUnsupported buffer/size combination.
otherAn error returned by a sub-operation.

Definition at line 126 of file UpDownDetection.c.

◆ OcInitKeyRepeatContext()

EFI_STATUS OcInitKeyRepeatContext ( OUT OC_KEY_REPEAT_CONTEXT ** Context,
IN APPLE_KEY_MAP_AGGREGATOR_PROTOCOL * KeyMap,
IN UINTN MaxKeysHeld,
IN UINT64 InitialDelay,
IN UINT64 SubsequentDelay,
IN BOOLEAN PreventInitialRepeat )

Initialise key repeat context.

Parameters
[out]ContextAllocated key repeat context structure is returned here.
[in]KeyMapThe key map aggregator protocol instance to use.
[in]MaxKeysHeldNumber of entries to allocate in held keys buffer.
[in]InitialDelayKey repeat initial delay. Same time units as CurrentTime passed to subsequent calls of OcGetUpDownKeys.
[in]SubsequentDelayKey repeat subsequent delay. Same time units as CurrentTime passed to subsequent calls of OcGetUpDownKeys.
[in]PreventInitialRepeatIf true, set up buffer so that keys held at init do not repeat until released and then pressed again.
Return values
EFI_SUCCESSThe repeat context has been initialised.
otherAn error returned by a sub-operation.

Definition at line 41 of file UpDownDetection.c.

◆ OcKeyMapFlush()

VOID OcKeyMapFlush ( IN APPLE_KEY_MAP_AGGREGATOR_PROTOCOL * KeyMap,
IN APPLE_KEY_CODE Key,
IN BOOLEAN FlushConsole )

Performs keyboard input flush.

Parameters
[in]KeyMapApple Key Map Aggregator protocol.
[in]KeyKey to wait for removal or 0.
[in]FlushConsoleAlso flush console input.

Definition at line 264 of file OcAppleKeyMapLib.c.

◆ OcKeyMapHasKey()

BOOLEAN OcKeyMapHasKey ( IN CONST APPLE_KEY_CODE * Keys,
IN UINTN NumKeys,
IN CONST APPLE_KEY_CODE KeyCode )

Checks whether or not a KeyCode is contained within Keys.

Parameters
[in]KeysThe reference keys.
[in]NumKeysThe number of keys in Keys.
[in]KeyCodeThe key to locate in Keys.
Returns
Whether the reference keys contain the checked key.

Definition at line 254 of file OcAppleKeyMapLib.c.

◆ OcKeyMapHasKeys()

BOOLEAN OcKeyMapHasKeys ( IN CONST APPLE_KEY_CODE * Keys,
IN UINTN NumKeys,
IN CONST APPLE_KEY_CODE * CheckKeys,
IN UINTN NumCheckKeys,
IN BOOLEAN ExactMatch )

Checks whether or not a list of keys is contained within another.

Parameters
[in]KeysThe reference keys.
[in]NumKeysThe number of keys in Keys.
[in]CheckKeysThe keys to locate in Keys.
[in]NumCheckKeysThe number of keys in CheckKeys.
[in]ExactMatchSpecifies whether matches must be exact.
Returns
Whether the reference keys contain the checked keys.

Definition at line 223 of file OcAppleKeyMapLib.c.