Shoutbox

[SOLVED] Notification/Log of Power State Changes? - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: [SOLVED] Notification/Log of Power State Changes? (/showthread.php?tid=98277)

[SOLVED] Notification/Log of Power State Changes? by prashker on 09-05-2011 at 06:04 AM

Edit: I solved the issue with debugging with PMMon, unfortunately my theory was incorrect, however it now provides me with proof for my warranty claim (randomly considering the AC as unplugged).

On my laptop, when I have the AC plugged in, I get a very occasional issue.

I have my power plan on "Balanced", basically the Windows 7 default, with the advanced settings modified for whatever, max brightness when plugged in, dim it slightly when unplugged.

Occasionally when AC plugged in, eventually for a quick second it will dim and get brighter, within a second.

Unfortunately the event happens so fast and so randomly I'm not going to stare at the systray to see when it shows that it is unplugged.

Is there somewhere in Windows I can log the events of when my laptop is plugged in and unplugged? Or a seperate program to run in the background?

For example:

quote:
6:33:01PM - AC Plugged in
6:33:02PM - AC Removed
6:33:03PM - AC Plugged in


Obviously if Windows thinks I unplugged my laptop when I didn't, then I'll take further action.

Thanks :cheesy:
RE: Notification/Log of Power State Changes? by CookieRevised on 09-05-2011 at 10:50 AM

quote:
Originally posted by SonicSam
Occasionally when AC plugged in, eventually for a quick second it will dim and get brighter, within a second.
does this happen right after you have plugged the laptop in?
If so, then that is very normal. With some laptops the switch from batt. to AC power does not happen instantly. Then there is also the issue that the software (OS) must follow the hardware, and sometimes this software needs some time to initialize the new mode too, in which is sometimes resets first (to start from the default settings so to speak). Hence you can get the 'flashing' of the screen when switching power mode. So, this does not necessarily mean Windows thinks you unplugged the laptop.

PS: If your laptop is old, the plug can suffer from wear and tear and there might be a momentairly loss of contact when you wiggle the plug in or out. Or even during normal use contact can be lost. This can cause the power plan to quickly switch too of course.
RE: Notification/Log of Power State Changes? by prashker on 09-05-2011 at 03:59 PM

It is a new laptop and it does not happen right when I plug it in. I've had it happen between 1 and 2 hours in.

I have a theory why it's happening, but I want to confirm it with timestamps and stuff before I drive to the local company where I got it custom built to look at it.


RE: Notification/Log of Power State Changes? by CookieRevised on 09-05-2011 at 04:05 PM

Never check it before myself, but maybe there are some Windows events you can check for this? eventvwr.msc


RE: Notification/Log of Power State Changes? by prashker on 09-05-2011 at 04:08 PM

quote:
Originally posted by CookieRevised
Never check it before myself, but maybe there are some Windows events you can check for this? eventvwr.msc
Checked that earlier, the only relevant event is Power-Troubleshooter which shows what wakes the machine out of sleep. Even that doesn't really help.
RE: Notification/Log of Power State Changes? by CookieRevised on 09-05-2011 at 04:35 PM

quote:
Originally posted by SonicSam
quote:
Originally posted by CookieRevised
Never check it before myself, but maybe there are some Windows events you can check for this? eventvwr.msc
Checked that earlier, the only relevant event is Power-Troubleshooter which shows what wakes the machine out of sleep. Even that doesn't really help.
Hmm... you sure? Because there are special event messages for this according to MSDN. Maybe they are not enabled to show up in the Event Log by default though. So, if you can't find the correct settings to enable them or something like that, maybe you can make your own event logger catching the WM_POWERBROADCAST broadcasted Windows message with the PBT_APMPOWERSTATUSCHANGE event id. And when the app recieves this message, you can check the power state with the GetSystemPowerStatus API.
RE: Notification/Log of Power State Changes? by prashker on 09-05-2011 at 05:01 PM

quote:
Originally posted by CookieRevised
Hmm... you sure?
Not really. I will look again but in the mean time searching WM_POWERBROADCAST linked me to http://exodusdev.com/products/monitor-win32-power-management-events

Seems like exactly what I want, but I will look into seeing it through Event Logger.

edit: Works perfectly and does actually EXACTLY what I want. Thanks :banana: