Mojave randomly wakes up from sleep

abelard

New member
Joined
Aug 11, 2020
macOS
10.14.6
Mobo
Gigabyte Aorus Z390 Pro
CPU
Intel i7 9700K
GPU
Radeon Rx 580 8Gb
#1
Hi everyone

A few months ago I’ve built an Hackintosh with Mojave 10.14.6 for everyday use. The only noticeable problem which remained unsolved is that I’m unable to make the system sleep continuously without interruption. In fact the systems is able to sleep (ie the power light turns off) but it wakes up randomly, usually every 10-15 minutes.

Here is my system configuration:

Intel i7 9700K

Gigabyte Aorus Z390 Pro

Fenvi FV-HB1200 (BCM94360CD) Wifi/Bluetooth

My sleep problems come from this Fenvi card, but not from the Bluetooth. In fact if I disable the USB internal port with the patched SSDT or if I disconnect the bluetooth adapter from the internal USB2 port I still have wakes (Wake reason: XDCI CNVW and PEG1 PEGP PEG2 PEGP…) But if I also remove the wifi card from the pci-e slot the system finally does not wake up at all. Ok, but if possible I don’t want to waste the money of this card.

In System Settings, Wake on Lan is off, Power Nap is off. I’ve correctly mapped the USB ports with Hackintool 3.x.x SSDT-UIAC and SSDT-EC-USBX have been generated. I boot with darkwake=0. SMBios is iMac19,1.

Then with everything plugged in, I’ve tried to patch the DSDT. I’ve first removed all the _DSM methods.

Then I’ve followed the Rehab’s USB3 _PRW 0x6D patch, that is I’ve replaced into the _PRW methods Return (GPRW (0x6D, 0x04)) with Return (GPRW (0x6D, 0x00))(into the Devices GLAN, XHC, XDCI, HDAS, CNVW)…. No effect on sleep. Then I’ve replaced these _PRW methods with Return Zero. Now I cannot wake the system up with the keyboard and the mouse. It would be ok to use the power button only, but the system is still waking up randomly. XDCI CNVW have been disappeared from the wake up reason, but I now have PEG1 PEGP PEG2 PEGP PXSX RP02 PXSX RP03 PXSX RP04 PXSX RP05 PXSX RP07 PXSX PXSX RP10 PXSX ..

I’ve also tried to suppress all of these wake reason in DSDT by adding _PRW methods returning Zero in the PEGP and PXSX nested devices and to declare PEGP and PXSX if required. Unfortunately the system is still waking up. Of course the wake reason has been shortened but it still remains PXSX (Network). It’s very strange to me, since in this case any Device has its nested PXSX with a _PRW returning Zero. This last try was pretty useless, so I rolled back to the 0x6D patch.

I think that the problem is coming from the WiFi, but I don’t have anything else to try.
 

Attachments

Edhawk

Moderator
Joined
Apr 10, 2018
macOS
10.15.5
Mobo
GA-Z97X-UD5H
CPU
i7-4790K
GPU
Powercolor RX 580 8GB
#2
Have you looked at the Hibernation and sleep settings your system is using? Have a read of this guide by Allan over at InsanelyMac - https://www.insanelymac.com/forum/topic/299721-sleep-hibernation-how-it-works-and-how-to-use/

Configuring the USB ports, setting the correct Power/Energy Saving settings are both requirements for a successful sleep process. I am not sure you are helping yourself with the DSDT patching/edits. I would suggest you revert to your original DSDT and follow the guidance provided by Allan in the link above, before you look at altering the DSDT power settings again.
 

abelard

New member
Joined
Aug 11, 2020
macOS
10.14.6
Mobo
Gigabyte Aorus Z390 Pro
CPU
Intel i7 9700K
GPU
Radeon Rx 580 8Gb
#3
Have you looked at the Hibernation and sleep settings your system is using?
Yes, I've disabled Hibernate, I'm just interested in keeping the Sleep state for long time.

Code:
 $ pmset -g
System-wide power settings:
Currently in use:
standby              0
Sleep On Power Button 1
womp                 0
hibernatefile        /var/vm/sleepimage
proximitywake        0
powernap             0
gpuswitch            2
networkoversleep     0
disksleep            10
standbydelayhigh     86400
sleep                15 (sleep prevented by sharingd, coreaudiod, coreaudiod)
hibernatemode        0
ttyskeepawake        1
displaysleep         15
highstandbythreshold 50
standbydelaylow      86400
Code:
 $ pmset -g assertions
Assertion status system-wide:
   BackgroundTask                 1
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  0
   PreventUserIdleSystemSleep     1
   NetworkClientActive            0
Listed by owning process:
   pid 147(coreaudiod): [0x00000063000180d9] 00:16:37 PreventUserIdleSystemSleep named: "com.apple.audio.AppleGFXHDAEngineOutputDP:0:{1006-9CB5-00000000}.context.preventuseridlesleep" 
	Created for PID: 542. 
   pid 147(coreaudiod): [0x00000063000180c9] 00:16:37 PreventUserIdleSystemSleep named: "com.apple.audio.SoundflowerEngine:0.context.preventuseridlesleep" 
	Created for PID: 542. 
   pid 513(sharingd): [0x000002ba00018359] 00:06:39 PreventUserIdleSystemSleep named: "Handoff" 
   pid 96(hidd): [0x000000160009813d] 00:00:00 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4294970106.3" 
	Timeout will fire in 900 secs Action=TimeoutActionRelease
   pid 75(apsd): [0x00000440000b8386] 00:00:08 ApplePushServiceTask named: "com.apple.apsd-waitingformessages-push.apple.com" 
