Thread: Waking Laptop on AC Power

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    648

    Waking Laptop on AC Power

    I was wondering if there is some API/trick/hack that would allow a laptop to wake up from sleep when it senses that it is connected to power, or that its battery is charging. I know I could build an external device that would send a wake-up network packet when it senses power, but I want to do this purely in software, i.e. via API.

    If this cannot be done on Windows, perhaps Linux?

  2. #2
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    I don't think it would have anything to do with OS. When the computer is sleeping, the CPU is shut off, so no code is running. You'll have to somehow do it in BIOS.

  3. #3
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    yes, the APM API will let your application detect whether it is on battery only or connected to AC. It could then issue a wakeup command. I believe you would only be able to have it in low power mode though, as the aplications has to actually run occasionally.

  4. #4
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,229
    ACPI does, too. But the computer will have to be awake to check it.

  5. #5
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by cyberfish View Post
    ACPI does, too. But the computer will have to be awake to check it.
    Yeah i don't think it can go into full shutdown, or hibernate, but there are a few modes it can use that still allow applications to occasionally process WM_ or APM_ message


    http://msdn.microsoft.com/en-us/libr...35(VS.85).aspx
    Last edited by abachler; 09-26-2009 at 12:14 AM.

  6. #6
    Registered User
    Join Date
    Apr 2009
    Posts
    187
    i think u can make a pc wake up from shutdown by wake on lan it allows pc in network to open each other

  7. #7
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    Quote Originally Posted by elwad View Post
    i think u can make a pc wake up from shutdown by wake on lan it allows pc in network to open each other
    Theres an easier way than that, as the article i linked to says, you just have to create a waitable timer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. USB-controlled AC Power?
    By SMurf in forum Tech Board
    Replies: 1
    Last Post: 07-27-2009, 02:18 PM
  2. If you're getting a laptop, don't get a gateway
    By jverkoey in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-09-2004, 09:28 PM
  3. Laptop Power Problim!!
    By Nectron in forum Tech Board
    Replies: 13
    Last Post: 07-09-2003, 09:01 AM
  4. Laptop power?
    By Speedy5 in forum Tech Board
    Replies: 4
    Last Post: 07-01-2003, 08:38 PM
  5. Laptop Hard Disk Power Connection
    By minesweeper in forum Tech Board
    Replies: 6
    Last Post: 03-01-2003, 12:24 AM