Skip to content

Commit

Permalink
Disable PrntScr remap by default (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhen-zen authored Dec 2, 2020
1 parent 3355926 commit 096f654
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 24 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
VoodooPS2 Changelog
============================

#### v2.1.9
- Disabled PrntScr remap by default, see `SSDT-PrtSc-Remap.dsl` for example to re-enable it

#### v2.1.8
- Added support for receiving input form other kexts
- Fixed dynamic coordinate refresh for ELAN v3 touchpads
Expand Down
20 changes: 0 additions & 20 deletions Docs/ACPI/SSDT-PrtSc-F13.dsl

This file was deleted.

21 changes: 21 additions & 0 deletions Docs/ACPI/SSDT-PrtSc-Remap.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Remap PrntScr to disable touchpad/keyboard
// Supported Voodoo PrntScr Key combinations:

// PrntScr Enable/Disable touchpad
// Windows+PrntScr Enable/Disable touchpad+keyboard
// Ctrl+Alt+PrntScr Reset and enable touchpad
// Shift+PrntScr Send SysRq scancode to the kernel

DefinitionBlock ("", "SSDT", 2, "ACDT", "ps2", 0)
{
External (_SB_.PCI0.LPCB.PS2K, DeviceObj)

Name(_SB.PCI0.LPCB.PS2K.RMCF, Package()
{
"Keyboard", Package()
{
"RemapPrntScr", ">y",
},
})
}
//EOF
6 changes: 3 additions & 3 deletions VoodooPS2Controller.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@
CE7F451422E8A8F8003F7971 /* Changelog.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Changelog.md; sourceTree = SOURCE_ROOT; };
CE7F451522E8A8FE003F7971 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
CE7F451622E8A906003F7971 /* LICENSE.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = LICENSE.md; sourceTree = SOURCE_ROOT; };
CE8DA1C4251839B2008C44E8 /* libkmod.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libkmod.a; path = ../Lilu/MacKernelSDK/Library/x86_64/libkmod.a; sourceTree = "<group>"; };
ED1C95C51F9B88EF00CAFCA3 /* SSDT-PrtSc-F13.dsl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "SSDT-PrtSc-F13.dsl"; sourceTree = "<group>"; };
CE8DA1C4251839B2008C44E8 /* libkmod.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libkmod.a; path = MacKernelSDK/Library/x86_64/libkmod.a; sourceTree = "<group>"; };
ED1C95C51F9B88EF00CAFCA3 /* SSDT-PrtSc-Remap.dsl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "SSDT-PrtSc-Remap.dsl"; sourceTree = "<group>"; };
ED48777A207D94BC00D6B1E8 /* SSDT-AlternateSwipes.dsl */ = {isa = PBXFileReference; lastKnownFileType = text; path = "SSDT-AlternateSwipes.dsl"; sourceTree = "<group>"; };
ED5759741D44FBA50069DF9F /* SSDT-KEY-DELL-WN09.dsl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "SSDT-KEY-DELL-WN09.dsl"; sourceTree = "<group>"; };
ED6BB589209E4EE8007AC3A4 /* SSDT-DisableTrackpadProbe.dsl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "SSDT-DisableTrackpadProbe.dsl"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -320,7 +320,7 @@
ED7E45DF1CFB35EE00ED2FB8 /* SSDT-Enable_DynamicEWMode.dsl */,
EDD970FD1FD0B826004CCFFD /* SSDT-HP-FixLidSleep.dsl */,
ED5759741D44FBA50069DF9F /* SSDT-KEY-DELL-WN09.dsl */,
ED1C95C51F9B88EF00CAFCA3 /* SSDT-PrtSc-F13.dsl */,
ED1C95C51F9B88EF00CAFCA3 /* SSDT-PrtSc-Remap.dsl */,
EDB891282041BB12004DB536 /* SSDT-Swap-LeftControlCapsLock.dsl */,
EDAD29471FE8772400A93537 /* SSDT-Swap-LeftControlCommand.dsl */,
EDD95559208E2B640031D99E /* SSDT-Thinkpad_Clickpad.dsl */,
Expand Down
16 changes: 15 additions & 1 deletion VoodooPS2Keyboard/VoodooPS2Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#define kHIDF12EjectDelay "HIDF12EjectDelay"
#define kFunctionKeysStandard "Function Keys Standard"
#define kFunctionKeysSpecial "Function Keys Special"
#define kRemapPrntScr "RemapPrntScr"
#define kSwapCapsLockLeftControl "Swap capslock and left control"
#define kSwapCommandOption "Swap command and option"
#define kMakeApplicationKeyRightWindows "Make Application key into right windows"
Expand Down Expand Up @@ -163,6 +164,7 @@ bool ApplePS2Keyboard::init(OSDictionary * dict)
_ledState = 0;
_lastdata = 0;

_remapPrntScr = false;
_swapcommandoption = false;
_sleepEjectTimer = 0;
_cmdGate = 0;
Expand Down Expand Up @@ -738,6 +740,12 @@ void ApplePS2Keyboard::setParamPropertiesGated(OSDictionary * dict)
_brightnessHack = true;
}

if ((xml = OSDynamicCast(OSBoolean, dict->getObject(kRemapPrntScr))))
{
_remapPrntScr = xml->getValue();
setProperty(kRemapPrntScr, _remapPrntScr);
}

// these two options are mutually exclusive
// kMakeApplicationKeyAppleFN is ignored if kMakeApplicationKeyRightWindows is set
bool temp = false;
Expand Down Expand Up @@ -1523,9 +1531,12 @@ bool ApplePS2Keyboard::dispatchKeyboardEventWithPacket(const UInt8* packet)
break;

//REVIEW: this is getting a bit ugly
case 0x0128: // alternate that cannot fnkeys toggle (discrete trackpad toggle)
case 0x0054: // SysRq (PrntScr when combined with Alt modifier -left or right-)
if (!_remapPrntScr)
break;
case 0x0128: // alternate that cannot fnkeys toggle (discrete trackpad toggle)
{

// PrntScr is handled specially by some keyboard devices.
// See: 5.19 on https://www.win.tue.nl/~aeb/linux/kbd/scancodes-5.html#mtek
#ifdef DEBUG
Expand All @@ -1544,6 +1555,9 @@ bool ApplePS2Keyboard::dispatchKeyboardEventWithPacket(const UInt8* packet)
}
case 0x0137: // prt sc/sys rq
{
if (!_remapPrntScr)
break;

/* Supported Voodoo PrntScr Key combinations:
PrntScr Enable/Disable touchpad
Windows+PrntScr Enable/Disable touchpad+keyboard
Expand Down
1 change: 1 addition & 0 deletions VoodooPS2Keyboard/VoodooPS2Keyboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class EXPORT ApplePS2Keyboard : public IOHIKeyboard
int _logscancodes;
UInt32 _f12ejectdelay;
enum { kTimerSleep, kTimerEject } _timerFunc;
bool _remapPrntScr;

// dealing with sleep key delay
IOTimerEventSource* _sleepEjectTimer;
Expand Down

0 comments on commit 096f654

Please sign in to comment.