NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public NextPVR Support Windows v
1 2 3 4 5 … 102 Next »
Standby/Sleep During Playback

 
  • 0 Vote(s) - 0 Average
Standby/Sleep During Playback
fla
Offline

Posting Freak

Posts: 890
Threads: 46
Joined: Mar 2006
#51
2025-07-06, 04:03 AM
Here's the pwrtest output matching these actions:

22:29 Start playing
22:31  no more mouse movements on server
22:46 ping timeout & playback freezes
22:48 manual wol
22:48:27 ping ok & playback resumes

PS.
Unhid the unattended sleep mode and set it to zero (it was 10). My hibernate delay is 15 min and the powercfg /sleepstudy says that the "Remaining sleep timeout source" is "Hibernate Timeout". Hibernate indeed happens 15 min after stopping any server mouse activity.


Attached Files
.zip   pwrtest.zip (Size: 636 bytes / Downloads: 1)
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 53,126
Threads: 957
Joined: May 2006
#52
2025-07-06, 04:30 AM
You need to research ES_SYSTEM_REQUIRED and see why it isn't working on your system.

Martin
fla
Offline

Posting Freak

Posts: 890
Threads: 46
Joined: Mar 2006
#53
Yesterday, 12:35 AM
My NextPVR server is Windows 11 and resetting the system idle timer with ES_SYSTEM_REQUIRED on Windows 11 fails:

But this does not work anymore on Windows 11

But in Windows 11, that doesn't work anymore

This powershell script that keeps windows from sleeping works on Windows 10 but not on Windows 11. I set my system to sleep after one minute to test.

Code:
$passlen = 1 # seconds between passes
$passNum = 0
$maxpass = 240 # after this number of passes, timer reset is skipped
$skipstr = ""

while ($true)
{
    $code=@'
[DllImport("kernel32.dll", CharSet = CharSet.Auto,SetLastError = true)]
  public static extern void SetThreadExecutionState(uint esFlags);
'@

    $ste = Add-Type -memberDefinition $code -name System -namespace Win32 -passThru
    $ES_CONTINUOUS = [uint32]"0x80000000" #Requests that the other EXECUTION_STATE flags set remain in effect until SetThreadExecutionState is called again with the ES_CONTINUOUS flag set and one of the other EXECUTION_STATE flags cleared.
    $ES_AWAYMODE_REQUIRED = [uint32]"0x00000040" #Requests Away Mode to be enabled.
    $ES_DISPLAY_REQUIRED = [uint32]"0x00000002" #Requests display availability (display idle timeout is prevented).
    $ES_SYSTEM_REQUIRED = [uint32]"0x00000001" #Requests system availability (sleep idle timeout is prevented).

    Switch ($option)
    {
      "Away" {$setting = $ES_AWAYMODE_REQUIRED}
      "Display" {$setting = $ES_DISPLAY_REQUIRED}
      "System" {$setting = $ES_SYSTEM_REQUIRED}
      Default {$setting = $ES_SYSTEM_REQUIRED}
    }

    if ( $passNum -lt $maxpass )
    {
        #$ste::SetThreadExecutionState($ES_SYSTEM_REQUIRED -bor $ES_DISPLAY_REQUIRED) # success
        $ste::SetThreadExecutionState($ES_SYSTEM_REQUIRED) # Win10 success, Win11 Fail

        $ste::SetThreadExecutionState($ES_CONTINUOUS)
    }
    elseif ( $passNum -eq $maxpass )
    {
        $skipstr = "(skipped)"
    }
    $passNum += 1
    Write-Host "Reset timer: pass #"$passNum time ($passNum * $passlen) seconds $skipstr
    Start-Sleep -Seconds $passlen;
}

Resetting the display idle timer (commented out) works on Windows 11 too but the screen stays on.
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 53,126
Threads: 957
Joined: May 2006
#54
Yesterday, 01:01 AM
I read your link and it appears it works when it is on a timer like sub designed.

Martin.
fla
Offline

Posting Freak

Posts: 890
Threads: 46
Joined: Mar 2006
#55
Yesterday, 03:15 AM
I failed to give you credit but the stackoverflow link was from your post. The WinSCP author answered his own question. He had to use the ES_CONTINUOUS API as in the Example in the learn.microsoft.com link also from your same post.

If sub used the ES_CONTINUOUS API during playback then we could see the persistent active power requests with powercfg /requests instead of requiring pwrtest.exe for transient things.

Resetting the system idle timer can be done willy-nilly by many threads. The ES_CONTINUOUS API requires clearing the EXECUTION_STATE flags when we're done which makes things much more complicated in a multi-threaded scenario. He used a separate thread to create the single continuous power request on the first thread's power request and cancels it after a 5 second timer expires. Each time any thread needs new/continued power, it's request causes the 5 second timer, if still active, to start over delaying the single power request's cancellation.

The powershell script above resets the system idle timer every 1 sec (observable with pwrtest.exe) kind of like sub's one minute timer during playback and that works great on Win10 but fails on Win11.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (6): « Previous 1 2 3 4 5 6


Possibly Related Threads…
Thread Author Replies Views Last Post
  New Installation on WIN11 Sleep Problem 12vibes 1 12 3 hours ago
Last Post: mvallevand
  nextpvr.exe playback issues? hae 7 886 2025-05-31, 09:02 PM
Last Post: sub
  playback issue artmetz 4 458 2025-03-28, 07:47 PM
Last Post: artmetz
  NextPVRServer.exe (Version 7) Preventing Sleep PVR_Convert 4 500 2025-02-18, 07:18 PM
Last Post: mvallevand
  No standby after update to Version 7 Escape7 163 12,265 2025-01-04, 05:27 PM
Last Post: sub
  Jerky Playback at 2160p dshorrosh 6 713 2024-07-17, 01:49 PM
Last Post: mvallevand
  Error at 58 minutes playback Offroad 4 680 2024-06-01, 01:17 PM
Last Post: Offroad
  Recording wont resume, just playback from beginning dallascowboy23 26 3,451 2024-05-15, 01:35 PM
Last Post: mvallevand
  Sleep WakeUp, PC shuts down instead FM5 3 582 2024-05-09, 09:52 PM
Last Post: mvallevand
  Playback record skips back while recording a program sgar75 2 654 2024-03-23, 05:41 AM
Last Post: sgar75

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

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

Linear Mode
Threaded Mode