Contribute
Register

IMPORTANT Darkwake=0 Flag can break auto-sleep in 10.8.1!

Status
Not open for further replies.
Joined
Dec 22, 2010
Messages
78
Motherboard
Laptop HP 250 G7, upgraded to 16 GB RAM, 256 GB SSD NvME
CPU
i5 8265U
Graphics
Intel UHD 620, 1366x768
Mobile Phone
  1. Android
Thank you very much!
;)
 
Joined
Dec 20, 2010
Messages
19
Motherboard
Asus Maximus IV Extreme, BIOS 2303, Hackintosh 10.9.0
CPU
Intel Core i7 2600k @ 4.5GHz
Graphics
ASUS GTX780 DirectCU II
Mac
Classic Mac
Mobile Phone
Hi all,

I just want to chime in and thank everyone for this thread. For me, darkwake=8 is what works perfectly, it autosleeps, system and display wake up with a single key stroke. Without the darkwake flag, I would have to hit a key to wake up the system, then another key to wake up the monitor.

I have an Asus Maximus IV, Sandy Bridge, Core i7 2600 OC @4.5GHz, with DSDT. Sleep, Speedstep, everything works perfectly.
 
Joined
Feb 3, 2013
Messages
3
Motherboard
ASUS Z170 Pro Gaming MB
CPU
Intel Core i7 6700K
Graphics
ASUS Dual GeForce GTX 1070
I realise this is an old thread, but the problem lives on!

I've put up with no auto-sleep for over a year now, but last week I finally snapped and committed to fixing the problem. After DAYS of searching and trying different things I finally stumbled across this thread. Now my sleep is working perfectly, thank you all for your efforts.
 

shilohh

Moderator
Joined
Jan 2, 2012
Messages
1,752
Motherboard
Asus Prime Z490-A
CPU
i9-10850K
Graphics
Sapphire Radeon Pulse RX 5700 XT
Mac
  1. MacBook Pro
  2. Mac Pro
Mobile Phone
  1. Android
Reading the older threads and documentation it seems that the default for darkwake is that it is on. It looks like you have to turn it off explicitly.

To answer the question as to what is really needed to turn it off I looked at the Chimera source code. Interestingly, there is no mention of darkwake in the Chimera source code. I believe this means that the flag is passed verbatim to the kernel and handled there. And indeed, if you look at the kernel sources you'll find this in IOPMrootDomain.cpp, line 864:

http://www.opensource.apple.com/source/xnu/xnu-792.13.8/iokit/Kernel/IOPMrootDomain.cpp

Code:
PE_parse_boot_argn("darkwake", &gDarkWakeFlags, sizeof(gDarkWakeFlags));

Looking at the source code for PE_parse_boot_argn, which is in bootargs.c, line 68, reveals that there is no special handling for yes/no.

http://www.opensource.apple.com/source/xnu/xnu-792.13.8/pexpert/gen/bootargs.c

In addition, looking at how PE_parse_boot_argn is called it looks like its writing the value directly into the gDarkWakeFlags variable and that holds more than just a boolean on/off:

Code:
// gDarkWakeFlags
enum {
    kDarkWakeFlagHIDTickleEarly      = 0x01, // hid tickle before gfx suppression
    kDarkWakeFlagHIDTickleLate       = 0x02, // hid tickle after gfx suppression
    kDarkWakeFlagHIDTickleNone       = 0x03, // hid tickle is not posted
    kDarkWakeFlagHIDTickleMask       = 0x03,
    kDarkWakeFlagIgnoreDiskIOInDark  = 0x04, // ignore disk idle in DW
    kDarkWakeFlagIgnoreDiskIOAlways  = 0x08, // always ignore disk idle
    kDarkWakeFlagIgnoreDiskIOMask    = 0x0C,
    kDarkWakeFlagAlarmIsDark         = 0x0100
};

So, if this is correct, and it would be great if someone could validate, then numerical values are the way to go, and it's possible that other values should be tried, too. I'm not on my Hackintosh right now to try.

UPDATE: I did some more investigation. The default is defined in line 230:

Code:
static uint32_t  gDarkWakeFlags = kDarkWakeFlagHIDTickleNone | kDarkWakeFlagIgnoreDiskIOAlways;

This would correspond to darkwake=11, adding the values for kDarkWakeFlagHIDTickleNone (3) and kDarkWakeFlagIgnoreDiskIOAlways(8).

Specifying "darkwake=no" is actually the equivalent of "darkwake=28526" because the parsing code will read the characters for "n" and "o" as bytes and write them directly into the integer variable. (The ASCII code for "n" is 110, the code for "o" is 111, and 111*256+110 = 28526.) I ran this through the Apple code to confirm. If we look at the relevant bits this would correspond to:

Code:
kDarkWakeFlagHIDTickleLate |
kDarkWakeFlagIgnoreDiskIOInDark | 
kDarkWakeFlagIgnoreDiskIOAlways | 
kDarkWakeFlagAlarmIsDark

Next thing I'll try when I'm on my machine is darkwake=2, this seems the most relevant part of the accidental setting via the "no" string. I tried, the correct setting is darkwake=10. See comment below.
If you don't want to actually specify a level of darkwake, try "darkwake=00". It has been working correctly for me.
 
Joined
Jul 17, 2014
Messages
15
Motherboard
AsRock Z370-ITX/ac
CPU
i7-8770K
Graphics
GTX 1050 Ti
Back in front of my Hackintosh I've tried my theory from the comment above. It turns out that the right value for darkwake on my board is darkwake=10. This corresponds to these flags:

Code:
kDarkWakeFlagHIDTickleLate       = 0x02, // hid tickle after gfx suppression
kDarkWakeFlagIgnoreDiskIOAlways  = 0x08, // always ignore disk idle

If I use only darkwake=2 (kDarkWakeFlagHIDTickleLate) then the system sleeps, and it wakes up on a single key press, but autosleep doesn't work.

Before you give up on auto-sleeping make sure, too, that the system is actually allowed to sleep. You can check this with the command "pmset -g assertions" in Terminal. If any of the counts, e.g. ApplePushServiceTask, BackgroundTask, are not zero and there is a section titled "Listed by owning process" the system will not auto-sleep. This is correct and it's the case on a real Mac, too.

Holy crap... I've had to have WakeUp disabled and press the power button to come back from sleep for 2 years now! It was on darkwake=8... changing to darkwake=10 fixed it!! extra nice b/c my case is a server rack case and I have to open the front to hit the power button! whooooooo!!

Using a MSI Z97 G45 Gaming mobo.
 
Joined
Oct 9, 2011
Messages
42
Motherboard
Gigabyte GA-Z170X-Gaming-5
CPU
i7 6700
Graphics
GTX 970
Holy crap... I've had to have WakeUp disabled and press the power button to come back from sleep for 2 years now! It was on darkwake=8... changing to darkwake=10 fixed it!! extra nice b/c my case is a server rack case and I have to open the front to hit the power button! whooooooo!!

Using a MSI Z97 G45 Gaming mobo.
thanks for sharing it :) I have an old Gigabyte GA-EP35-DS3 mobo and I have lost sleep since 3 years (I had it on Mavericks) but I have lost it on Sierra and High Sierra. I will try these and I have got success, I will share here...
 
Joined
Jun 20, 2014
Messages
1,015
Motherboard
Gigabyte Aero 15X v8-BK4K4P
CPU
i7-8750H
Graphics
UHD 630 / GTX 1070
According to my research and subsequent post in Darkwake Deciphered the IgnoreDiskIO flags have been removed so darkwake=10 should in theory be the same as darkwake=2 (both have the HIDTickleLate flag).
 
Status
Not open for further replies.
Top