NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Support Legacy (v4.x and earlier) v
« Previous 1 … 387 388 389 390 391 … 433 Next »
awaymode and shutdownblockreason

awaymode and shutdownblockreason
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#1
2011-01-10, 01:27 AM
Sub, are you using awaymode? npvr really needs it while recording..
it prevents sleep modes and is made pretty much just for recording apps like this..
it's super simple to implement, just one call when recording, and another to clear those flags when done..
even if user hits sleep button it still enters away mode and screen blanks, but press any key and display comes back on...
if no user interaction and you clear flag when recording's done, system will go ahead and continue the sleep mode transition...so it kinda like pauses sleep mode till recordings are done, then sleeps...
also would prevent sleeping when resumed automatically for recordings....[not using enough cpu for windows to notice it still needs system..]

from rec service, call SetThreadExecutionState with ES_SYSTEM_REQUIRED + ES_CONTINUOUS + ES_AWAYMODE_REQUIRED [0x80000041]
to enter away mode when recording, and ES_CONTINUOUS [0x80000000] to clear it and let system suspend.. by using ES_CONTINUOUS, you only have to do it once till recording ends, when you clear it..works reliably from all my testing..
[actually i've been using this in a separate app i made, would be better built in]

and to prevent accidental shutdown while recording, use the ShutdownBlockReasonCreate and destroy which brings up that dialog so users do have a chance to force shutdown when need be, but it'll sit there forever till the reason is destroyed or user selects cancel or shutdown, and i was putting the name of recording in reason text so you could decide if recording was worth it..Smile

i have working code for both, and it's not much to add..
works in vista/7 only, i know you were using ES_SYSTEM_REQUIRED in pvrx2, but it doesn't prevent sleep in vista/7..
since this app is best on vista/7, might as well make it modern...Wink
let me know what you think..

and man, don't ya just hate it when the pets walk on the keyboard sleep key? Big Grin
http://msdn2.microsoft.com/en-us/library/aa373208.aspx
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
Lao Pan
Offline

Posting Freak

UK (Mendip TX)
Posts: 1,300
Threads: 114
Joined: Oct 2008
#2
2011-01-10, 10:21 AM
This would be very useful - also on epg update.
My Vista set-up reqularly goes back to sleep before completing.
Unattended resume + insufficiant activity = 6mins then shutdown - epg update takes 8-10 mins.

Also I have been in the press sleep button on the remote - then remember I was recording Wife's favourite prog - Of cause she thinks it is deliberate!!!
It's not an overly complicated system - it's more - overly simple operatives  Huh
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#3
2011-01-10, 10:33 AM
Is this really the case? I'm surprised more complaints haven't surfaced then, because people must have been using GBPVR on Vista and Windows 7 for ages now?

If so, it's unfortunately another reason to keep my setup on XP for a while longer (while I continue to use GPBVR). I thought I was just about good to go on a Win7 switch, but I have to admit this wasn't one of the things I tested.
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,627
Threads: 767
Joined: Nov 2003
#4
2011-01-10, 04:51 PM
It already tries to keep the machine awake. It doesnt use ES_CONTINUOUS, but instead opts to regularly call ES_SYSTEM_REQUIRED.
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#5
2011-01-10, 07:42 PM (This post was last modified: 2011-01-10, 07:49 PM by pBS.)
unfortunately the ES_SYSTEM_REQUIRED doesn't do anything that i can see in win7..[cept reset auto-sleep timers]
also, when resuming to record, it's a different timer that is enacted, and i'm not positive it responds to ES_SYSTEM_REQUIRED..maybe only in win7,not vista..

LoaPan, there is a setting that can increase the automated resume sleep timer delay...[when woke to do recording]
but if your system doesn't generate enough cpu for win to notice, you'd have to set it longer than any proposed recording time..
which is why this is needed...those not running comskip would see this..[comskip usually generates enough cpu usage]

i've been using my shutdown protector for about a year now..just stumbled upon awaymode and found it was perfect and the only way to deny sleep modes at all in win7..
[i was looking just to delay it for another app]

only problem i've found is that sleep notifications are turned off during time awaymode is requested...which almost makes sense, cuz can't sleep while an app is saying it needs to be awake...but as soon as you clear flag,system resumes the sleep that was initiated..
the only use for this would be an unattended recording system, exactly like we have here...
one call when busy recording, one when not...less work than calling it all the time too...Smile
and system will wait indefinitely util away mode cleared..but user can bring it out of black screen to se what's going on..[like xp autoresume mode which is basically all it is]

if there's logic to know when any recording is happening, then tie it to that and you're good to go..
this just denotes your program is running critical services and needs to be left on till it's finished...
really works a charm here...Smile

if you aren't going to put it in npvr, is there an easy way to know any recording is going on? [besides querying db for status 1]
i used to snag info from the tray, but now it's in tree structure and like 50 times harder to get any text out of it!
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
sub
Offline

Administrator

NextPVR HQ, New Zealand
Posts: 106,627
Threads: 767
Joined: Nov 2003
#6
2011-01-10, 07:57 PM
pBS Wrote:unfortunately the ES_SYSTEM_REQUIRED doesn't do anything that i can see in win7..[cept reset auto-sleep timers]
also, when resuming to record, it's a different timer that is enacted, and i'm not positive it responds to ES_SYSTEM_REQUIRED..maybe only in win7,not vista..
This has always been enough to keep the machine aware in XP/Vista/Win7 as far as I'm aware, including when resuming to record.

The reason I do that instead of using ES_CONTINUOUS is because these actions that tell the machine to stay awake are occuring in multiple threads (and even processes), with no visibility of each other, and it wasnt clear to me that clearing ES_CONTINUOUS from one would not interfere with the others.
imilne
Offline

Posting Freak

Posts: 2,423
Threads: 135
Joined: Feb 2008
#7
2011-01-10, 09:02 PM
I gave NPVR a quick test in Windows 7 after reading this and it performed as expected. Stayed awake while recording (not necessarily "away mode" as the screen was still on) and went to sleep if left idle.
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#8
2011-01-10, 11:22 PM
yea, this is only for user accidentally trying to induce sleep mode, with either sleep button or from menus...not noticing the background service was recording at the time..
i guess i can integrate it into my shutdown protector for complete protect externally, in addition to the sleep timer prevention..
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
z06racer66
Offline

Member

Posts: 116
Threads: 27
Joined: Jun 2010
#9
2011-01-15, 01:58 AM
I actually had this just happen to me. I was in NPVR canceling a duplicate recording and after I exited NPVR, without thinking, I pressed the sleep button on my remote. The computer instantly went to sleep (I don't think I've ever seen it go to sleep so quicklyWink). I quickly turned the computer back on and it resumed recording. I hope it was during a commercial break when that little snafu happened. It would be nice if it would protect me from doing things like this because I'm sure it won't be the last.
NextPVR 6.x
NextPVR Windows Client
Windows 10 x64 Home
AMD 4850e
4GB RAM
GeForce GT 710
240 GB SSD + OMV 16TB NAS
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#10
2011-01-16, 09:07 PM
that's exactly what i'm hoping to prevent..Smile
my little helper app will be ready soon, it prevents shutdown/suspend modes while recording, tho user has option of continuing after being told why machine isn't sleeping/shutting down..i still have to find some way to give user option to sleep even when recording, after seeing dialog..

http://forums.nextpvr.com/showthread.php...-Recording
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (2): 1 2 Next »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode