Contribute
Register

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

Joined
Aug 1, 2011
Messages
577
Motherboard
GA-Z170X-ULTRA GAMING
CPU
i7 6600k
Graphics
HD530
Mac
MacBook Air
Mobile Phone
iOS
Did your system used to auto-sleep in Lion and Mountain Lion but stopped in 10.8.1?

I did not find this out another user posted on the forum but I thought it might be effecting others?

Most of us have the darkwake=0 flag in our boot lists yes? Well my system does not auto-sleeep with this flag.

It needs to be changed to darkwake=no and then auto sleep starts working again!

Strange eh...but I've tried it both ways and it is definitely this which breaks auto-sleep.

Also worth noting the new USB 3 drivers break wake from sleep on my system too...

Original post by

In your org.chameleon.boot.plist, do you have darkwake=0 or darkwake=1 set? I found that in Mountain Lion you need to put darkwake=yes or darkwake=no. Or just don't have the flag in there at all, depending on your needs. This fixed auto-sleep for me. Also, your DVD drive could be preventing sleep. Having a disk in the drive can fix this.
Thanks!
 

pct

Joined
Nov 8, 2010
Messages
73
Motherboard
HP Elitebook 840 G2 Clover UEFI
CPU
i5-5300u
Graphics
HD5500
Hi

It also solved my auto sleep issue that was not working anymore on my MacMini, while it was on Lion.

I put darkwake=no and auto sleep now working in ML

It also required a patched DSDT in order to have my internal disk seen as as internal and not as external with orange icons: otherwise, it would not auto sleep. This was confirmed by 'pmset -g assertion' who was showing my external disk as preventing sleep)

Any idea if there could be side effect of this darkwake=no ?

Thanks for your post.
 
Joined
Jan 16, 2011
Messages
520
Motherboard
Asus ROG MAXIMUS X HERO
CPU
i7-9700K
Graphics
RX 580
Classic Mac
Power Mac, PowerBook
Mobile Phone
iOS
Hm, I guess it is a little bit more complex than it seems...

In advance, I have no clue about how all this stuff really works, I just have my doubts that there are two usable definitions of a boot argument.
So my guess is that maybe <darkwake=no> is not defined and as a result is ignored as being invalid.

My rig does not autosleep anymore in ML and it is using <darkwake=0>. So far so good.

Now I changed the string into <darkwake=no>.
As you predicted, now it does autosleep again. But I noticed that I needed two keystrokes to rewake the monitor. Behaving as it did before the <darkwake...> argument came up a couple of month ago. My guess: Behaving as if that argument does not exist.

Now I deleted the <darkwake> flag completely from my boot.plist and it behaves exactly the same as with <darkwake=no>, it does autosleep but needs two keystrokes to wake the monitor.

Maybe someone can add some more details about what this flag really does (or does not)?
At least I can confirm that deleting the darkwake flag reenables autosleep...
 
Joined
Jul 23, 2012
Messages
91
Motherboard
GA-Z68X-UD3P-B3 (UEFI)
CPU
Intel i5 2400 3.10 GHz (3.11 in 10.8)
Graphics
nVidia GTX 560 Ti
Mac
MacBook Air
Classic Mac
Power Mac
Mobile Phone
iOS, Other
Hello all !

Well, having my issues on sleep, and having tested lots of different combinations, I went to Darkwake=Yes, which enables the OS to select the hardware parts that go to sleep (ex : LAN card awake). =No ignores that OSX function, and puts the rig to sleep. Completely. On my rig, nothing keeps running, and that's perfect. I also have the "two-keystokes-or-two-clics-to-wake" issue, but thats not really a problem. Move your mouse few times (move right+left or something) and there are your screen(s). :thumbup:

But, in my research, I did found that using your computer as a server with PC's (SMB and, on the Win side : Explorer>Map Network Drive to connect to the server permanently) can break your sleep when on Darkwake=Yes (Fans keep running, CPU t0o, only puts asleep the GPU, the Optical drive, and non-shared Drives. I have to test this with Darkwake=No. Or can someone do this real quick ?

Oh, and Darkwake=0 or =1 is outdated because of the new version of Chimera we use (1.11.1), but Multibeast still puts =0 by default. Maybe need a correction for that.

Hope I helped,
Clovel
 
Joined
Jan 16, 2011
Messages
520
Motherboard
Asus ROG MAXIMUS X HERO
CPU
i7-9700K
Graphics
RX 580
Classic Mac
Power Mac, PowerBook
Mobile Phone
iOS
Oh, and Darkwake=0 or =1 is outdated because of the new version of Chimera we use (1.11.1), but Multibeast still puts =0 by default. Maybe need a correction for that.
Thanks for the clarification, so the syntax itself is defined and used.
But just for my curiosity: What difference does it make to use "darkwake=no" or not to use the flag at all? As - at least my rig - seems to sleep properly without using it?
 
Joined
Jul 23, 2012
Messages
91
Motherboard
GA-Z68X-UD3P-B3 (UEFI)
CPU
Intel i5 2400 3.10 GHz (3.11 in 10.8)
Graphics
nVidia GTX 560 Ti
Mac
MacBook Air
Classic Mac
Power Mac
Mobile Phone
iOS, Other
Hi

Well, I really don't know.
But if we think about it, the darkwake is an OSX feature. So not specifying if we want it or not must enable it by default. This is an interesting question. Does anybody have an answer to this ?

Clovel
 
Joined
Dec 20, 2010
Messages
42
Motherboard
Asus ROG Strix Z370-E
CPU
i7-8700K
Graphics
UHD630+Titan XP
Mac
MacBook Pro
oh man, this darkwake=No should be fixed in Multibeast! Now my hackintosh can auto sleep and wake up without problem..Thanks so much.
 
Joined
Jul 23, 2012
Messages
29
Motherboard
GA-Z77X-UP5 TH
CPU
Core i7 3770K
Graphics
EVGA GTX 970
Mac
MacBook Pro, Mac mini
Classic Mac
PowerBook
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.
 
Joined
Aug 5, 2012
Messages
60
Motherboard
Z77x-up5 th
CPU
i7 3770k
Graphics
GTX970
Now I deleted the <darkwake> flag completely from my boot.plist and it behaves exactly the same as with <darkwake=no>, it does autosleep but needs two keystrokes to wake the monitor.
Based on your input I deleted the string and tried it yesterday. Unfortunately, deleting it gives an error during boot. Forgot the exact message, but something like 'error detected. Waiting 5 sec to boot'. Then the boot screen comes up but instead of the default apple logo, it is a different rendition of the logo (perhaps something built into multibeast).

Autosleep did work though with the string deleted, but I got the error message on every boot.
I switched to darkwake=no, and then the error message went away. And autosleep did work this time too.

Also, I don't have to press a key twice for waking up the computer. A single press of a keyboard button or touchpad click works.
 
Joined
Jul 23, 2012
Messages
29
Motherboard
GA-Z77X-UP5 TH
CPU
Core i7 3770K
Graphics
EVGA GTX 970
Mac
MacBook Pro, Mac mini
Classic Mac
PowerBook
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.
 
Top