[vdr] [PATCH] obey Power key while replaying a recording

Klaus Schmidinger Klaus.Schmidinger at cadsoft.de
Sat Aug 6 12:43:53 CEST 2005


Marko Mäkelä wrote:
> Hi all,
> 
> Klaus responded to my private message about the Power
> key being ignored while playing back a recording.
> He suggested to add a cControl::Shutdown() call to
> the kPower handler.  I did that, and the attached
> patch (against vdr-1.3.27) works for me.
> 
> I'm not sure if it is necessary to move the
> assignments before the cControl::Shutdown() call,
> but I thought it would be safer that way.
> 
> 	Marko
> 
> 
> ------------------------------------------------------------------------
> 
> --- vdr.c	2005-06-18 14:19:07.000000000 +0300
> +++ vdr.c.mod	2005-07-31 22:27:38.000000000 +0300
> @@ -738,12 +738,15 @@
>                            Skins.Message(mtError, tr("Can't shutdown - option '-s' not given!"));
>                            break;
>                            }
> +                       LastActivity = 1; // not 0, see below!
> +                       UserShutdown = true;
>                         if (cRecordControls::Active()) {
>                            if (Interface->Confirm(tr("Recording - shut down anyway?")))
>                               ForceShutdown = true;
> +                             cControl::Shutdown();
>                            }
> -                       LastActivity = 1; // not 0, see below!
> -                       UserShutdown = true;
> +                       else
> +                          cControl::Shutdown();
>                         break;
>            default: break;
>            }

The way you have done this there will _always_ be a cControl::Shutdown().
Could it be that you wanted was to have _no_ cControl::Shutdown() in case
there is a recording going on, but the user didn't confirm the
"Recording - shut down anyway?" prompt? In that case you should have added
braces around the 'if' block, as in

     if (Interface->Confirm(tr("Recording - shut down anyway?"))) {
        ForceShutdown = true;
        cControl::Shutdown();
        }

Please try it that way and let me know.

I don't think that moving the assignments is necessary.

Klaus



More information about the vdr mailing list