Skip to content
Open
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
af2012f
Platform: Add SimpleTextInputExCompatDxe for EFI 1.1 compatibility
startergo Aug 15, 2025
6658f61
Platform: Fix code style issues in SimpleTextInputExCompatDxe
startergo Aug 15, 2025
5584cb6
Platform: Fix copyright year in SimpleTextInputExCompatDxe LICENSE
startergo Aug 15, 2025
9e2eef2
Platform: Address OpenCore code review feedback for SimpleTextInputEx…
startergo Aug 15, 2025
215ef5f
Platform: Fix Uncrustify code style issues in SimpleTextInputExCompatDxe
startergo Aug 15, 2025
a1b6392
Platform: Add SimpleTextInputExCompatDxe to OpenCore build configuration
startergo Aug 15, 2025
7929923
Fix VS2019 build error: cast CHAR16 to UINT8 in GetControlCharDescrip…
startergo Aug 15, 2025
38b1c7f
Add SimpleTextInputExCompatDxe to build scripts
startergo Aug 15, 2025
ab47c0d
Fix SimpleTextInputExCompat driver filename in build_oc.tool
startergo Aug 15, 2025
2008664
Add OcTextInputLib and OcTextInputDxe for EFI 1.1 compatibility
startergo Aug 17, 2025
78c71f0
Remove manual EFI key state constant definitions
startergo Aug 17, 2025
e88a73d
Clarify OcInstallSimpleTextInputExLocal fallback behavior
startergo Aug 17, 2025
5ffe22d
Fix misleading UseLocalRegistration flag documentation
startergo Aug 17, 2025
ff01d13
Fix include path structure for OcTextInputLib
startergo Aug 17, 2025
29c85fb
Apply Uncrustify code formatting fixes
startergo Aug 17, 2025
f6aaaca
Clean up Uncrustify backup files
startergo Aug 17, 2025
305db3a
Fix remaining Uncrustify code style issues
startergo Aug 17, 2025
83b679f
Clean up Uncrustify backup files
startergo Aug 17, 2025
3527b71
Fix indentation in OcTextInputLib.c - manual tab-to-space conversion
startergo Aug 17, 2025
fbd6461
Fix indentation in OcTextInputDxe.c - manual tab-to-space conversion
startergo Aug 17, 2025
7b8bc18
Apply exact Uncrustify formatting requirements from CI
startergo Aug 17, 2025
101f745
Remove extra empty line before OcTestCtrlKeyDetection function
startergo Aug 17, 2025
c7fa1fb
Consolidate duplicate SimpleTextInputEx implementations
startergo Aug 17, 2025
d44a5f3
Removed CONSOLIDATION_PLAN.md
startergo Aug 17, 2025
fd37d80
Fix Uncrustify formatting in control character table
startergo Aug 17, 2025
ccccdb8
Consolidate text input implementations
startergo Aug 17, 2025
4973b29
Fix build: Update OpenDuetPkg.dsc to use OcTextInputDxe
startergo Aug 17, 2025
0eaee55
Add OcTextInputLib library class to OpenDuetPkg
startergo Aug 17, 2025
5184d9c
OcTextInputDxe: Restore comprehensive SimpleTextInputEx compatibility…
startergo Aug 18, 2025
411fc73
Merge branch 'acidanthera:master' into text-input-lib-cmp51
startergo Aug 18, 2025
a83da00
Fix Uncrustify code style issues
startergo Aug 18, 2025
aff942b
Fix missing newline at end of OcTextInputDxe.c
startergo Aug 18, 2025
d679a15
Fix OcTextInputDxe linker errors: Add missing GUIDs and libraries
startergo Aug 18, 2025
a7b0418
OcTextInputLib: Remove unnecessary EFIAPI calling convention
startergo Aug 19, 2025
b200cd0
OcTextInputLib: Make OcIsSimpleTextInputExAvailable internal
startergo Aug 19, 2025
b684ae2
OcTextInputLib: Move internal function to private header
startergo Aug 19, 2025
0f05ca0
OcTextInputLib: Remove empty duplicate header file
startergo Aug 19, 2025
169ebb7
OcTextInputLib: Remove custom ARRAY_SIZE macro
startergo Aug 19, 2025
717b78a
OcTextInputLib: Guard debug strings with DEBUG_POINTER
startergo Aug 19, 2025
d7a8027
OcTextInputLib: Guard debug strings with DEBUG_POINTER
startergo Aug 19, 2025
d255a9b
Fix variable declaration style in OcCompatReadKeyStrokeEx
startergo Aug 19, 2025
e2d1c53
Fix code style issues detected by Uncrustify
startergo Aug 19, 2025
c9ab7fe
Restore corrupted shared header file
startergo Aug 19, 2025
998654e
Final code style fixes for Uncrustify compliance
startergo Aug 19, 2025
9da8a04
Apply Uncrustify-compliant preprocessor directive formatting
startergo Aug 19, 2025
26cbff3
Final Uncrustify spacing fix for variable declaration
startergo Aug 19, 2025
bbd6508
Populate empty header files to resolve Uncrustify issues
startergo Aug 19, 2025
6ed0fb0
OcTextInputLib: Implement comprehensive SimpleTextInputEx compatibili…
startergo Aug 19, 2025
fea9089
OcTextInputLib: Apply proper acidanthera uncrustify formatting
startergo Aug 20, 2025
7bc1d52
OcTextInputLib: Apply proper CI uncrustify formatting
startergo Aug 20, 2025
355a9bc
OcTextInputLib: Fix MSVC compatibility issues
startergo Aug 20, 2025
2d6ba43
OcTextInputLib: Implement SimpleTextInputEx protocol compatibility
startergo Aug 20, 2025
7573e73
OcTextInputLib: Refactor to proper UEFI/EDK II library architecture
startergo Aug 21, 2025
b7894c1
Implement SimpleTextInputEx compatibility with proper library archite…
startergo Aug 22, 2025
63d8617
Address code review feedback - cleanup and refinements
startergo Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Docs/Configuration.tex
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ \subsection{Debugging}\label{configuration-debug}
\begin{itemize}
\tightlist
\item Use module prefixes, 2-5 letters followed by a colon (\texttt{:}), for debug messages. For \texttt{OpenCorePkg}
use \texttt{OC:}, for libraries and drivers use their own unique prefixes.
use \texttt{OC:}, for libraries and drivers use their own unique prefixes. For example, \texttt{OcTextInputLib} uses \texttt{OCTI:}.
\item Do not use dots (\texttt{.}) in the end of debug messages and separate \texttt{EFI\_STATUS}, printed by
\texttt{\%r}, with a hyphen (e.g. \texttt{OCRAM: Allocation of \%u bytes failed - \%r\textbackslash n}).
\item Use \texttt{DEBUG\_CODE\_BEGIN ()} and \texttt{DEBUG\_CODE\_END ()} constructions to guard debug checks
Expand Down
83 changes: 83 additions & 0 deletions Include/Acidanthera/Library/OcTextInputLib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/** @file
OcTextInputLib - SimpleTextInputEx Protocol Compatibility Library

This library provides SimpleTextInputEx protocol compatibility for systems
that only have SimpleTextInput protocol available (EFI 1.1 systems).

Copyright (c) 2025, OpenCore Team. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef OC_TEXT_INPUT_LIB_H
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi - Sorry if I'm coming a bit late with this suggestion, but I would suggest changing to using SimpleTextInput, SIMPLE_TEXT_INPUT, etc., everwhere. E.g. Library/OcSimpleTextInputLib, etc. - just so it's very clear at first sight what this is. (As we already have lots of helper libraries, for lots of somewhat related things.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we've already implemented the functionality and it's working, and this would require extensive renaming across files, folders, and function names, this could be addressed in a separate refactoring if desired. Isn't the current naming clear and functional?

#define OC_TEXT_INPUT_LIB_H

#include <Uefi.h>
#include <Protocol/SimpleTextInEx.h>

/**
Install SimpleTextInputEx compatibility protocol on the console input handle.

This function checks if SimpleTextInputEx is already available, and if not,
installs a compatibility version that wraps SimpleTextInput protocol.

For the "normal" variant, this uses standard gBS->InstallProtocolInterface.
For the "local" variant, this uses OcRegisterBootServicesProtocol for
use within OpenShell.

@retval EFI_SUCCESS Protocol installed successfully or already present
@retval EFI_ALREADY_STARTED Protocol already exists, no action taken
@retval Others Installation failed
**/
EFI_STATUS
OcInstallSimpleTextInputEx (
VOID
);

