Contribute
Register

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

Status
Not open for further replies.
Thank you very much!
;)
 
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.
 
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.
 
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.
 
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.
 
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...
 
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.
Back
Top