Jump to content

Trung_Nguyen

Members
  • Content count

    68
  • Joined

  • Last visited

About Trung_Nguyen

  • Rank
    InsanelyMac Protégé

Profile Information

  • Gender
    Male
  • Location
    Hanoi, Vietnam
  1. Clover General discussion

    Oh I have AptioInputFix now, Why do I need a PS2 Driver anymore? What I'm trying to get now is to get the Alt/Option (modifiers) is recognized when pressed just that key. I think it is possible because in the keyboard viewer, when you pressed a modifier, it still show it. EDIT: Currently I worked around by holding another key with alt(Alt+C) for GUI, what do you think? cmd+R: boot.efi doesn't chain-load to the Recovery's boot.efi. Maybe we have to find a way for it to find the Recovery partition when found the cmd+R
  2. Clover General discussion

    I read it. I didn't calling it in a loop. Just once in Refitmain? main.c.zip EDIT: Wait a min, so it write asynchronously to the array which is point in the parameter? I thought it was the immediate result. Sorry
  3. Clover General discussion

    Protocol's ReadKeyState will take forever while you hold the combination! Also GRUB's KeyStatus can fetch the state of modifier keys, can it be used?
  4. Clover General discussion

    Currently, I'm working to make all Apple Boot Keys works(for AMI Aptio boards, at least for laptops) even the alt key. Trying to make the AptioInputFix more useful , attempt to make it to sent modifier key like Alt for GUI, Shift for Safe Mode.
  5. Clover General discussion

    If you couldn't understand what I meant, then run it by your self This is the diff patch, try changing the LazyClover variable: Index: CloverPkg.dec =================================================================== --- CloverPkg.dec (revision 4415) +++ CloverPkg.dec (working copy) @@ -70,6 +70,8 @@ ## Include/Protocol/EmuVariableControl.h gEmuVariableControlProtocolGuid = {0x21f41e73, 0xd214, 0x4fcd, {0x85, 0x50, 0x0d, 0x11, 0x51, 0xcf, 0x8e, 0xfb }} + ## Include/Protocol/AppleKeyState.h + gAppleKeyStateProtocolGuid = {0x5b213447, 0x6e73, 0x4901, {0xa4, 0xf1, 0xb8, 0x64, 0xf3, 0xb7, 0xa1, 0x72}} #Apple's protocols gEfiConsoleControlProtocolGuid = {0xF42F7782, 0x012E, 0x4C12, {0x99, 0x56, 0x49, 0xF9, 0x43, 0x04, 0xF7, 0x21}} Index: Include/Protocol/AppleKeyAggregator.h =================================================================== --- Include/Protocol/AppleKeyAggregator.h (revision 4415) +++ Include/Protocol/AppleKeyAggregator.h (working copy) @@ -5,7 +5,8 @@ // Created by Slice on 26.10.16. // based on CupertinoNet // - +#include <Protocol/AppleKeyState.h> +#include <Protocol/AppleKeyMapDatabase.h> #ifndef _AppleKeyMapAggregator_h #define _AppleKeyMapAggregator_h Index: Protocols/AppleKeyAggregator/AppleKeyAggregator.c =================================================================== --- Protocols/AppleKeyAggregator/AppleKeyAggregator.c (revision 4415) +++ Protocols/AppleKeyAggregator/AppleKeyAggregator.c (working copy) @@ -19,7 +19,7 @@ #include <Protocol/AppleKeyState.h> #include <Protocol/AppleKeyMapDatabase.h> -#include "AppleKeyAggregator.h" +#include <Protocol/AppleKeyAggregator.h> // KeyMapGetKeyStrokesByIndex APPLE_KEY_STROKES_INFO * Index: Protocols/AppleKeyAggregator/AppleKeyAggregator.h =================================================================== --- Protocols/AppleKeyAggregator/AppleKeyAggregator.h (revision 4415) +++ Protocols/AppleKeyAggregator/AppleKeyAggregator.h (nonexistent) @@ -1,81 +0,0 @@ -// -// AppleKeyMapAggregator.h -// -// -// Created by Slice on 26.10.16. -// based on CupertinoNet -// - -#ifndef _AppleKeyMapAggregator_h -#define _AppleKeyMapAggregator_h - -#define APPLE_KEY_MAP_PROTOCOLS_REVISION 0x010000 -#define APPLE_KEY_MAP_AGGREGATOR_SIGNATURE SIGNATURE_32 ('K', 'e', 'y', 'A') - -#define APPLE_KEY_STROKES_INFO_SIGNATURE SIGNATURE_32 ('K', 'e', 'y', 'S') - -#define APPLE_KEY_MAP_AGGREGATOR_PRIVATE_FROM_AGGREGATOR(This) \ - CR ( \ - (This), \ - APPLE_KEY_MAP_AGGREGATOR, \ - AggregatorProtocol, \ - APPLE_KEY_MAP_AGGREGATOR_SIGNATURE \ - ) - -#define APPLE_KEY_MAP_AGGREGATOR_PRIVATE_FROM_DATABASE(This) \ - CR ( \ - (This), \ - APPLE_KEY_MAP_AGGREGATOR, \ - DatabaseProtocol, \ - APPLE_KEY_MAP_AGGREGATOR_SIGNATURE \ - ) - -#define APPLE_KEY_STROKES_INFO_FROM_LIST_ENTRY(Entry) \ -((APPLE_KEY_STROKES_INFO *)( \ - CR ( \ - (Entry), \ - APPLE_KEY_STROKES_INFO_HDR, \ - This, \ - APPLE_KEY_STROKES_INFO_SIGNATURE \ - ) \ -)) -/* -typedef struct _EFI_LIST_ENTRY { - struct _EFI_LIST_ENTRY *ForwardLink; - struct _EFI_LIST_ENTRY *BackLink; -} EFI_LIST_ENTRY; - -typedef EFI_LIST_ENTRY EFI_LIST; -*/ - -// APPLE_KEY_STROKES_INFO_HDR -typedef struct { - UINTN Signature; ///< - LIST_ENTRY This; ///< - UINTN Index; ///< - UINTN KeyBufferSize; ///< - UINTN NumberOfKeys; ///< - APPLE_MODIFIER_MAP Modifiers; ///< -} APPLE_KEY_STROKES_INFO_HDR; - -// APPLE_KEY_STROKES_INFO -typedef struct { - APPLE_KEY_STROKES_INFO_HDR Hdr; ///< - APPLE_KEY Keys; ///< -} APPLE_KEY_STROKES_INFO; - - -// APPLE_KEY_MAP_AGGREGATOR -typedef struct { - UINTN Signature; ///<0 - UINTN NextKeyStrokeIndex; ///<0x08 - APPLE_KEY *KeyBuffer; ///<0x10 - UINTN KeyBuffersSize; ///<0x18 - LIST_ENTRY KeyStrokesInfoList; ///<0x20 - APPLE_KEY_MAP_DATABASE_PROTOCOL DatabaseProtocol; ///<0x30 size=8*4 - APPLE_KEY_STATE_PROTOCOL AggregatorProtocol; ///<0x50 size=8*3 -} APPLE_KEY_MAP_AGGREGATOR; //size=0x68 - - - -#endif Index: Xcode/Clover/Clover.xcodeproj/project.pbxproj =================================================================== --- Xcode/Clover/Clover.xcodeproj/project.pbxproj (revision 4415) +++ Xcode/Clover/Clover.xcodeproj/project.pbxproj (working copy) @@ -1208,7 +1208,6 @@ isa = PBXGroup; children = ( 12AAF5F21DC0F03B00A52B12 /* AppleKeyAggregator.c */, - 12AAF5F31DC0F03B00A52B12 /* AppleKeyAggregator.h */, 12AAF5F41DC0F03B00A52B12 /* AppleKeyAggregator.inf */, ); path = AppleKeyAggregator; @@ -2744,6 +2743,7 @@ 2C794ADC1A0AA85900D845B0 /* Protocol */ = { isa = PBXGroup; children = ( + 12AAF5F31DC0F03B00A52B12 /* AppleKeyAggregator.h */, 2C794AD21A0AA85900D845B0 /* AppleDeviceControl.h */, 2C794AD31A0AA85900D845B0 /* AppleDiskIo.h */, 12AAF5171DBE28B800A52B12 /* AppleEvent.h */, Index: rEFIt_UEFI/Platform/Platform.h =================================================================== --- rEFIt_UEFI/Platform/Platform.h (revision 4415) +++ rEFIt_UEFI/Platform/Platform.h (working copy) @@ -65,6 +65,7 @@ #include <Protocol/EmuVariableControl.h> #include <Protocol/AppleSMC.h> #include <Protocol/AppleImageCodecProtocol.h> +#include <Protocol/AppleKeyAggregator.h> #include "../refit/lib.h" #include "string.h" Index: rEFIt_UEFI/refit/main.c =================================================================== --- rEFIt_UEFI/refit/main.c (revision 4415) +++ rEFIt_UEFI/refit/main.c (working copy) @@ -39,7 +39,6 @@ //#include "../include/Handle.h" #include "Version.h" - #ifndef DEBUG_ALL #define DEBUG_MAIN 1 #else @@ -84,6 +83,8 @@ EMU_VARIABLE_CONTROL_PROTOCOL *gEmuVariableControl = NULL; +APPLE_KEY_STATE_PROTOCOL *gAppleKeyState=NULL; + extern VOID HelpRefit(VOID); extern VOID AboutRefit(VOID); extern BOOLEAN BooterPatch(IN UINT8 *BooterData, IN UINT64 BooterSize, LOADER_ENTRY *Entry); @@ -1868,7 +1869,6 @@ RecIter++; } } - // // main entry point // @@ -1897,7 +1897,10 @@ EFI_TIME Now; BOOLEAN HaveDefaultVolume; CHAR16 *FirstMessage; - + APPLE_MODIFIER_MAP ModifyFlags; + UINTN PressedKeyCount; + APPLE_KEY *Keys=NULL; + BOOLEAN LazyClover=TRUE; // CHAR16 *InputBuffer; //, *Y; // EFI_INPUT_KEY Key; @@ -1908,7 +1911,7 @@ // get TSC freq and init MemLog if needed gCPUStructure.TSCCalibr = GetMemLogTscTicksPerSecond(); //ticks for 1second //GlobalConfig.TextOnly = TRUE; - + // bootstrap gST = SystemTable; gImageHandle = ImageHandle; @@ -2126,8 +2129,29 @@ //DBG("LoadDrivers() start\n"); LoadDrivers(); - //DBG("LoadDrivers() end\n"); - + //DBG("LoadDrivers() end\n"); + //If Clover is too lazy, he will let boot.efi handle the stuff + if(!LazyClover){ + Status=gBS->LocateProtocol(&gAppleKeyStateProtocolGuid,NULL,(VOID**)&gAppleKeyState); + if(EFI_ERROR(Status)) + { + gAppleKeyState=NULL; + } + if(Status==EFI_SUCCESS) + { + DBG("Protocol Located!\n"); + Status=gAppleKeyState->ReadKeyState(gAppleKeyState,&ModifyFlags,&PressedKeyCount,Keys); + if(Status==EFI_SUCCESS) + { + DBG("ReadKeyState Succeesful\n"); + DBG("PressedKeyCount:%d!\n",PressedKeyCount); + for(i=0;i<PressedKeyCount;i++) + { + DBG("Keys:",Keys[i],"\n"); + } + } + }} + /* if (!gFirmwareClover && !gDriversFlags.EmuVariableLoaded) { GetSmcKeys(FALSE); // later we can get here SMC information Index: rEFIt_UEFI/refit.inf =================================================================== --- rEFIt_UEFI/refit.inf (revision 4415) +++ rEFIt_UEFI/refit.inf (working copy) @@ -251,7 +251,7 @@ gMsgLogProtocolGuid gEfiPlatformDriverOverrideProtocolGuid gEmuVariableControlProtocolGuid - + gAppleKeyStateProtocolGuid [FeaturePcd] gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport
  6. Clover General discussion

    I don't remove any keys from the buffer, just read it. Inspected with ReadKeyStroke Function, found out that if the protocol is define in CloverPkg.dec & not Located by Clover and then boot.efi will handle it and parse -v/-s but Shift not work, not even by Clover/boot.efi as it is the modifier. Any solutions here?
  7. Clover General discussion

    Probably USB HID: Check this out: https://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-1035.41.2/IOHIDFamily/AppleEmbeddedKeyboard.cpp.auto.html
  8. Clover General discussion

    humm, I thought Built-in Apple Keyboard on MacBook are connected by PS2? So It is by USB?
  9. Clover General discussion

    ???? What do you mean. I use PS2 Keyboard and it recognized single modifier key too. Did you mean that the APPLE_KEY_MAP_DATABASE_PROTOCOL was designed for USB HID?
  10. Clover General discussion

    I use all PS/2, I don't have even a single USB Keyboard in my house Anyway, I don't understand what do you mean by non-exclusive here?
  11. Clover General discussion

    Not really sure. when i turn on logscancodes with appleps2keyboard, it also sent modifier(except Fn) as seperate key . Just discovered: If you don't Locate the Apple Key State Protocol, boot.efi will able to handle Cmd+V Choice should be made here: Key process by clover or boot.efi ?
  12. Clover General discussion

    Well, just wonder why when you open the Keyboard Viewer on mac, you can see single Shift, Ctrl, Alt,Cmd are recognized?
  13. Clover General discussion

    Couldn't ReadKeyState. always return 0, any suggestions, guys?
  14. Clover General discussion

    Hello, What is this in the code?: //dumping SETTING structure // if you change something in Platform.h, please uncomment and test that all offsets // are natural aligned i.e. pointers are 8 bytes aligned Result: 0:100 0:000 Settings offsets: 0:100 0:000 OEMProduct: 218 0:100 0:000 DefaultVolume: 720 0:100 0:000 DefaultLoader: 728 0:100 0:000 ResetAddr: 748 0:100 0:000 FixDsdt: 7A4 0:100 0:000 FakeATI: 7B0 0:100 0:000 PatchVBiosBytes:7E0 0:100 0:000 VRAM: 830 0:100 0:000 SecureBootWhiteListCount: 860 0:100 0:000 LegacyBoot: 888 0:100 0:000 HVHideStrings: 8D0 0:100 0:000 PointerSpeed: 958 0:100 0:000 RtMLB: 980 0:100 0:000 ConfigName: 9A0 0:100 0:000 PointerSpeed: 958 0:100 0:000 PatchDsdtNum: 9E4 0:100 0:000 LenToReplace: A00 0:100 0:000 ACPIDropTables: A10 0:100 0:000 CustomEntries: A20 0:100 0:000 CustomTool: A30 0:100 0:000 AddProperties: A40 0:100 0:000 BlockKexts: A48 Is that OK?
  15. Clover General discussion

    GOT IT WORKING:Apple boot key. Just test it with CMD+V Currently trying to get the alt key to invoke GUI
×