/**
Uninstall SimpleTextInputEx compatibility protocol.

This should be called during cleanup if the compatibility protocol
was installed by this library.

@retval EFI_SUCCESS Protocol uninstalled successfully
@retval EFI_NOT_FOUND Protocol was not installed by this library
@retval Others Uninstallation failed
**/
EFI_STATUS
OcUninstallSimpleTextInputEx (
VOID
);

/**
Test CTRL key detection on the current system.

This function can be used to verify that CTRL key combinations
are properly detected on EFI 1.1 systems. Useful for debugging
compatibility issues like those seen on cMP5,1.

@retval EFI_SUCCESS Test completed, check debug output
@retval Others Test failed
**/
EFI_STATUS
OcTestCtrlKeyDetection (
VOID
);

/**
Process key data and handle control characters.

This function is provided by OcTextInputLib for use by standalone drivers.
It handles control character mapping and key processing logic.

@param[in,out] KeyData Key data to process

@retval EFI_SUCCESS Key data processed successfully
@retval EFI_NOT_FOUND Key data does not need processing
@retval EFI_INVALID_PARAMETER KeyData is NULL
**/
EFI_STATUS
OctiProcessKeyData (
IN OUT EFI_KEY_DATA *KeyData
);

#endif // OC_TEXT_INPUT_LIB_H
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an empty file in Include/Library/OcTextInputLib.h, this is probably a bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was an empty file at Include/Library/OcTextInputLib.h
which is a duplicate of the actual header at Include/Acidanthera/Library/OcTextInputLib.h

