Trouble restarting TVservice on resume (1 Viewer)

doveman

Portal Pro
February 12, 2008
2,326
178
Home Country
United Kingdom United Kingdom
I need to stop and restart TVservice on resume for my Nova-T 500 PCI tuner card to work and unfortunately PS++ can't do this, so I have to use something else. In the past I was using MPStandbyHandler but I can't seem to get it to work now, so I hope someone can help me fix it or find another way to achieve this.

The log shows

27/08/2013 14:15:56 - INFOSystem PowerEvent: Suspend
27/08/2013 14:15:56 - INFOOnSuspend
27/08/2013 14:15:56 - DEBUGJobTools Load - Loading SUSPEND jobs from C:\ProgramData\MPstandbyHandler\Jobs
27/08/2013 14:15:56 - DEBUGJobTools Load - Loaded 0 SUSPEND jobs
27/08/2013 14:15:56 - DEBUGJobTools Load - Loading RESUME jobs from C:\ProgramData\MPstandbyHandler\Jobs
27/08/2013 14:15:56 - DEBUGJob Load - Job TVServiceStop has 6 properties
27/08/2013 14:15:56 - INFOJob Load - Loaded RESUME job TVServiceStop
27/08/2013 14:15:56 - DEBUGJob Load - Job TVServiceStart has 5 properties
27/08/2013 14:15:56 - INFOJob Load - Loaded RESUME job TVServiceStart
27/08/2013 14:15:56 - DEBUGJobTools Load - Loaded 2 RESUME jobs
27/08/2013 14:15:56 - INFOFlags Load - Loading flags from C:\ProgramData\MPstandbyHandler\Flags-Service.xml
27/08/2013 14:15:56 - WARNINGFlags Load - Error loading flags Root element is missing.
27/08/2013 14:16:11 - INFOSystem PowerEvent: ResumeAutomatic
27/08/2013 14:16:11 - WARNINGOnResume - OnResume called but not suspended
27/08/2013 14:16:11 - INFOSystem PowerEvent: ResumeSuspend
27/08/2013 14:16:11 - WARNINGOnResume - OnResume called but not suspended
I set a simple NetworkCheck job on Suspend to give it something to do but as you can see, it's not doing that when I send the PC to sleep, nor is it doing the TVService stop and start jobs on Resume. It says "OnResume called but not suspended" which is why I guess it's not doing the resume jobs but I've unticked the option "Check Suspend State during Resume" and the fact it shows System PowerEvent: ResumeAutomatic and System PowerEvent: ResumeSuspend makes it hard to see why it think the PC was not suspended.

The resume jobs are in Program Data\MPStandbyHandler\Jobs and are

RESUME_000_TVServiceStop.xml


Code:
<?xml version="1.0" encoding="utf-8"?>
<!--Jobfile RESUME_000_TVServiceStop.xml-->
<JobProperties>
  <Order TypeCode="9" ReadOnly="False">0</Order>
  <Usage TypeCode="9" ReadOnly="False">100</Usage>
  <RebootAllowed TypeCode="3" ReadOnly="False">False</RebootAllowed>
  <Delay TypeCode="9" ReadOnly="False">0</Delay>
  <Timeout TypeCode="9" ReadOnly="False">20</Timeout>
  <KillImmediately TypeCode="3" ReadOnly="False">True</KillImmediately>
 </JobProperties>

and

RESUME_001_TVServiceStart.xml

Code:
<?xml version="1.0" encoding="utf-8"?>
<!--Jobfile RESUME_001_TVServiceStart.xml-->
<JobProperties>
  <Order TypeCode="9" ReadOnly="False">1</Order>
  <Usage TypeCode="9" ReadOnly="False">100</Usage>
  <RebootAllowed TypeCode="3" ReadOnly="False">False</RebootAllowed>
  <Delay TypeCode="9" ReadOnly="False">5</Delay>
  <Timeout TypeCode="9" ReadOnly="False">20</Timeout>
