Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VoodooPS2Controller instant wake when lid open #1610

Closed
TonyC5 opened this issue Apr 13, 2021 · 15 comments
Closed

VoodooPS2Controller instant wake when lid open #1610

TonyC5 opened this issue Apr 13, 2021 · 15 comments

Comments

@TonyC5
Copy link

TonyC5 commented Apr 13, 2021

For tested versions of VoodooPS2Controller 2.2.2 and 2.1.8 and VoodooPS2Controller.kext/Contents/Plugins/VoodooPS2Trackpad.kext enabled, laptop wakes 1-2 seconds after sleeping when lid is open. If laptop is put to sleep by closing lid, laptop remains asleep. This issue can be produced with the lid open by allowing the laptop to sleep on its own or by manually Sleeping from the Apple menu.

This issue does not happen if VoodooPS2Trackpad.kext is disabled (other VoodooPS2Controller kexts enabled) (but trackpad does not work)

System Configuration is as follows:

  • Laptop: HP Envy x360 15m (Kaby Lake R i5-8250U, UHD620, 12GB DDR4, Synaptics SMBUS trackpad)
  • MacOS: Catalina 10.15.7 (19H524)
  • Open Core: 0.6.8 Final Release
  • VoodooPS2Controller Versions: 2.1.8 and 2.2.2
  • Kext Injection Order: VoodooPS2Controller.kext, VoodooPS2Controller.kext/Contents/Plugins/VoodooInput.kext, VoodooPS2Controller.kext/Contents/Plugins/VoodooPS2Keyboard.kext, VoodooPS2Controller.kext/Contents/Plugins/VoodooPS2Mouse.kext, VoodooPS2Controller.kext/Contents/Plugins/VoodooPS2Trackpad.kext
  • Instant wake fix (GPRW) is applied and fully tested as working properly

I have reproduced this issue with and without enabling VoodooPS2Mouse.kext in both version 2.1.8 and 2.2.2.

Reverting to Rehabman's VoodooPS2Controller 1.9.2 "fixes" this issue, but with Rehabman's version, the trackpad has issues after repeated sleep/wake cycles.

Changing Synaptics > WakeDelay (in VoodooPS2Trackpad.kext/Contents/Info.plist) does not change this instant wake issue (but it does change the delay after which both the trackpad and USB mouse are available after wake).

@vit9696
Copy link
Contributor

vit9696 commented Apr 13, 2021

This sounds like an ACPI issue, but I don't know much. CC @usr-sse2 @Goshin @zhen-zen @lvs1974 @khronokernel @dhinakg

@vit9696 vit9696 closed this as completed Apr 13, 2021
@TonyC5
Copy link
Author

TonyC5 commented Apr 13, 2021

Below is the sleep / wake event log that shows what's happening. With VoodooPS2Trackpad.kext disabled (all other VoodooPS2Controller kexts still enabled), the laptop sleeps normally and stays asleep until I wake it. With VoodooPS2Trackpad.kext enabled, if I close the lid to "sleep" the laptop, it sleeps normally and stays asleep until I open the lid. This problem happens only when the lid is open, VoodooPS2Trackpad.kext is enabled and the laptop sleeps due to idle or I "sleep" it via the Apple Menu > Sleep.

2021-04-13 18:58:39 -0400 Sleep Entering Sleep state due to 'Idle Sleep': Using AC (Charge:100%) 14 secs
2021-04-13 18:58:41 -0400 PM Client Acks Delays to Sleep notifications: [mDNSResponder is slow(1011 ms)] [com.apple.apsd is slow(2572 ms)]
2021-04-13 18:58:50 -0400 Kernel Client Acks Delays to Sleep notifications: [AppleHDADriver driver is slow(msg: SetState to 0)(814 ms)] [AppleAHCIDiskQueueManager driver is slow(msg: SetState to 0)(500 ms)]
2021-04-13 18:58:53 -0400 Wake Wake from Normal Sleep [CDNVA] : due to power-button/User Using AC (Charge:100%)

@TonyC5
Copy link
Author

TonyC5 commented Apr 14, 2021

@vit9696 I have carefully reviewed my ACPI patches and have thoroughly tested patch variations. Regardless of what I do, the instant wake behavior remains when VoodooPS2TrackPad.kext is enabled. All other tested functions work well and sleep/wake works well as long as VoodooPS2Trackpad.kext is not enabled (not an option since I need the trackpad).

