Re: Service to handle power down




Not going to happen. You can get a notification of the power state change,
but in reality your code likely won't get a chance to run until after power
comes back up. If it does run, you'd probably only get about 2 lines of
code, if that, and it would't be reliable in the number of instructions to
execute before suspending. Only drivers get serialized "notifications"
during power up or down (via XXX_PowerDown/Up) and they can't make API calls
during those methods anyway, so you can't call another driver to shut down.

The only options are to use some handler hooked into the power control
driver (if the OEM implemented anything for it) or to have the actual bug
fixed.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com


"Craig" <Craig@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3856CE7F-7E96-4ABC-B218-2753FBFC05B5@xxxxxxxxxxxxxxxx

Hello Bruce,
I didn't want to get into it too much because I didn't think it was
necessary, but since you asked ...
My service is a special debug service that, among other things, outputs
special app level debug messages over COM2. The vendor for our BSP
appears
to have a bug which will (very rarely) cause the system to crash (or
freeze)
when resuming from suspend. My service keeps the COM2 port open during
sleep
and we feel that if it is closed during sleep we won't see this issue (we
saw
another issue with RAS server over COM1). So changing state for me means -
closing the COM2 port on a suspend and re-opening it on resume.

Thank you for your feedback,
Craig

"Bruce Eitman [eMVP]" wrote:

Why don't you explain more why this service needs to "change state" and
what
that really means.

--
Bruce Eitman (eMVP)
Senior Engineer
Bruce.Eitman AT EuroTech DOT com
My BLOG http://geekswithblogs.net/bruceeitman

EuroTech Inc.
www.EuroTech.com

"Craig" <Craig@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4F28DFAF-9574-4167-A682-212F5E748AB1@xxxxxxxxxxxxxxxx

Hello,
I have written a service in WinCE 5.0. I now need this service to
change
its state when the system is suspended and when it resumes.

I have read that the xxx_PowerDown and xxx_PowerUp messages are not
handled
in a service (running in services.exe).

Is there a way that I can get messages that the system is about to
power
down within my service? Can a service respond to the IOCTL_POWER_SET
messages?

Thank you for any assistance you can provide,

Craig





.



Relevant Pages

  • Re: Save open files on suspend
    ... POWER_STATE_SUSPEND notification is really sent (the message written ... This code is called only when the system is about to suspend, ... in front of WaitForSingleObject in power manager. ... HANDLE hAckEvent = NULL; ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Fast Start-up
    ... you could theoretically use information in RAM to make a decision on ... CE does not define the power of the board in suspend, ... Most of the boot time and resume time is in the OEM code. ...
    (microsoft.public.windowsce.embedded)
  • Re: Safely SHUTDOWN Device from Application
    ... for power failure situations where you have some form of backup power like ... How you handle suspend is very much hardware dependent, ... It's then up to the app to take ... applications of mine that might deal with the flash and no other user ...
    (microsoft.public.windowsce.platbuilder)
  • Re: General network driver suspend/resume (was e1000 carrier related)
    ... 7.3* version of the driver from sourceforge. ... Changing this to bring up the link would make the card start to consume lots more power, which would automatically suck enormously for anyone using a laptop. ... Perhaps this needs to be fixed upstream in pci_save_state for msi devices, but the api for msi is not capable of detecting this atm. ...
    (Linux-Kernel)
  • Re: SendMessage (in secondary thread) freezes application GUI thre
    ... power left, the application stopped hanging... ... Then, in the non-UI thread, check the flag. ... queue and, again, the third thread will process that. ... will probably suspend before the about-to-suspend message gets to the UI ...
    (microsoft.public.windowsce.app.development)