Sleep Display

  • Hi,
    I noticed steve added the nice feature to sleep the display via a hot
    corner, but is there a way for us devs to hook into it? I am currently using
    a pmset hack which i would prefer to use a cleaner method
  • On 30 Oct 07, at 15:33, Andrew James wrote:
    > I noticed steve added the nice feature to sleep the display via a hot
    > corner, but is there a way for us devs to hook into it? I am
    > currently using
    > a pmset hack which i would prefer to use a cleaner method

    Undocumented, use at your own risk, etc. It ends up involving more
    IOKit than Cocoa, as it turns out.

    #include <CoreFoundation/CoreFoundation.h>
    #include <IOKit/IOKitLib.h>

    int dimDisplayNow(void) {
        io_registry_entry_t r =
    IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/
    IODisplayWrangler");
        if(!r) return 1;
        int err = IORegistryEntrySetCFProperty(r, CFSTR("IORequestIdle"),
    kCFBooleanTrue);
        IOObjectRelease(r);
        return err;
    }
  • Hi,
    How far back is this compatible? is it only 10.5?

    On 11/4/07, Andrew Farmer <andfarm...> wrote:
    >
    > On 30 Oct 07, at 15:33, Andrew James wrote:
    >> I noticed steve added the nice feature to sleep the display via a hot
    >> corner, but is there a way for us devs to hook into it? I am
    >> currently using
    >> a pmset hack which i would prefer to use a cleaner method
    >
    > Undocumented, use at your own risk, etc. It ends up involving more
    > IOKit than Cocoa, as it turns out.
    >
    > #include <CoreFoundation/CoreFoundation.h>
    > #include <IOKit/IOKitLib.h>
    >
    > int dimDisplayNow(void) {
    > io_registry_entry_t r =
    > IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/
    > IODisplayWrangler");
    > if(!r) return 1;
    > int err = IORegistryEntrySetCFProperty(r, CFSTR("IORequestIdle"),
    > kCFBooleanTrue);
    > IOObjectRelease(r);
    > return err;
    > }
    >
    >
  • Hi. I've tryed this code and it works. The problem is that with some
    machines it causes a kernel panic. They are PPC machines. Isn't this
    code compatible?

    On Sun, Nov 4, 2007 at 8:45 AM, Andrew James <semaja2...> wrote:
    > Hi,
    > How far back is this compatible? is it only 10.5?
    >
    > On 11/4/07, Andrew Farmer <andfarm...> wrote:
    >>
    >> On 30 Oct 07, at 15:33, Andrew James wrote:
    >>> I noticed steve added the nice feature to sleep the display via a hot
    >>> corner, but is there a way for us devs to hook into it? I am
    >>> currently using
    >>> a pmset hack which i would prefer to use a cleaner method
    >>
    >> Undocumented, use at your own risk, etc. It ends up involving more
    >> IOKit than Cocoa, as it turns out.
    >>
    >> #include <CoreFoundation/CoreFoundation.h>
    >> #include <IOKit/IOKitLib.h>
    >>
    >> int dimDisplayNow(void) {
    >> io_registry_entry_t r =
    >> IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/IOResources/
    >> IODisplayWrangler");
    >> if(!r) return 1;
    >> int err = IORegistryEntrySetCFProperty(r, CFSTR("IORequestIdle"),
    >> kCFBooleanTrue);
    >> IOObjectRelease(r);
    >> return err;
    >> }
    >>
    >>

    >

    --
    http://zon7blog.wordpress.com/
    And again we fall.
  • On 11 May '08, at 1:59 AM, Jere Gmail wrote:

    > Hi. I've tryed this code and it works. The problem is that with some
    > machines it causes a kernel panic. They are PPC machines. Isn't this
    > code compatible?

    You should file a bug report with Apple (bugreport.apple.com) then —
    code outside the kernel is never supposed to be able to cause a panic.
    Make sure to include your source code if possible.

    —Jens
previous month october 2007 next month
MTWTFSS
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        
Go to today