From patchwork Sun Jul 30 10:50:25 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Schmidinger X-Patchwork-Id: 12368 Received: from raven.cadsoft.de ([217.7.101.211]) by www.linuxtv.org with esmtp (Exim 4.50) id 1G78sO-0006x0-Ly for vdr@linuxtv.org; Sun, 30 Jul 2006 12:50:28 +0200 Received: from [192.168.100.10] (hawk.cadsoft.de [192.168.100.10]) by raven.cadsoft.de (8.13.3/8.13.3) with ESMTP id k6UAoQP4002549 for ; Sun, 30 Jul 2006 12:50:27 +0200 Message-ID: <44CC8EF1.60108@cadsoft.de> Date: Sun, 30 Jul 2006 12:50:25 +0200 From: Klaus Schmidinger Organization: CadSoft Computer GmbH User-Agent: Thunderbird 1.5.0.4 (X11/20060516) MIME-Version: 1.0 To: vdr@linuxtv.org Subject: Re: [vdr] [vdr bug]Shutdown during an active timer is broken References: <20060725082546.DF6A0115951@dd3532.kasserver.com> <44C60C0C.5010801@gmx.de> <44C631EF.4010204@gmx.de> <44CB7D95.4080205@cadsoft.de> <44CBADEE.6000501@gmx.de> <44CC762F.7010305@cadsoft.de> In-Reply-To: <44CC762F.7010305@cadsoft.de> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (raven.cadsoft.de [192.168.1.1]); Sun, 30 Jul 2006 12:50:27 +0200 (CEST) X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 Jul 2006 10:50:28 -0000 Status: O X-Status: X-Keywords: X-UID: 10257 Klaus Schmidinger wrote: > Udo Richter wrote: >> Klaus Schmidinger wrote: >>> As a safety precaution, in case the user turned off VDR and ignored >>> all the warnings, let's just tell the shutdown script to reboot it >>> at, say, five minutes in the future (in case a recording is going on) >>> or whenever the next timer hits after that time. >> >> I'm not sure whether I like the idea that VDR starts again after 5 >> minutes, probably just in that moment when I am plugging a PCI card or >> something like that. (Yes, you're *supposed* to pull the plug first. >> You really do? ;) ) >> >> Anyway, 5 mins is too short, anything less that 10 mins will be denied >> by nvram-wakeup default configuration. > > Well, then let's use Setup.MinEventTimeout. After all, the user has > confirmed that any onging recording as well as any timer starting > withing Setup.MinEventTimeout doesn't matter. > >>> If the user doesn't want this to happen, then he/she can simply go >>> into the Timers menu and turn timers off as desired. >> >> I don't have a problem with disabling the offending timers manually. I >> just wrote the patch because of the request. > > Sure, and I'm not critizising that. It just showed to me that if we > go down that road things will become ever more complex, and sure enough > somebody will come up with yet another level of complexity. > >> Its just a bit strange that VDR requires extra confirmation, and then >> nvram-wakeup denies shutdown anyway. (or other shoudown scrips doing >> even more strange things) >> >> On a side note: With some scripting-fu, it should be possible to >> disable the offending timers from the shutdown script via SVDRP, and >> then request the new reboot time also via SVDRP. > > My suggestion would be: as soon as ForceShutdown is set and Delta is > less than Setup.MinEventTimeout, let's just set Delta to > Setup.MinEventTimeout > (and adjust Next accordingly). The worst that can happen is that VDR > restarts > after half an hour (default for MinEventTimeout) and continues to do > whatever it takes. If the user turns it on earlier, all programmed timers > will still be there and even recordings that were interrupted will be > continued. > > Please try the attached patch. I just realized that a Next and Delta of '0' has special meaning to the shutdown script, so here's another version of this patch, taking into account if there is a 'timer' at all. Klaus --- vdr.c 2006/06/18 08:49:20 1.276 +++ vdr.c 2006/07/30 10:47:50 @@ -1166,6 +1166,12 @@ else LastActivity = 1; } + if (timer && Delta < Setup.MinEventTimeout * 60 && ForceShutdown) { + Delta = Setup.MinEventTimeout * 60; + Next = Now + Delta; + timer = NULL; + dsyslog("reboot at %s", *TimeToString(Next)); + } if (!Next || Delta > Setup.MinEventTimeout * 60 || ForceShutdown) { ForceShutdown = false; if (timer)