Repository navigation
Implement SimpleTextInputEx protocol on top of AppleEvent, AppleKeyMapAggregator and SimpleTextInput protocols - #632
Conversation
95027a3 to
0df8398
Compare
|
I can also suggest creating a |
ae2cf5c to
9e55306
Compare
9e55306 to
89c7e81
Compare
2ae5730 to
e4aa48f
Compare
1d3381b to
05523f6
Compare
375a51b to
ce20ab8
Compare
ce20ab8 to
d6655d2
Compare
vit9696
left a comment
There was a problem hiding this comment.
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.
d6655d2 to
75986ea
Compare
|
Resolved some comments. |
75986ea to
f134de7
Compare
b8cba2b to
d9c7ec7
Compare
581f3a6 to
7693067
Compare
5a1273d to
5cb317d
Compare
387e5de to
bd66415
Compare
| // | ||
| // 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")); | ||
| } | ||
|
|
There was a problem hiding this comment.
I moved the installation here because, when using the OEM implementation of AppleEvent, it only becomes available after the drivers have loaded.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Hmmm, why so?
Do you mean we connect AppleEvent or something?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
Once again, sorry, AppleInput, of course, as it is part of Apple stack.
There was a problem hiding this comment.
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:
- Move InEx to AppleInput
- It should have 3 modes: Disabled, Install, Override
- Check if AE is available, if no - subscribe to installation with an event
- Install InEx in OcLoadUefiInputSupport ()
There was a problem hiding this comment.
Well, if I understand you correctly, please check the latest force push. I'm tired today, so the code might not be very good.
3eb9c5b to
8dd36bd
Compare
1f57c34 to
32c2158
Compare
|
Again some changes:
|
vit9696
left a comment
There was a problem hiding this comment.
This looks about right, but I commented on the installation logic.
a54dc23 to
e7b9cbb
Compare
|
Replaced |
3855939 to
6b580e4
Compare
vit9696
left a comment
There was a problem hiding this comment.
Looks good to me, last notes, thank you!
| \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. |
There was a problem hiding this comment.
Ah, sorry for that, I was tired.
|
|
||
| STATIC | ||
| VOID | ||
| OcInputRegisterAppleEventNotify ( |
There was a problem hiding this comment.
In my opinion! move this logic to the OcSimpleTextInputLib library, so that it creates an event itself.
|
|
||
| STATIC | ||
| BOOLEAN | ||
| OcInputEnsureInAppleEventAvailability ( |
There was a problem hiding this comment.
You will not need this after you move to the lib.
6b580e4 to
985f424
Compare
|
@vit9696 , done. |
|
|
||
| InExStr = OC_BLOB_GET (&Config->Uefi.AppleInput.SimpleTextInputEx); | ||
|
|
||
| if (AsciiStrCmp (InExStr, "Disabled") != 0) { |
There was a problem hiding this comment.
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"));
}There was a problem hiding this comment.
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
There was a problem hiding this comment.
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));
}…pAggregator and SimpleTextInput protocols
985f424 to
46b03b6
Compare
Implemented
SimpleTextInputExprotocol on top ofAppleEventandSimpleTextInputprotocols. Tested it witheditin OpenShell onMacBookPro9,2, and it fully worksCloses: acidanthera/bugtracker#1080