Skip to content

Implement SimpleTextInputEx protocol on top of AppleEvent, AppleKeyMapAggregator and SimpleTextInput protocols - #632

Open
ilikesn0w wants to merge 1 commit into
acidanthera:masterfrom
ilikesn0w:ilikesn0w-inex-20260919
Open

ilikesn0w wants to merge 1 commit into
acidanthera:masterfrom
ilikesn0w:ilikesn0w-inex-20260919

Conversation

@ilikesn0w

@ilikesn0w ilikesn0w commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Implemented SimpleTextInputEx protocol on top of AppleEvent and SimpleTextInput protocols. Tested it with edit in OpenShell on MacBookPro9,2, and it fully works

Closes: acidanthera/bugtracker#1080

@mikebeaton
mikebeaton force-pushed the ilikesn0w-inex-20260919 branch from 95027a3 to 0df8398 Compare September 26, 2026 06:56
@ilikesn0w

ilikesn0w commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor Author

I can also suggest creating a OpenInExDxe driver that can be inserted into firmware as .ffs or loaded from OpenCore as .efi. We can use it with OpenCore instead of InstallSimpleTextInputEx option.

@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch 2 times, most recently from ae2cf5c to 9e55306 Compare September 27, 2026 06:16
@ilikesn0w ilikesn0w changed the title Implement SimpleInputEx protocol on top of AppleEvent Implement SimpleTextInputEx protocol on top of Apple Event and SimpleTextInput protocols Oct 4, 2026
@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch from 9e55306 to 89c7e81 Compare October 4, 2026 16:15
@ilikesn0w ilikesn0w changed the title Implement SimpleTextInputEx protocol on top of Apple Event and SimpleTextInput protocols Implement SimpleTextInputEx protocol on top of AppleEvent and SimpleTextInput protocols Oct 4, 2026
@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch 2 times, most recently from 2ae5730 to e4aa48f Compare October 12, 2026 07:48
@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch 2 times, most recently from 1d3381b to 05523f6 Compare October 23, 2026 14:13
Comment thread Docs/Configuration.tex Resolved
@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch 2 times, most recently from 375a51b to ce20ab8 Compare October 31, 2026 18:32
@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch from ce20ab8 to d6655d2 Compare October 31, 2026 20:05
@ilikesn0w
ilikesn0w requested a review from vit9696 November 1, 2026 10:32

@vit9696 vit9696 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All in all this looks about right, though I am slightly worried whether the implementation is good enough for all quirky usage scenarios. Initialisation is a bit ugly, I left a few more comments on its.

@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch from d6655d2 to 75986ea Compare November 1, 2026 14:09
@ilikesn0w

Copy link
Copy Markdown
Contributor Author

Resolved some comments.

@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch from 75986ea to f134de7 Compare November 1, 2026 14:14
Comment thread Docs/Configuration.tex Resolved
@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch 3 times, most recently from b8cba2b to d9c7ec7 Compare November 1, 2026 16:07
@ilikesn0w
ilikesn0w requested a review from vit9696 November 1, 2026 20:27
@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch 2 times, most recently from 581f3a6 to 7693067 Compare November 1, 2026 21:59
@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch 6 times, most recently from 5a1273d to 5cb317d Compare November 7, 2026 19:18
@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch 2 times, most recently from 387e5de to bd66415 Compare November 19, 2026 11:55
Comment thread Library/OcMainLib/OpenCoreUefi.c Outdated
Comment on lines +1019 to +1025
//
// We should install it here, otherwise we'll not be able to use OEM's AppleEvent.
//
if (OcSimpleTextInputExInstallProtocol (Config->Uefi.ProtocolOverrides.SimpleTextInputEx) == NULL) {
DEBUG ((DEBUG_INFO, "OC: Failed to install simple text input ex protocol\n"));
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I moved the installation here because, when using the OEM implementation of AppleEvent, it only becomes available after the drivers have loaded.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Under OEM do you mean extracted from Apple FW and loaded via Drivers?

If so, I generally disagree, you can load it as an early driver. This change the way it is done in the PR contradicts docs.

@ilikesn0w ilikesn0w Dec 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I mean using Apple's driver from FW on real Macs (UEFI->AppleInput->AppleEvent = OEM in config), if the InEx is installed before the OEM implementation connects, the system will just freeze.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm, why so?

Do you mean we connect AppleEvent or something?

@ilikesn0w ilikesn0w Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, if we'll install protocol before OcConnectDrivers (); system will freeze or AppleEvent won't be located, I'm not at home now and I should recheck it, but I remember that if protocol is installed before OcConnectDrivers (); and we're not booting to OC from Apple BootPicker, it causes problems.

Ah, I remembered:
Initially, I wanted to propose the concept of a universal driver: OpenInExDxe, which could be used both independently of and in combination with OpenCore. When I tried to use OcSimpleTextInputExInstallProtocol in it, if I ran OC directly (with vendor AE ofc), without entering the Apple BootPicker, the system would freeze because it couldn’t find the AE. I then solved this problem using RegisterProtocolNotify, and in the current architecture, the same issue with AE availability arose, only this time it resulted in an error message and the absence of InEx.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Right, so AppleEvent is only installed on Connect?

If yes, I get a feeling my initial suggestion about putting SimpleInputEx to ProtocolOverrides looks wrong. In my opinion, we should rather subscribe to AppleEvent installation with an event. This means

  • the option should be in Input section as before.
  • we should make the option tristate: do nothing (default), install when missing, override.
    Sorry!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Once again, sorry, AppleInput, of course, as it is part of Apple stack.

@ilikesn0w ilikesn0w Dec 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Right, so AppleEvent is only installed on Connect?

Yes, and I think FastBoot module in newer FW's might be the explanation.

If yes, I get a feeling my initial suggestion about putting SimpleInputEx to ProtocolOverrides looks wrong. In my opinion, we should rather subscribe to AppleEvent installation with an event. This means

  • the option should be in Input section as before.
  • we should make the option tristate: do nothing (default), install when missing, override.
    Sorry!

Let me summarize:

  1. Move InEx to AppleInput
  2. It should have 3 modes: Disabled, Install, Override
  3. Check if AE is available, if no - subscribe to installation with an event
  4. Install InEx in OcLoadUefiInputSupport ()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well, if I understand you correctly, please check the latest force push. I'm tired today, so the code might not be very good.

@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch from 3eb9c5b to 8dd36bd Compare November 19, 2026 12:45
@ilikesn0w ilikesn0w changed the title Implement SimpleTextInputEx protocol on top of AppleEvent and SimpleTextInput protocols Implement SimpleTextInputEx protocol on top of AppleEvent, AppleKeyMapAggregator and SimpleTextInput protocols Nov 19, 2026
@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch 4 times, most recently from 1f57c34 to 32c2158 Compare November 25, 2026 14:07
@ilikesn0w

Copy link
Copy Markdown
Contributor Author

Again some changes:

  1. mTextIn now lives in OC_SIMPLE_TEXT_INPUT_EX_CONTEXT
  2. Removed if (mTextIn == NULL) checks since this is already checked in OcSimpleTextInputExInstallProtocol when trying to locate the protocol

@vit9696 vit9696 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks about right, but I commented on the installation logic.

@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch from a54dc23 to e7b9cbb Compare December 2, 2026 13:33
@ilikesn0w

Copy link
Copy Markdown
Contributor Author

Replaced if (mOcInExContext.AppleEvent->Revision < APPLE_EVENT_PROTOCOL_REVISION) { with if (mOcInExContext.AppleEvent->Revision <= APPLE_EVENT_PROTOCOL_REVISION_MINIMUM) {

@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch 2 times, most recently from 3855939 to 6b580e4 Compare December 2, 2026 22:59
@ilikesn0w
ilikesn0w requested a review from vit9696 December 2, 2026 23:33

@vit9696 vit9696 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, last notes, thank you!

Comment thread Docs/Configuration.tex Outdated
\tightlist
\item \texttt{Disabled} --- Do nothing.
\item \texttt{Install} --- Try to install OpenCore's builtin implementation, if no vendor one.
\item \texttt{Override} --- Reinstall all \texttt{SimpleTextInputEx} instances and try to install OpenCore's builtin implementation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Uninstall?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, sorry for that, I was tired.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread Library/OcMainLib/OpenCoreUefiInOut.c Outdated

STATIC
VOID
OcInputRegisterAppleEventNotify (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In my opinion! move this logic to the OcSimpleTextInputLib library, so that it creates an event itself.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread Library/OcMainLib/OpenCoreUefiInOut.c Outdated

STATIC
BOOLEAN
OcInputEnsureInAppleEventAvailability (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You will not need this after you move to the lib.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch from 6b580e4 to 985f424 Compare December 3, 2026 16:13
@ilikesn0w

Copy link
Copy Markdown
Contributor Author

@vit9696 , done.

@ilikesn0w
ilikesn0w requested a review from vit9696 December 3, 2026 16:14
Comment thread Library/OcMainLib/OpenCoreUefiInOut.c Outdated

InExStr = OC_BLOB_GET (&Config->Uefi.AppleInput.SimpleTextInputEx);

if (AsciiStrCmp (InExStr, "Disabled") != 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This logic is garbage, it treats Disabled as invalid and prints a warning.

We are not meant to validate every possible value in OpenCore. This is what ocvalidate is for. In OC the behaviour is undefined if invalid value is specified. In my opinion, rewrite like this:

  if (AsciiStrCmp (InExStr, "Disabled") != 0
    && OcSimpleTextInputExInstallProtocol (AsciiStrCmp (InExStr, "Override") == 0) == NULL) {
    DEBUG ((DEBUG_INFO, "OC: Failed to install simple text input ex\n"));
  }

@ilikesn0w ilikesn0w Dec 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed, but personally I don't like that if Uefi.AppleInput.SimpleTextInputEx has any value other than Disabled or Override, the Install mode is used. I wanted to implement something like this https://github.com/acidanthera/OpenCorePkg/blob/master/Library/OcMainLib/OpenCoreUefi.c#L450-#L459

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can propose something like:

if (AsciiStrCmp (InExStr, "Install") == 0) {
    if (OcSimpleTextInputExInstallProtocol (FALSE) == NULL) {
      DEBUG ((DEBUG_INFO, "OC: Failed to install simple text input ex\n"));
    }
  } else if (AsciiStrCmp (InExStr, "Override") == 0) {
    if (OcSimpleTextInputExInstallProtocol (TRUE) == NULL) {
      DEBUG ((DEBUG_INFO, "OC: Failed to override simple text input ex\n"));
    }
  } else if (AsciiStrCmp (InExStr, "Disabled") == 0) {
    //
    // Do nothing.
    //
  } else {
    DEBUG ((DEBUG_INFO, "OC: Invalid SimpleTextInputEx setting %a, using Disabled\n", InExStr));
  }

@ilikesn0w
ilikesn0w force-pushed the ilikesn0w-inex-20260919 branch from 985f424 to 46b03b6 Compare December 3, 2026 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Implement SimpleInputEx protocol on top of SimpleInput or AppleEvent

2 participants