Kernel Assertions: 0x4=USB
   id=512  level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.14610000 owner=Keyboard Hub
   id=514  level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.14640000 owner=USB HUB 
   id=517  level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.14643000 owner=HL-1110 series
   id=518  level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.14520000 owner=BRCM20702 Hub
   id=520  level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.14510000 owner=USB2.0-CRW
   id=521  level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.14611000 owner=Magic Trackpad 2
Idle sleep preventers: IODisplayWrangler
Configuring the USB ports, setting the correct Power/Energy Saving settings are both requirements for a successful sleep process.
Sure, I did both of them.
 

Edhawk

Moderator
Joined
Apr 10, 2018
macOS
10.15.5
Mobo
GA-Z97X-UD5H
CPU
i7-4790K
GPU
Powercolor RX 580 8GB
#4
Have you tried one of the other Hibernatemode settings mentioned in the guide, i.e. Hibernatemode=3 or 25 in place of 0?

From the information provided in the post above I would comment as follows:
  • You are using SoundFlower audio volume app/controller. Have you tried running the system with out this app installed and do you have the same sleep issues?

  • Also that you have a lot of USB devices active when you try to sleep/hibernate your system. Are you sure they are all configured correctly? One or more may be causing the sleep/wake issue.
Have you tried disconnecting all the USB devices and testing sleep with each individual USB device connected on its own. To undertake this test you may need run the system with a different/Windows USB mouse/keyboard, as the Bluetooth module will not be connected for your Magic Trackpad or Bluetooth keyboard (if used).
 

abelard

New member
Joined
Aug 11, 2020
macOS
10.14.6
Mobo
Gigabyte Aorus Z390 Pro
CPU
Intel i7 9700K
GPU
Radeon Rx 580 8Gb
#5
Have you tried one of the other Hibernatemode settings mentioned in the guide, i.e. Hibernatemode=3 or 25 in place of 0?
Yes, the result is the same, the systems randomly wakes up every x minutes.

You are using SoundFlower audio volume app/controller. Have you tried running the system with out this app installed and do you have the same sleep issues?
No, because when Soundflower is running, but the Fenvi card is unplugged, the systems can keep the sleep.

Also that you have a lot of USB devices active when you try to sleep/hibernate your system. Are you sure they are all configured correctly? One or more may be causing the sleep/wake issue.
I've only one strange behaviour with my Apple USB Keyboard. All the usb 2.0 ports of my mobo are named HS13. If I attach the keyboard to any usb 3.0 port everything is ok, including the hub. But if I use one usb 2.0 port, the keyboard hub does not work properly. When I plug something in, Mojave says that more power is needed. The only way to make it work is to map HS13 as internal port (UsbConnector 255). Someone could say that I should name it as UsbConnector 0 since they are indeed 4 usb 2.0 connectors. I've also tried this, but it does not affect the sleep/wake behaviour.
 

Attachments

Edhawk

Moderator
Joined
Apr 10, 2018
macOS
10.15.5
Mobo
GA-Z97X-UD5H
CPU
i7-4790K
GPU
Powercolor RX 580 8GB
#6
Sounds like something is wrong with your USB configuration, if the keyboard hub is acting in the manner described.

The Bluetooth and card reader (USB2.0-CRW) should be the only Internal USB 2 devices. I am not sure they should both be connected on port HS11. I would normally assume they are each connected to a separate USB2 header port on the motherboard, not to a an internal hub that is connected to a single header port.

Depending on your card reader's configuration and the number and type of USB ports it supports, I would expect this device to make use of both USB ports from an internal header port.

The bluetooth from the Fenvi card usually takes up the full scope of a USB 2 header port but only uses one of the two ports.

You are also only configuring 14 USB ports, you can add another port to the USB configuration kext or SSDT.

Can you share/post your USB configuration setup from Hackintool USB tab, my 9-Series Usb configuration is shown below as an example:

Screenshot 2020-08-11 at 23.48.35.png
 

abelard

New member
Joined
Aug 11, 2020
macOS
10.14.6
Mobo
Gigabyte Aorus Z390 Pro
CPU
Intel i7 9700K
GPU
Radeon Rx 580 8Gb
#7
The Bluetooth and card reader (USB2.0-CRW) should be the only Internal USB 2 devices. I am not sure they should both be connected on port HS11. I would normally assume they are each connected to a separate USB2 header port on the motherboard, not to a an internal hub that is connected to a single header port.
I mapped the port of my Aorus Z390 Pro following the diagram here https://www.insanelymac.com/forum/t...macos-mojave-successguide-for-aorus-z390-pro/

I can confirm that HS11 is the internal USB 2.0 Hub. Before patching, when I used UsbInjectAll, in HS11 I found the Bluetooth Host Controller and the Smart Card Reader, while in HS12 an ITE Device (8595). Also when I did the test with Hackintool, I plugged in each external port a USB 2.0 and a 3.0 pen drive. HS11 and HS12 were never affected by this.

You are also only configuring 14 USB ports, you can add another port to the USB configuration kext or SSDT.
I know, but afaik I just have to choose a number less or equal to 15...
 

Attachments

abelard

New member
Joined
Aug 11, 2020
macOS
10.14.6
Mobo
Gigabyte Aorus Z390 Pro
CPU
Intel i7 9700K
GPU
Radeon Rx 580 8Gb
#8
Hello, I've made the following modifications and the random wakes disappeared:
- deleted EmuVariableUefi which was used twice in drivers and drivers64UEFI;
- updated every single driver to the very last version;
- bought a BCM94360CD WiFi/Bluetooth card different to Fenvi;
- removed the DSDT patches.

Now the problem is that when SoundflowerBed is active the systems does not sleep automatically. SoundflowerBed is the only app I know which allows the use of the volume keys with an external display. To use the volume keys I send the audio to SoundFlower and using SoundflowerBed I send back the audio to the DisplayPort. There exist any other solution for this?