Is there any documented way to programmatically change the power state of a
device (i.e. power off or power on) from usermode? (I'm not particularly
knowledgeable about programmatically controlling power management...)
In particular, I'm looking to be able to power on or power off an arbitrary
USB or 1394 device (i.e. not a device I wrote the driver for). For example,
I might have an externally powered USB or 1394 device that is attached to a
battery backup system that is separate from the battery backup system the
computer is on. I can determine whether the battery backup system that the
external device is on is low on power or not, but I need a way to gracefully
shutdown the appropriate device before an impending power loss. Because the
computer itself is on a different battery system (say for the sake of
argument that it is a higher capacity battery system), I don't want (or
need) to shut down the computer entirely, just the affected devices.
Assume for the moment that I have control over any applications that might
be using said devices and can make sure that they relinquish usage before I
try to shutdown the device.
One option I see is to request a graceful device removal (e.g.
CM_Request_Device_Eject_Ex), since the devices are going to be on a
hotpluggable bus, but this seems suboptimal for what I'm looking for.