Verified with successful local Xcode5 build.

79 changes: 79 additions & 0 deletions Include/Library/OcTextInputLib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/** @file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole file is a duplicate of Acidanthera/Library/OcTextInputLib.h and should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate OcTextInputLib.h has been removed in 63d8617

OcTextInputLib - SimpleTextInputEx Protocol Compatibility Library

This library provides SimpleTextInputEx protocol compatibility for systems
that only have SimpleTextInput protocol available (EFI 1.1 systems).

Copyright (c) 2025, OpenCore Team. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef OC_TEXT_INPUT_LIB_H
#define OC_TEXT_INPUT_LIB_H

#include <Uefi.h>
#include <Protocol/SimpleTextInEx.h>

//
// Control character mapping structure for hotkey descriptions.
//
typedef struct {
UINT8 ControlChar; ///< Control character code (0x01-0x1F)
CHAR8 *Description; ///< Human-readable description (e.g., "CTRL+A")
CHAR8 *ShellFunction; ///< Shell function name (e.g., "StartOfLine")
} CONTROL_CHAR_MAPPING;

/**
Get control character mapping for a given character.

@param[in] ControlChar The control character to get mapping for.

@retval Pointer to CONTROL_CHAR_MAPPING structure, or NULL if not found.
**/
CONTROL_CHAR_MAPPING *
EFIAPI
GetControlCharMapping (
IN CHAR16 ControlChar
);

/**
Compatibility implementation of SimpleTextInputEx ReadKeyStrokeEx.

@param[in] This Protocol instance pointer.
@param[out] KeyData A pointer to a buffer that is filled in with
the keystroke state data for the key that was
pressed.

@retval EFI_SUCCESS The keystroke information was returned.
@retval EFI_NOT_READY There was no keystroke data available.
@retval EFI_DEVICE_ERROR The keystroke information was not returned due
to an error.
@retval EFI_INVALID_PARAMETER KeyData is NULL.
**/
EFI_STATUS
EFIAPI
CompatReadKeyStrokeEx (
IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This,
OUT EFI_KEY_DATA *KeyData
);

/**
Install SimpleTextInputEx Protocol compatibility.

This function installs a SimpleTextInputEx protocol instance that provides
compatibility for systems that only have SimpleTextInput protocol available.

@param[in] UseLocalRegistration If TRUE, register protocol with OpenCore's
internal table. If FALSE, register with
system's boot services table.

@retval EFI_SUCCESS Protocol installed successfully.
@retval EFI_OUT_OF_RESOURCES Failed to allocate memory.
@retval Other Installation failed.
**/
EFI_STATUS
OcInstallSimpleTextInputExInternal (
IN BOOLEAN UseLocalRegistration
);

#endif // OC_TEXT_INPUT_LIB_H
37 changes: 37 additions & 0 deletions Library/OcTextInputLib/OcTextInputCommon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/** @file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole file does not appear to be used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused OcTextInputCommon.h has been removed in 63d8617

Copyright (C) 2021, vit9696. All rights reserved.

All rights reserved.

This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/

#ifndef OC_TEXT_INPUT_COMMON_H
#define OC_TEXT_INPUT_COMMON_H

#include <Uefi.h>
#include <Protocol/SimpleTextInEx.h>

/**
Process key data and handle control characters.

This function is provided by OcTextInputLib for use by standalone drivers.
It handles control character mapping and key processing logic.

@param[in,out] KeyData Key data to process

@retval EFI_SUCCESS Key data processed successfully
@retval EFI_NOT_FOUND Key data does not need processing
**/
EFI_STATUS
OctiProcessKeyData (
IN OUT EFI_KEY_DATA *KeyData
);

#endif // OC_TEXT_INPUT_COMMON_H
Loading
Loading