NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Add-ons (3rd party plugins, utilities and skins) Old Stuff (Legacy) GB-PVR Support (legacy) v
« Previous 1 … 157 158 159 160 161 … 1231 Next »
Simple power management in HTPC

 
  • 0 Vote(s) - 0 Average
Simple power management in HTPC
elmede
Offline

Junior Member

Posts: 11
Threads: 4
Joined: Feb 2009
#1
2009-03-05, 12:42 AM
Hi all..

I want to share my experiences and my setup for managing the power of my HTPC..

Here it goes:

What I want is:
1. Machine should hibernate if no remote activity is registered for a set period of time (say 1 hour)
2. If machine is working either recording a show or transcoding something then machine should not hibernate.

Notice how (2) doesn't mean any activity of remote/keyboard/mouse. And also, if we go by CPU activity, recording a show doesn't mean a lot of CPU activity (between 10-25%)

Windows integrated power management doesn't work because as soon as CPU usage jumps over 10%, it restarts its standby/hibernation/shutdown timer. Therefore, (2) would be accomplished, because recording and of course also transcoding would keep machine from hibernating. However not No. 1 because simply watching TV (withouth recording, and without sending any control remote commands means over 10% CPU)

Solution: TOff. I found out this utility which is much more powerful than windows power management. It has a simple activity timer and regardless of CPU it executes the desired "OFF" command (in my case soft hibernation) when no keyboard/mouse activity is recorded.

## Problem #1

This led to the following problem. TOff didn't care I was controlling PVRX2 with the remote control changing channels, visiting menu guide, whatever.

I'm using HIP, so there lied the problem. I was using only POST commands to send commands to PVRX2. Of course, those aren't keyboard commands, those are some kinda underground between programs commands. So I changed from POST commands to keystrokes and problem solved

## Problem #2

Now, how to prevent TOff from hibernating the computer when GBPVR is recording. What I did was I created a recordingstatus.bat file. What it does: It sets two GBPVR "stages" one is RECORDING and the other is AFTER-RECORDING. We recognize stage by the recordingstatus argument. When GBPVR starts recording the word "Recording" is passed as part of the command line argument to the recordingstatus batchfile. When it finishes, the word "Sleeping" is passed as part of the command line argument. Therefore, we detect which of those two words was received and: If on RECORDING stage, the TOff command is closed by the /closeall flag. If on AFTER-RECORDING stage, call the Toff batchfile and start the hibernation timer again.

## Problem #3

At last, how to keep program from hibernating when transcoding a recording. When GBPVR sends a movie to be transcoded, recordingstatus still receives "Sleeping" as part of the command line argument. So our current setup so far has TOff running and with no activity, it would hibernate no matter what after the timer rouns out. Solution?? Easy and within the same TOff. It has a configurable CPU level for considering CPU activity as timer resetting. I set this to 70% (ffmpeg runs over 80% almost constantly) so it is set.

## Problem #4

After hibernating, TOff closes and then when resuming there's no TOff back, so we don't have power management. Toff includes an appealing option called "Every time". This appears to work and it does work. When returning from hibernation, Toff starts again with the same settings. "Every time" means that TOff is run with the same settings every time a user logs on, just like when you return from hibernation. Problem arises when you get to the RECORDING stage of recordingstatus batchfile, it sends a /closeall signal to TOff to close the running TOff. When this happens, TOff has to know if you want TOff to start again upon another user logon or not. That means a dialog box which eliminates the automation objective. Therefore, the "Every time" option is out of question.

