Author |
Topic |
|
jthorne
4 Posts |
Posted - 06 Jun 2008 : 02:53:31
|
We have a BitsyXb-based device in development that has its own keyboard, control buttons and scroll wheel. The software is being developed in C++ using Visual Studio.
I would like for activity on any of these input devices to "count" as activity for the power management system so that it will both prevent the system from doing things like shutting down the backlight, etc., and will cause said power management to re-enable any devices that are suspended. We'll be experimenting with a number of different power management options, but we can't do much until we've resolved this issue.
I can't escape the idea that there must be some function somewhere that tells Windows that some user activity has happened. I've tried various methods of faking it out such as using mouse_event and keybd_event and SendInput. I've also tried SetPowerRequirement and DevicePowerNotify. I've tried using code from the backlight test on this site, which doesn't work, but that's only a subset of what I'm looking for anyway. I feel like I'm getting farther and farther away from a solution, not closer.
Guidance would be appreciated.
|
|
akidder
1519 Posts |
Posted - 06 Jun 2008 : 07:54:44
|
Good question. I believe SystemIdleTimerReset() is the function you need.
Call it each time you process input from one of your devices. |
|
|
beitman
63 Posts |
Posted - 06 Jun 2008 : 08:35:12
|
That is correct, SystemIdleTimerReset() will reset the inactivity timers. This will prevent the system from turning off the backlight and from suspending. |
|
|
jthorne
4 Posts |
Posted - 06 Jun 2008 : 19:48:17
|
quote: [i]Originally posted by beitman[/i] [br]SystemIdleTimerReset() will reset the inactivity timers. This will prevent the system from turning off the backlight and from suspending.
Tried that. It may prevent turning off the backlight, but it doesn't turn it back on if it's already gone off, nor does it do any of the other unsuspending that may be necessary depending on the power management settings.
|
|
|
ctacke
877 Posts |
Posted - 06 Jun 2008 : 21:22:20
|
For the backlight you'll have to specifically set its state then. Not sure what other "unsuspending" you might be talking about - if the device is fully asleep the processor is off, so you're not going to get any input. The way around that is the set up the GPIO as a wake interrupt (if that's supported on the specific pin you're using - IIRC some do, some don't) or to use a notification to wake the device before the input occurs. You'd have to know when to expect that though.
I think for your scenario the best route is going to be to tie them to an interrupt in any case. In the interrupt handler check the backlight and turn it on/brighten it if necesssary and power up any peripheral you think you need to (what ones are you using that are getting shut off?). If you need it to wake from full sleep then make sure that all of them are on wake-able interrupt lines (the PXA-270 processor manual will tell you which ones are). |
|
|
ctacke
877 Posts |
Posted - 09 Jun 2008 : 08:33:46
|
There's been a little discussion on what your original post means, which inherently means it's unclear exactly what you're trying to achieve. Can you provide some use cases that describe what you're after? For example, if the device is in a normal state - running, backlight on, all peripherals up), what should pushing a button do? What if the device backlight is dim, but everything else is running? What if the device is fully suspended (processor and all peripherals are off)? |
|
|
beitman
63 Posts |
Posted - 09 Jun 2008 : 10:06:27
|
quote: [i]Originally posted by jthorne[/i] Tried that. It may prevent turning off the backlight, but it doesn't turn it back on if it's already gone off, nor does it do any of the other unsuspending that may be necessary depending on the power management settings.
You are absolutly correct, the backlight control on the BitsyXb is not working with SystemIdleTimerReset(). We will take a look at it. |
|
|
|
Topic |
|