</JobProperties>
 

doveman

Portal Pro
February 12, 2008
2,326
178
Home Country
United Kingdom United Kingdom
I've found the following in the event log as well, which doesn't look good:

Code:
Failed in handling the PowerEvent. The error that occurred was: System.NullReferenceException: Object reference not set to an instance of an object.
  at MPstandbyHandlerUtils.Flags.CreateElement(String key, String value)
  at MPstandbyHandlerUtils.JobTVServiceStart.PreparationsOnSuspend()
  at MPstandbyHandlerService.MpshService.Suspend()
  at MPstandbyHandlerService.MpshService.OnPowerEvent(PowerBroadcastStatus powerStatus)
  at System.ServiceProcess.ServiceBase.DeferredPowerEvent(Int32 eventType, IntPtr eventData).
 

Jay_UK

Test Group
  • Team MediaPortal
  • October 6, 2009
    1,781
    283
    Derby
    Home Country
    United Kingdom United Kingdom
    Hi there,

    You can achieve the same effect with using Task Scheduler and specific triggers/events.

    The only thing to watch out for, is how quick these things detect/process the power state changes.

    J.
     

    doveman

    Portal Pro
    February 12, 2008
    2,326
    178
    Home Country
    United Kingdom United Kingdom
    Hi there,

    You can achieve the same effect with using Task Scheduler and specific triggers/events.

    The only thing to watch out for, is how quick these things detect/process the power state changes.

    J.


    Someone (might have been you) tod me that before but I couldn't get it to work and they couldn't help me so I gave up on that idea.
     

    doveman

    Portal Pro
    February 12, 2008
    2,326
    178
    Home Country
    United Kingdom United Kingdom
    I got this linke from RicoHTPC http://win7suspendresume.codeplex.com/
    It can perform tasks on wakeup from hibernation.
    Maby it can help you?


    Damn, even that doesn't work :(

    It doesn't allow me to set a Stop then Start TVService, only Restart and that doesn't work. What happens is that TVService is left in Stopping state and TV Server config crashes and can't be re-opened as it says TVService isn't running and needs to be started but it fails to start it as it's stuck in Stopping state. So I have to manually kill TVService with Task Manager before I can restart it.

    Power Triggers window shows "Error when attempting Restart on TVService. Error=Time out has expired and operation has not been completed"

    Hmm, maybe I can get it run a batch file on resume to stop then start TVService under it's Processes tab instead of using it's Services tab. I'll give that a go.
     

    mm1352000

    Retired Team Member
  • Premium Supporter
  • September 1, 2008
    21,577
    8,224
    Home Country
    New Zealand New Zealand
    What happens is that TVService is left in Stopping state...
    It sounds like everything you're trying to do is only a workaround for this, so have you thought about attempting to figure out why this occurs?
     

    doveman

    Portal Pro
    February 12, 2008
    2,326
    178
    Home Country
    United Kingdom United Kingdom
    It sounds like everything you're trying to do is only a workaround for this, so have you thought about attempting to figure out why this occurs?

    It only happens with this Win7 Suspend/Resume Control program, so I can only assume it's procedure for restarting the service is buggy.
     

    Jay_UK

    Test Group
  • Team MediaPortal
  • October 6, 2009
    1,781
    283
    Derby
    Home Country
    United Kingdom United Kingdom
    Hi there,

    I think mm1352000000000000000000 is on about identifying the underlying issue why you have to restart the service??

    You will need to create two tasks - one to handle the standby, one to handle the resume

    The only special thing about the task is the trigger.

    For entering standby set the trigger to:
    Basic Log: System
    Source: Kernel-Power
    Event ID: 42

    When resuming set the Task Scheduler trigger to:
    Basic Log: System
    Source: Power-Troubleshooter
    Event ID: 1

    Many thanks,

    J.
     

    Users who are viewing this thread

    Top Bottom