From 405ed6878815591d7fa234acdfdacce3465132f1 Mon Sep 17 00:00:00 2001 From: Tyler Nguyen Date: Thu, 21 May 2020 17:41:26 -0500 Subject: [PATCH] LED and HUD support for various Fn key functions with ThinkpadAssistant --- EFI-OpenCore/EFI/OC/ACPI/SSDT-Keyboard.aml | Bin 1579 -> 1906 bytes README.md | 17 +-- docs/4_README-ACPIpatching.md | 14 +- docs/5_README-other.md | 6 +- docs/CHANGELOG.md | 11 ++ .../BetterTouchTool/x1c6-functions.bttpreset | 119 +++------------- patches/SSDT-Keyboard.dsl | 132 ++++++++++++------ 7 files changed, 134 insertions(+), 165 deletions(-) diff --git a/EFI-OpenCore/EFI/OC/ACPI/SSDT-Keyboard.aml b/EFI-OpenCore/EFI/OC/ACPI/SSDT-Keyboard.aml index 3d8fb4efbe83e01f7952611c03a81c27997e0db3..8ad074df85ffdf3fd37f653de969350583a5064c 100644 GIT binary patch delta 332 zcmZ3@^NEiuIM^kmh@F9fDP|&fMogXm;KCgF`XOpG!DZrb`R@xe~<0nVNVJ^{{7 zuFmoCBCag)fo6`A9hp^_?3gDjGK+6+VA5t}assm_A7R#=tjH?GVFpoW09Ka`mg6)t bfCw6b1ShX%mYV#PMQ8FyW~t5AtmaGr;5#7} diff --git a/README.md b/README.md index 190f5a6..b8411e0 100644 --- a/README.md +++ b/README.md @@ -25,16 +25,17 @@ ##### Recent | [Changelog Archive](https://github.com/tylernguyen/x1c6-hackintosh/docs/CHANGELOG.md) -> ### 2020-5-9 +> ### 2020-5-21 #### Changed -- Upgraded OpenCore to 0.5.8 -- Upgraded various acidanthera kexts. -- Fixed various dortania broken guide links. -- Removed `TbtForcePower.efi` from LiveUSB OpenCore `config.plist` -- Added PM981 install suggestions per [Issue #43](https://github.com/tylernguyen/x1c6-hackintosh/issues/43) -- Changed ScanPolicy of `install_USB` to 0. +Keyboard Perfection is almost here! +- Modified SSDT-Keyboard patch to be compatible with [ThinkpadAssistant](https://github.com/MSzturc/ThinkpadAssistant). + - Mute/unMute Microphone with F4, with LED, and HUD! + - Disable WiFi with F8 with HUD + - Mirror with F7 with HUD + - Bluetooth, F10 still has to be handled by BetterTouchTool, but hopefully supported will be added soon. See my [request](https://github.com/MSzturc/ThinkpadAssistant/issues/9) + > ## SUMMARY: @@ -45,7 +46,7 @@ | WiFi, Bluetooth, Apple Continuity ✅ \*need [network card replacement](https://github.com/tylernguyen/x1c6-hackintosh/blob/master/docs/1_README-HARDWAREandBIOS.md) | Fingerprint Reader (not needed, DISABLED at BIOS) ❌ | Video Output: Currently only output `2560x1440`. Though capable of 4K `4096x2150`. See [Issue #40](https://github.com/tylernguyen/x1c6-hackintosh/issues/40) ⚠️ | | USB A, USB C, Webcam, Audio Playback/Recording Sleep, Ethernet, Intel Graphics, TrackPoint and Trackpad, MicroSD card reader ✅ | Wireless WAN (DISABLED at BIOS) \*ENABLED if you have a 2nd drive connected❌ | Thunderbolt 3 hotplug partially working. See [Issue #24](https://github.com/tylernguyen/x1c6-hackintosh/issues/24#issuecomment-603183002) ⚠️ | | iCloud suite: App Store, iMessage, FaceTime, iCloud Drive, etc... ✅ | Hibernation ❌ | Power management and optimizations. See [Issue #28](https://github.com/tylernguyen/x1c6-hackintosh/issues/28) ⚠️ | -| Multimedia Fn keys ✅ \*need [Karabiner Elements](https://ke-complex-modifications.pqrs.org/) and [BetterTouchTool](https://folivora.ai/) | | | +| Multimedia Fn keys ✅ \*need [Karabiner Elements](https://ke-complex-modifications.pqrs.org/), [ThinkpadAssistant](https://github.com/MSzturc/ThinkpadAssistant), and [BetterTouchTool](https://folivora.ai/) | | | | PM981 installation. ✅ See [Issue #43](https://github.com/tylernguyen/x1c6-hackintosh/issues/43) | | | **For more information regarding certain features, please refer to [`docs/3_README-POSTinstallation.md`](https://github.com/tylernguyen/x1c6-hackintosh/blob/master/docs/3_README-POSTinstallation.md)** diff --git a/docs/4_README-ACPIpatching.md b/docs/4_README-ACPIpatching.md index 1c2679f..08424c6 100644 --- a/docs/4_README-ACPIpatching.md +++ b/docs/4_README-ACPIpatching.md @@ -82,15 +82,15 @@ Used in conjuction with `WhateverGreen.kext` Keyboard path is `\ _SB.PCI0.LPCB.KBD`.   For multimedia functions: -- Remap 1: F4 (Network) to F4 +- Remap 1: F4 (Network) to F20 (for use with ThinkpadAssistant) - Remap 2: F5 (Brightness Down) - Remap 3: F6 (Brightness Up) -- Remap 4: F7 (Dual Display) to F16 -- Remap 5: F8 (Network) to F8 -- Remap 6: F9 (Settings) to F19 -- Remap 7: F10 (Bluetooth) to F20 -- Remap 8: F11 (Keyboard) to F17 -- Remap 9: F12 (Star) to F18 +- Remap 4: F7 (Dual Display) to F16 (for use with ThinkpadAssistant) +- Remap 5: F8 (Network) to F17 (for use with ThinkpadAssistant) +- Remap 6: F9 (Settings) to F18 (for use with ThinkpadAssistant) +- Remap 7: F10 (Bluetooth) to [Shift+Down] +- Remap 8: F11 (Keyboard) to [Shift+Up] +- Remap 9: F12 (Star) to F19 (for use with ThinkpadAssistant) - Remap 10: PrtSc to F13 - Remap 11: Fn + K to Deadkey - Remap 12: Fn + P to Deadkey diff --git a/docs/5_README-other.md b/docs/5_README-other.md index e4944aa..e8d9f1a 100644 --- a/docs/5_README-other.md +++ b/docs/5_README-other.md @@ -18,14 +18,12 @@ By default, Windows, Left Alt, and Right Alt are mismapped. An easy fix for this > ## Multimedia Fn Key Patching: -Since macOS doesn't not natively support some multimedia Fn key actions. BetterTouchTool is required to program these actions. Keyboard Mastero is also an alternative but I've found that BetterTouchTool is a simpler and easier option. +Since macOS doesn't not natively support some multimedia Fn key actions. [ThinkpadAssistant](https://github.com/MSzturc/ThinkpadAssistant) is required for the Fn actions to be implemented. +The Fn key not yet supported by ThinkPadAssistant is F10: Bluetooth Toggle. So BetterTouchTool is required to program F10. Keyboard Mastero is also an alternative but I've found that BetterTouchTool is a simpler and easier option. But generally speaking, BetterTouchTool is a useful productivity program that I recommend to everyone. Simply import `patches/BetterTouchTool/x1c6-functions.bttpreset`. My settings are as followed: -- F7 = Screen Mirroring On/Off -- F9 = Open System Preferences - F10 = Toggle Bluetooth On/Off - F11 = Switch Keyboard Input Language (Set in System `Preferences/Keyboard`) -- F12 = Open Terminal - PrtSc = Window Screen Capture Of course, feel free to change this to your preference in BetterTouchTool. diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6db007e..93fafd5 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +> ### 2020-5-21 + +#### Changed + +Keyboard Perfection is almost here! +- Modified SSDT-Keyboard patch to be compatible with [ThinkpadAssistant](https://github.com/MSzturc/ThinkpadAssistant). + - Mute/unMute Microphone with F4, with LED! + - Disable WiFi with F8 + - Mirror with F7 + - Bluetooth, F10 still has to be handled by BetterTouchTool, but hopefully supported will be added soon. See my [request](https://github.com/MSzturc/ThinkpadAssistant/issues/9) + > ### 2020-5-9 #### Changed diff --git a/patches/BetterTouchTool/x1c6-functions.bttpreset b/patches/BetterTouchTool/x1c6-functions.bttpreset index d69c331..66af9ea 100644 --- a/patches/BetterTouchTool/x1c6-functions.bttpreset +++ b/patches/BetterTouchTool/x1c6-functions.bttpreset @@ -1,8 +1,16 @@ { "BTTPresetName" : "x1c6-functions", "BTTPresetColor" : "78.353000, 224.400000, 65.076000, 255.000000", - "BTTPresetUUID" : "638322AA-15F8-437F-A884-69D474E856F7", + "BTTPresetUUID" : "6FD39F6E-967D-44EE-A00F-F3EAB1E65424", "BTTPresetContent" : [ + { + "BTTAppBundleIdentifier" : "com.apple.finder", + "BTTAppName" : "Finder", + "BTTAppAutoInvertIcon" : 1, + "BTTTriggers" : [ + + ] + }, { "BTTAppBundleIdentifier" : "BT.G", "BTTAppName" : "Global", @@ -29,92 +37,13 @@ "BTTDisplayOrder" : 0, "BTTAutoAdaptToKeyboardLayout" : 0, "BTTAdditionalActions" : [ - { - "BTTGestureNotes" : "F7 = Toggle Display Mirroring", - "BTTTriggerType" : 0, - "BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut", - "BTTPredefinedActionType" : 266, - "BTTPredefinedActionName" : "Toggle Display Mirroring On\/Off", - "BTTAdditionalConfiguration" : "8388608", - "BTTEnabled2" : 1, - "BTTKeyboardShortcutScope" : 1, - "BTTKeyboardShortcutKeyboardType" : 0, - "BTTRepeatDelay" : 0, - "BTTUUID" : "2B2A7AB6-EA55-4896-AC67-B9F10E7048A0", - "BTTTriggerOnDown" : 1, - "BTTNotesInsteadOfDescription" : 0, - "BTTLayoutIndependentChar" : "F16", - "BTTEnabled" : 1, - "BTTModifierMode" : 0, - "BTTShortcutKeyCode" : 106, - "BTTShortcutModifierKeys" : 8388608, - "BTTOrder" : 0, - "BTTDisplayOrder" : 0, - "BTTAutoAdaptToKeyboardLayout" : 0, - "BTTTriggerConfig" : { - "BTTKeyboardShortcutScope" : 1 - } - }, - { - "BTTGestureNotes" : "F9 = Launch System Preferences", - "BTTTriggerType" : 0, - "BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut", - "BTTPredefinedActionType" : 49, - "BTTPredefinedActionName" : "Launch Application \/ Open File \/ Start Apple Script …", - "BTTLaunchPath" : "file:\/\/\/System\/Applications\/System%20Preferences.app", - "BTTAdditionalConfiguration" : "8388608", - "BTTEnabled2" : 1, - "BTTKeyboardShortcutScope" : 1, - "BTTKeyboardShortcutKeyboardType" : 0, - "BTTRepeatDelay" : 0, - "BTTUUID" : "CEE18E36-8CBA-4D0B-B480-8C9027F034CC", - "BTTTriggerOnDown" : 1, - "BTTNotesInsteadOfDescription" : 0, - "BTTLayoutIndependentChar" : "F19", - "BTTEnabled" : 1, - "BTTModifierMode" : 0, - "BTTShortcutKeyCode" : 80, - "BTTShortcutModifierKeys" : 8388608, - "BTTOrder" : 1, - "BTTDisplayOrder" : 0, - "BTTAutoAdaptToKeyboardLayout" : 0, - "BTTTriggerConfig" : { - "BTTKeyboardShortcutScope" : 1 - } - }, - { - "BTTGestureNotes" : "F10 = Toggle Bluetooth", - "BTTTriggerType" : 0, - "BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut", - "BTTPredefinedActionType" : 279, - "BTTPredefinedActionName" : "Toggle Bluetooth Enabled\/Disabled", - "BTTAdditionalConfiguration" : "0", - "BTTEnabled2" : 1, - "BTTKeyboardShortcutScope" : 1, - "BTTKeyboardShortcutKeyboardType" : 0, - "BTTRepeatDelay" : 0, - "BTTUUID" : "609D822A-B55F-46FB-8F90-DFDBDE09ED92", - "BTTTriggerOnDown" : 1, - "BTTNotesInsteadOfDescription" : 0, - "BTTLayoutIndependentChar" : "", - "BTTEnabled" : 1, - "BTTModifierMode" : 0, - "BTTShortcutKeyCode" : 90, - "BTTShortcutModifierKeys" : 8388608, - "BTTOrder" : 2, - "BTTDisplayOrder" : 0, - "BTTAutoAdaptToKeyboardLayout" : 0, - "BTTTriggerConfig" : { - "BTTKeyboardShortcutScope" : 1 - } - }, { "BTTGestureNotes" : "PrtSc = Window Screen Capture", "BTTTriggerType" : 0, "BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut", "BTTPredefinedActionType" : 169, "BTTPredefinedActionName" : "Capture Screenshot (Configurable)", - "BTTScreenshotOptions" : "-i;;-w;;-t;;png;;BTTAdditionallyCopyToClipboard;;\/Users\/jessica\/Pictures\/Screenshot_{datetime}_{random}.png;;", + "BTTScreenshotOptions" : "-i;;-W;;-t;;png;;BTTAdditionallyCopyToClipboard;;\/Users\/jessica\/Pictures\/Screenshot_{datetime}_{random}.png;;", "BTTScreenshotDateFormat" : "yyyy-MM-dd HH.mm.ss", "BTTAdditionalConfiguration" : "8388608", "BTTEnabled2" : 1, @@ -129,7 +58,7 @@ "BTTModifierMode" : 0, "BTTShortcutKeyCode" : 105, "BTTShortcutModifierKeys" : 8388608, - "BTTOrder" : 3, + "BTTOrder" : 0, "BTTDisplayOrder" : 0, "BTTAutoAdaptToKeyboardLayout" : 0, "BTTTriggerConfig" : { @@ -137,26 +66,24 @@ } }, { - "BTTGestureNotes" : "F12 = Favorite App", "BTTTriggerType" : 0, "BTTTriggerClass" : "BTTTriggerTypeKeyboardShortcut", - "BTTPredefinedActionType" : 49, - "BTTPredefinedActionName" : "Launch Application \/ Open File \/ Start Apple Script …", - "BTTLaunchPath" : "file:\/\/\/System\/Applications\/Utilities\/Terminal.app", - "BTTAdditionalConfiguration" : "8388608", + "BTTPredefinedActionType" : 279, + "BTTPredefinedActionName" : "Toggle Bluetooth Enabled\/Disabled", + "BTTAdditionalConfiguration" : "9437200", "BTTEnabled2" : 1, "BTTKeyboardShortcutScope" : 1, "BTTKeyboardShortcutKeyboardType" : 0, "BTTRepeatDelay" : 0, - "BTTUUID" : "0B36F550-8965-43E7-AF7A-EAFFCF5CBC9B", + "BTTUUID" : "75218731-75FE-4B53-8C93-43D49F9A9734", "BTTTriggerOnDown" : 1, "BTTNotesInsteadOfDescription" : 0, - "BTTLayoutIndependentChar" : "F18", + "BTTLayoutIndependentChar" : "DOWN", "BTTEnabled" : 1, "BTTModifierMode" : 0, - "BTTShortcutKeyCode" : 79, - "BTTShortcutModifierKeys" : 8388608, - "BTTOrder" : 4, + "BTTShortcutKeyCode" : 125, + "BTTShortcutModifierKeys" : 9437184, + "BTTOrder" : 1, "BTTDisplayOrder" : 0, "BTTAutoAdaptToKeyboardLayout" : 0, "BTTTriggerConfig" : { @@ -166,14 +93,6 @@ ] } ] - }, - { - "BTTAppBundleIdentifier" : "com.apple.finder", - "BTTAppName" : "Finder", - "BTTAppAutoInvertIcon" : 1, - "BTTTriggers" : [ - - ] } ], "BTTPresetSnapAreas" : [ diff --git a/patches/SSDT-Keyboard.dsl b/patches/SSDT-Keyboard.dsl index dc8d8e9..6bfa990 100644 --- a/patches/SSDT-Keyboard.dsl +++ b/patches/SSDT-Keyboard.dsl @@ -11,19 +11,46 @@ DefinitionBlock("", "SSDT", 2, "OCLT", "x1input", 0) External(_SB.PCI0.LPCB.EC.XQ60, MethodObj) External(_SB.PCI0.LPCB.EC.XQ61, MethodObj) External(_SB.PCI0.LPCB.EC.XQ62, MethodObj) + External(_SB.PCI0.LPCB.EC.HKEY.MMTS, MethodObj) + External(_SB.PCI0.LPCB.EC.HKEY.MMTG, MethodObj) Scope (_SB.PCI0.LPCB.EC) { - Method (_Q6A, 0, NotSerialized) // F4 - Microphone Mute = F4 + Name (LED1, Zero) + // _Q6A - Microphone Mute + Method (_Q6A, 0, NotSerialized) // F4 - Microphone Mute = F20 { If (_OSI ("Darwin")) - { - Notify(\_SB.PCI0.LPCB.KBD, 0x033E) - } - Else - { + { + // Toggle Mute Microphone LED + If ((LED1 == Zero)) + { + // Right Shift + F20 + Notify (\_SB.PCI0.LPCB.KBD, 0x0136) + Notify (\_SB.PCI0.LPCB.KBD, 0x036B) + Notify (\_SB.PCI0.LPCB.KBD, 0x01b6) + + // 0x02 = Enable LED + \_SB.PCI0.LPCB.EC.HKEY.MMTS (0x02) + LED1 = One + } + Else + { + // Left Shift + F20 + Notify (\_SB.PCI0.LPCB.KBD, 0x012A) + Notify (\_SB.PCI0.LPCB.KBD, 0x036B) + Notify (\_SB.PCI0.LPCB.KBD, 0x01aa) + + // 0x00 = Disable LED + \_SB.PCI0.LPCB.EC.HKEY.MMTS (Zero) + LED1 = Zero + } + } + Else + { + // Call original _Q6A method. \_SB.PCI0.LPCB.EC.XQ6A() - } + } } Method (_Q15, 0, NotSerialized) // F5 - Brightness Down = F14 @@ -64,43 +91,7 @@ DefinitionBlock("", "SSDT", 2, "OCLT", "x1input", 0) } } - Method (_Q64, 0, NotSerialized) // F8 - Network = F8 - { - If (_OSI ("Darwin")) - { - Notify(\_SB.PCI0.LPCB.KBD, 0x0342) - } - Else - { - \_SB.PCI0.LPCB.EC.XQ64() - } - } - - Method (_Q66, 0, NotSerialized) // F9 - Settings = F19 - { - If (_OSI ("Darwin")) - { - Notify(\_SB.PCI0.LPCB.KBD, 0x036A) - } - Else - { - \_SB.PCI0.LPCB.EC.XQ66() - } - } - - Method (_Q60, 0, NotSerialized) // F10 - Bluetooh = F20 - { - If (_OSI ("Darwin")) - { - Notify(\_SB.PCI0.LPCB.KBD, 0x036B) - } - Else - { - \_SB.PCI0.LPCB.EC.XQ60() - } - } - - Method (_Q61, 0, NotSerialized) // F11 - Keyboard = F17 + Method (_Q64, 0, NotSerialized) // F8 - Network = F17 { If (_OSI ("Darwin")) { @@ -108,17 +99,66 @@ DefinitionBlock("", "SSDT", 2, "OCLT", "x1input", 0) } Else { - \_SB.PCI0.LPCB.EC.XQ61() + \_SB.PCI0.LPCB.EC.XQ64() } } - Method (_Q62, 0, NotSerialized) // F12 - Star = F18 + Method (_Q66, 0, NotSerialized) // F9 - Settings = F18 { If (_OSI ("Darwin")) { Notify(\_SB.PCI0.LPCB.KBD, 0x0369) } Else + { + \_SB.PCI0.LPCB.EC.XQ66() + } + } + + Method (_Q60, 0, NotSerialized) // F10 - Bluetooth + { + + If (_OSI ("Darwin")) + { + // // Send a down event for the Control key (scancode 1d), then a one-shot event (down then up) for + // the down arrow key (scancode 0e 50), and finally an up event for the Control key (break scancode 9d). + // This is picked up by VoodooPS2 and sent to macOS as the Control+Down key combo. + Notify (\_SB.PCI0.LPCB.KBD, 0x011D) + Notify (\_SB.PCI0.LPCB.KBD, 0x0450) + Notify (\_SB.PCI0.LPCB.KBD, 0x019D) + } + Else + { + // Call original _Q60 method. + \_SB.PCI0.LPCB.EC.XQ60() + } + } + + Method (_Q61, 0, NotSerialized) // F11 - Keyboard + { + If (_OSI ("Darwin")) + { + // Send a down event for the Control key (scancode 1d), then a one-shot event (down then up) for + // the up arrow key (scancode 0e 48), and finally an up event for the Control key (break scancode 9d). + // This is picked up by VoodooPS2 and sent to macOS as the Control+Up key combo. + Notify (\_SB.PCI0.LPCB.KBD, 0x011D) + Notify (\_SB.PCI0.LPCB.KBD, 0x0448) + Notify (\_SB.PCI0.LPCB.KBD, 0x019D) + } + Else + { + // Call original _Q61 method. + \_SB.PCI0.LPCB.EC.XQ61() + } + } + + Method (_Q62, 0, NotSerialized) // F12 - Star = F19 + { + If (_OSI ("Darwin")) + { + Notify(\_SB.PCI0.LPCB.KBD, 0x036A) + } + Else { \_SB.PCI0.LPCB.EC.XQ62() }