Skip to content

Commit

Permalink
Added DisableDeepSleep to workaround ACPI S3 wakes on some Synaptic…
Browse files Browse the repository at this point in the history
…s touchpads

closes acidanthera/bugtracker#1610
  • Loading branch information
vit9696 committed Apr 22, 2021
1 parent ab49b27 commit 69c29bc
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 17 deletions.
9 changes: 6 additions & 3 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
VoodooPS2 Changelog
============================
#### 2.2.2
#### v2.2.3
- Added `DisableDeepSleep` to workaround ACPI S3 wakes on some Synaptics touchpads

#### v2.2.2
- Added NumLockSupport & NumLockOnAtBoot

#### 2.2.1
#### v2.2.1
- Fix issue with registering of services matched by property name "RM,deliverNotifications". It solves issue with broadcasting timestamp for the last pressed key and handling of QuietTimeAfterTyping [see bug #1415](https://github.com/acidanthera/bugtracker/issues/1415)

#### 2.2.0
#### v2.2.0
- Added VoodooRmi compatibility to allow external touchpad resets

#### v2.1.9
Expand Down
17 changes: 17 additions & 0 deletions Docs/ACPI/SSDT-DisableDeepSleep.dsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// For computers with Synaptics touchpad that wake immediately after
// going to sleep deeper touchpad sleep can be disabled.
//
// This will cause the touchpad to consume more power in ACPI S3.
DefinitionBlock("", "SSDT", 2, "ACDT", "ps2", 0)
{
External (_SB_.PCI0.LPCB.PS2K, DeviceObj)

Name(_SB.PCI0.LPCB.PS2K.RMCF, Package()
{
"Synaptics TouchPad", Package()
{
"DisableDeepSleep", ">y",
}
})
}
//EOF
4 changes: 3 additions & 1 deletion VoodooPS2Controller.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
CE8DA1C4251839B2008C44E8 /* libkmod.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libkmod.a; path = MacKernelSDK/Library/x86_64/libkmod.a; sourceTree = "<group>"; };
CEA35504257C6E3500E17556 /* SSDT-Swap-CommandOption.dsl */ = {isa = PBXFileReference; lastKnownFileType = text; path = "SSDT-Swap-CommandOption.dsl"; sourceTree = "<group>"; };
CEAFF570259F8AE700693DEC /* SSDT-DisableElanWakeDelay.dsl */ = {isa = PBXFileReference; lastKnownFileType = text; path = "SSDT-DisableElanWakeDelay.dsl"; sourceTree = "<group>"; };
CEF251412631A92B00A20C9A /* SSDT-DisableDeepSleep.dsl */ = {isa = PBXFileReference; lastKnownFileType = text; path = "SSDT-DisableDeepSleep.dsl"; 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>"; };
Expand Down Expand Up @@ -319,6 +320,7 @@
73119AB825E1961D0017311C /* SSDT-NumLockSupport.dsl */,
CE7F451122E8A8C4003F7971 /* SSDT-MouseAsTrackpad.dsl */,
ED48777A207D94BC00D6B1E8 /* SSDT-AlternateSwipes.dsl */,
CEF251412631A92B00A20C9A /* SSDT-DisableDeepSleep.dsl */,
CEAFF570259F8AE700693DEC /* SSDT-DisableElanWakeDelay.dsl */,
ED6BB589209E4EE8007AC3A4 /* SSDT-DisableTrackpadProbe.dsl */,
EDD970FD1FD0B826004CCFFD /* SSDT-HP-FixLidSleep.dsl */,
Expand Down Expand Up @@ -492,7 +494,7 @@
84167808161B55B2002C60E6 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1220;
LastUpgradeCheck = 1240;
ORGANIZATIONNAME = Acidanthera;
};
buildConfigurationList = 8416780B161B55B2002C60E6 /* Build configuration list for PBXProject "VoodooPS2Controller" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1220"
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
16 changes: 11 additions & 5 deletions VoodooPS2Trackpad/VoodooPS2SynapticsTouchPad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2216,6 +2216,7 @@ void ApplePS2SynapticsTouchPad::setParamPropertiesGated(OSDictionary * config)
};
const struct {const char* name; bool* var;} lowbitvars[]={
{"USBMouseStopsTrackpad", &usb_mouse_stops_trackpad},
{"DisableDeepSleep", &disableDeepSleep}
};
const struct {const char* name; uint64_t* var; } int64vars[]={
{"QuietTimeAfterTyping", &maxaftertyping},
Expand Down Expand Up @@ -2346,8 +2347,11 @@ void ApplePS2SynapticsTouchPad::setDevicePowerState( UInt32 whatToDo )
//

setTouchPadEnable( false ); // Disable stream mode
_touchPadModeByte |= 1 << 3;
setModeByte(_touchPadModeByte); // Enable sleep

if (!disableDeepSleep) {
_touchPadModeByte |= 1 << 3;
setModeByte(_touchPadModeByte); // Enable sleep
}
break;

case kPS2C_EnableDevice:
Expand All @@ -2356,9 +2360,11 @@ void ApplePS2SynapticsTouchPad::setDevicePowerState( UInt32 whatToDo )
// completed its power-on self-test and calibration.
//

IOSleep(wakedelay);
_touchPadModeByte &= ~(1 << 3); // Wake from sleep
setModeByte(_touchPadModeByte);
if (!disableDeepSleep) {
IOSleep(wakedelay);
_touchPadModeByte &= ~(1 << 3); // Wake from sleep
setModeByte(_touchPadModeByte);
}
IOSleep(wakedelay);

// Reset and enable the touchpad.
Expand Down
10 changes: 6 additions & 4 deletions VoodooPS2Trackpad/VoodooPS2SynapticsTouchPad.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,16 @@ class EXPORT ApplePS2SynapticsTouchPad : public IOHIPointing
uint32_t physical_max_x {0};
uint32_t physical_max_y {0};

synaptics_hw_state fingerStates[SYNAPTICS_MAX_FINGERS] {};
synaptics_hw_state fingerStates[SYNAPTICS_MAX_FINGERS] {};
virtual_finger_state virtualFingerStates[SYNAPTICS_MAX_FINGERS] {};
bool freeFingerTypes[kMT2FingerTypeCount];
bool freeFingerTypes[kMT2FingerTypeCount];

static_assert(SYNAPTICS_MAX_FINGERS <= kMT2FingerTypeLittleFinger, "Too many fingers for one hand");
bool disableDeepSleep {false};

static_assert(SYNAPTICS_MAX_FINGERS <= kMT2FingerTypeLittleFinger, "Too many fingers for one hand");

void assignVirtualFinger(int physicalFinger);
void assignFingerType(virtual_finger_state &vf);
void assignFingerType(virtual_finger_state &vf);
int lastFingerCount;
int lastSentFingerCount;
bool hadLiftFinger;
Expand Down

0 comments on commit 69c29bc

Please sign in to comment.