To summarize with VoodooPS2Trackpad.kext enabled...

  • If laptop sleeps while lid is open (sleeps on idle or sleeps when invoked by Sleep under Apple menu), laptop wakes after a 1-2 seconds
  • if I close the lid, laptop sleeps and remains asleep (laptop wakes normally when I open the lid)

If I disable VoodooPS2Trackpad.kext, laptop sleeps / wakes normally under all conditions, but trackpad does not work.

@TonyC5
Copy link
Author

TonyC5 commented Apr 21, 2021

@vit9696 I have confirmed that this instant wake problem (on my HP Envy x360 15m Kaby Lake R) was introduced in VoodooPS2Controller.kext v2.0.3. I can use v2.0.2 without the instant wake problem. According to your change log, the following changes were made between v2.0.2 and v2.0.3:

  • Use touchpad sleep mode during mainboard sleep
  • Improve physical and trackpad button support

@vit9696
Copy link
Contributor

vit9696 commented Apr 21, 2021

Find the offending commit.

@TonyC5
Copy link
Author

TonyC5 commented Apr 21, 2021

The diffs are here. Should be simple to find. I am trying to build VoodooPS2 2.1.2 but XCode can't find VoodooInputEvent.h. I'll try to build again when I have more time to look for the missing headers. I will start by commenting out the changes in ApplePS2SynapticsTouchPad::setDevicePowerState.

@vit9696
Copy link
Contributor

vit9696 commented Apr 21, 2021

Well, you can try reverting the changes in acidanthera/VoodooPS2@85b9a8d against the current version. VoodooInput must be bootstrapped for compilation.

@TonyC5
Copy link
Author

TonyC5 commented Apr 21, 2021

Not sure what I was thinking by trying to build 2.1.2 when 2.0.3 would do just fine. I have confirmed that if I revert the changes in 2.0.3's ApplePS2SynapticsTouchPad::setDevicePowerState that my laptop sleeps without the instant wake problem.

@TonyC5
Copy link
Author

TonyC5 commented Apr 21, 2021

@vit9696 For my laptop, these are the "offending" lines of code in 2.0.3's ApplePS2SynapticsTouchPad::setDevicePowerState
_touchPadModeByte |= 1 << 3; setModeByte(_touchPadModeByte); // Enable sleep

If I comment out these two lines, my laptop sleeps fine without the instant wake.

@vit9696 Not that this was necessary, but I wanted to make sure I wasn't leading you down a bad path: I repeated the test with v2.0.4 with the same result. I can run VoodooPS2Controller.kext v2.0.4 after commenting out the same two lines of code. My laptop sleeps without instant wake and wakes normally when I press a key or the power button.

@vit9696 vit9696 reopened this Apr 21, 2021
@vit9696
Copy link
Contributor

vit9696 commented Apr 21, 2021

This change was introduced to reduce the power consumption in S3. I believe we should make this configurable. Can you submit a patch introducing a new SSDT option that will optionally disable this code (e.g. disable-touchpad-sleep)?

@TonyC5
Copy link
Author

TonyC5 commented Apr 22, 2021

I'm not sure I understand your request. What specifically do you want me to submit and to where should I submit?

@vit9696
Copy link
Contributor

vit9696 commented Apr 22, 2021

Pushed to master already. Please report whether explicitly disabling it with e.g. an SSDT works.

@TonyC5
Copy link
Author

TonyC5 commented Apr 22, 2021

Ok - I'll look into this when I get some time. In the mean time, I have rebuilt v2.2.2 with my same code change to ApplePS2SynapticsTouchPad::setDevicePowerState and sleep / wake works fine.

@TonyC5
Copy link
Author

TonyC5 commented Apr 22, 2021

@vit9696 CORRECTION: My laptop sleeps with the SSDT "DisableDeepSleep" configuration. I'm not sure why, but it started working after I rebooted a second time.

Thank you for this fix.

@TonyC5
Copy link
Author

TonyC5 commented Apr 25, 2021

@vit9696 I read various docs on Synaptics Touchpad and believe that there might be a capSleep capability bit that indicates whether the Synaptics Touchpad is capable of DeepSleep. While retaining the new SSDT DeepSleep configuration, it might be helpful to have ApplePS2SynapticsTouchPad::setDevicePowerState check the capSleep bit before attempting to enable DeepSleep.

Thanks again for this fix. It continues to work well on my rig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants