[mythtv] [PATCH] mythbackend: AUTO, USER, and startup scripts

Max Barry mythtv at maxbarry.com
Thu May 12 05:35:12 UTC 2005


Hello all,

I have a minor patch for programs/mythbackend/scheduler.cpp.

Current behavior:
-----------------
1. (Annoying:) Unless "Block shutdown until client connects" is enabled,
the BE always sends startupCommand scripts the argument "user",
regardless of whether it actually performed a USER or AUTO startup.

2. (Cosmetic:) The BE only logs whether it performed a USER or AUTO
startup if "Block shutdown until client connects" is enabled.

3. (Intended:) The BE will ignore the "Block shutdown until client
connects" setting if it performed an AUTO startup. That is, after an
AUTO startup, it will always allow itself to shut down once it becomes idle.

After patch:
------------
1. The BE always sends startupCommand scripts the correct argument
("user" or "auto").

2. The BE always writes into the logs (at VERBOSE_ALL level) whether it
has undergone a USER or AUTO start.

3. Unchanged.

Frankly, I don't understand #3, but I assume it's for reasons I can't
fathom. :)

I have corrected the comments around it, though, because they currently
say the code "blocks the shutdown" in USER mode, when in fact the code
*allows* the shutdown in AUTO mode. That is, the purpose of the code is
to override if necessary the user's setting in AUTO mode; it doesn't
"block" anything in USER mode.

My first submission to MythTV... hope it helps. :)

Max.

-------------- next part --------------
--- scheduler-cvs-orig.cpp	2005-05-12 14:43:47.000000000 +1000
+++ scheduler-cvs.cpp	2005-05-12 14:55:22.000000000 +1000
@@ -959,25 +959,22 @@
                 // started the BE, 'auto' means it was started automatically
                 QString startupParam = "user";
                 
-                // check once on startup, if a recording starts within the
-                // idleWaitForRecordingTime. If no, block the shutdown,
-                // because system seems to be waken up by the user and not by a
-                // wakeup call
-                if (blockShutdown)
-                {
-                    // have we been started automatically?
-                    if (startIter != reclist.end() &&
-                        curtime.secsTo((*startIter)->startts) - prerollseconds
-                        < idleWaitForRecordingTime * 60)
-                    {
-                        VERBOSE(VB_ALL,
-                                "Recording starts soon, AUTO-Startup assumed");
-                        blockShutdown = false;
-                        startupParam = "auto";
-                    }
-                    else
-                        VERBOSE(VB_ALL, "Seem to be woken up by USER");
-                }
+		// have we been started automatically?
+		if (startIter != reclist.end() &&
+		    curtime.secsTo((*startIter)->startts) - prerollseconds
+		    < idleWaitForRecordingTime * 60)
+		{
+		    VERBOSE(VB_ALL,
+		            "Recording starts soon, AUTO-Startup assumed");
+		    startupParam = "auto";
+		    
+		    // Since we've started automatically, don't wait for
+		    // client to connect before allowing shutdown.
+		    blockShutdown = false;
+		}
+		else
+		    VERBOSE(VB_ALL, "Seem to be woken up by USER");
+		
                 QString startupCommand = gContext->GetSetting("startupCommand",
                                                               "");
                 if (!startupCommand.isEmpty())


More information about the mythtv-dev mailing list