Solution: I use the wake.cmd file. In that file, I first send a /closeall signal to TOff (in the case that the hibernation was manual and therefore TOff wasn't closed automatically) and then call again the TOff batchfile to start the timer again.

## Manual hibernation

I didnd't spend too much time thinking about this. For me it was simple. I set the power button on the HTPC to do nothing. So when you press it, it just doesn't do anything. And I mapped the power button from the remote control to the execution of a bat file: tryhiber.bat.

If you look at the recordingstatus batchfile, you'll see that when arriving to the RECORDING stage I create c:\pvrwrkng file so that when I get "Sleeping" as command line and that file exists, it goes to AFTER-RECORDING stage.

This tryhiber.bat simple sees if the file c:\pvrwrkng exists. If it does, it doesn't hibernate. If it doesn't exist, then it goes to hibernate with a TOff command. This TOff command doesn't mess with an already running TOff command.

There are a lot of uncovered corners here:
- When transcoding it hibernates (shouldn't matter, since hibernation should return back to the point where the ffmpeg process left)
- Going to the start menu to hibernate and hibernating isn't stopped
- If you don't have the remote, you can't hibernate (doesn't matter too much to me, it hibernates after an hour automatically)
- I don't know what happens when you try to hibernate from the system submenu in pvrx2

I'm attaching Recordingstatus.bat, wake.cmd, tryhiber.bat, toff.bat and the hip file. Of course, you have to check for paths. The files are extremely short though.

About the hip file, check my other post for some clarification, it's pretty much standard with very few tweaks. Keeping it in its own post for easy finding.

Mede
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#2
2009-03-05, 03:29 AM (This post was last modified: 2009-03-05, 03:33 AM by pBS.)
fix for hip: i got around the system not seeing my hip cmds as activity by adding a little control press before each command, basically like hitting cntrl, then letting it go, then sending post cmd...a simple control on-off shouldn't mess with anything, and it gets windows to see a key has been pressed...no effect on gbpvr...Smile [just add a ^ before the post command]

oh and hitting hibernate from pvrx2 system menu shouldn't allow hibernate while recording, but will force one any other time...
why anyone would want to 'force' a sleep mode is beyond me, when there's a program telling windows data loss will happen if you do...and vista is worse so don't expect it to get better anytime soon..
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
fuzzweed
Offline

Posting Freak

Posts: 1,210
Threads: 200
Joined: May 2006
#3
2009-03-05, 08:15 AM
i think theres something odd with your PC - or maybe I'm missing your point completely.

Quote:1. Machine should hibernate if no remote activity is registered for a set period of time (say 1 hour)
2. If machine is working either recording a show or transcoding something then machine should not hibernate.

This is standard behaviour on mine just using windows power options. The only addition i needed was Slimmtray (look at the wiki) to prevent any acidental manual sleeping while recording.
[SIZE="1"]Server: Win7 N | AMD Phenom II X4 3.2GHz | 4Gig RAM | Gigabyte GA-MA770-DS3 Mobo | 5TB+ HDDs | 2x BlackGold Twin HD DVB-T| ATI HD 5450 | Cambridge Audio DAC Magic
Client 1: OpenElec / XBMC | Dell GX280 P4 3.4GHz |2Gig RAM | ATI HD 5450 | SPDIF pass through
Client 2: OpenElec / XBMC | Dell GX280 P4 3.4GHz |2Gig RAM | ATI HD 5450 | C-MEDIA USB DAC
Android: Samsung Galaxy S2 GT-I9100 4.4.2 Cyanogenmod 11[/SIZE]
martint123
Offline

Posting Freak

UK, East Yorkshire
Posts: 4,658
Threads: 208
Joined: Nov 2005
#4
2009-03-05, 08:57 AM
Mine behaves as expected.

(1) 10 minutes (in my case) of no activity and it hibernates.
(2) If using remote clients, recording or playing back - stays awake.
I'm not sure about transcoding as I don't do any.

Quote:Notice how (2) doesn't mean any activity of remote/keyboard/mouse. And also, if we go by CPU activity, recording a show doesn't mean a lot of CPU activity (between 10-25%)

GBPVR itself tells windows to stay awake while it is doing things. So low activity while recording is not a problem.


Quote:Windows integrated power management doesn't work because as soon as CPU usage jumps over 10%, it restarts its standby/hibernation/shutdown timer.

I haven't seen this and in fact when I remotely connect in, I have had the server shut down on me while doing CPU intensive tasks.
I'm just using absolutely standard Windows power management and have no problems (other than a monthly loss of nova-t-500 drivers that a reboot fixes).
elmede
Offline

Junior Member

Posts: 11
Threads: 4
Joined: Feb 2009
#5
2009-03-05, 04:17 PM
Those are curious cases...

Check this out:
http://support.microsoft.com/kb/899975

It states that when CPU use arises, timers aren't that well respected...

I found out that information upon my frustration of windows power management not working exactly the way I wanted and coming up with a thread here at forums.gbpvr.com http://forums.nextpvr.com/showthread.php?p=308496
elmede
Offline

Junior Member

Posts: 11
Threads: 4
Joined: Feb 2009
#6
2009-03-05, 04:20 PM
pBS: That's a great idea!!!

I actually had thought of some way of sending double commands from HIP to the computer, but didn't find a way of doing it easy. I even thought of enabling the "send every keystroke to girder" or something like that and then install girder to reproduce behaviour. Of course it was toooooo much work I just ended up changing post commands to direct keystrokes. Your idea would have worked pretty well also!!

Any advantages you see in using Post commands instead of keystrokes??
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#7
2009-03-05, 06:54 PM (This post was last modified: 2009-03-07, 03:18 AM by pBS.)
just that the controlled app doesn't need focus and doesn't take it away from other apps if you use post codes..

my system does work as expected, just some parts windows doesn't even play by it's own rules...

#1 issue for me, [standard behavior tho] is that the clock on main menu will keep my machine from going into sleep modes, so i have to go to another screen [like recordings] that doesn't have a clock on it..tsk tsk...[where does it say windows won't go into sleep because of SCREEN activity?] and windows timer doesn't see the post key commands, so it goes to sleep while i'm in menus frequently...
i use fse but that shouldn't matter...

second, it won't let me run a program before sleep, even tho it says it should wait for programs that say they can't be closed just yet...
so actually toff and wosb do the trick just right...Smile

ps, umm Elmede, i use only post codes, and my toff sees the activity from hip just fine for every keystroke and resets it's timer accordingly..not same for you? i just use the ^ trick for the power-on button so i can clear screensaver..
open gui for toff and look at timer at bottom...it should reset when remote post code sent...
[set for 1 minute sleep to see timing better]
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
elmede
Offline

Junior Member

Posts: 11
Threads: 4
Joined: Feb 2009
#8
2009-03-12, 11:44 PM
Well, it's kinda weird then..

Using only post codes never worked for me.. What I did was precisely set the timer to 1 minute and then set the alarm message box on 30 seconds before timing out. That way, I'd know 30 seconds before it hibernated. The box kept appearing and with its timer counting down, even when the menus in PVRX2 was scrolling or I was changing channels.. The only solution for me was to set straight keystrokes in HIP.

Of course, using the ^ trick before the post commands would work just fine.. Just that I'm really comfortable with my setup right now..

The only change I made was that in Wake.cmd i had something like:

start c:\toff.exe /closeall
call c:\toff.bat (with all the command line arguments)

And I had the problem that sometimes the TOff process closed and didn't appear after resuming from hibernation..

Situation was that the call to toff.bat was being executed BEFORE the /closeall one.. The only thing I had to do was add the /WAIT flag to the start c:\toff.exe and it's all perfect now!! Big Grin I'm a happy gbpvr user..

In the end, the Wake.cmd file is something like:

start /wait c:\toff.exe /closeall
call c:\toff.bat

And that's it...

El mede

Ohh, and btw, what the hell is that, that windows "sees" the clock as activity!? OMG!! hahahah!! It's a windoze world after all Wink
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  STB resets on power failure waveking 12 4,022 2010-06-05, 04:23 AM
Last Post: waveking
  Is there a simple way to get a snapshot of live tv or from a recorded show? hexibot43 12 3,743 2010-04-25, 01:50 PM
Last Post: HarryH3
  Power DVD problems time_lord 6 2,547 2010-02-11, 10:11 AM
Last Post: time_lord
  IR Blaster - power on an STB icrra 1 1,492 2010-01-24, 07:20 PM
Last Post: rbelisle
  HTPC crashes when recording service restarts bezza 1 1,161 2009-11-20, 10:43 PM
Last Post: gEd
  Setting up client without simple file sharing Reddwarf 4 1,887 2009-08-30, 07:28 AM
Last Post: Reddwarf
  getting ready to set up htpc... TATTOOZIT 5 2,074 2009-07-06, 08:24 PM
Last Post: TATTOOZIT
  Very simple question adm1jtg 1 1,239 2009-06-29, 09:35 PM
Last Post: whurlston
  green power button cricka15 3 1,856 2009-04-14, 04:46 AM
Last Post: griffy
  HTPC GURU help needed mmatheny 28 7,344 2008-12-05, 08:06 PM
Last Post: mmatheny

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

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

Linear Mode
Threaded Mode