From 1f528cf7e16479d88ebff1699d5fe4ab4e9ddaf0 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Sat, 22 Nov 2014 21:32:55 +0200 Subject: [PATCH] Fixed tuner shutdown. --- tuner.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tuner.c b/tuner.c index 8cd8164..81a586c 100644 --- a/tuner.c +++ b/tuner.c @@ -450,11 +450,23 @@ bool cSatipTuner::StateRequested(void) bool cSatipTuner::RequestState(eTunerState stateP) { cMutexLock MutexLock(&mutexM); - debug("cSatipTuner::%s(%s) [device %d]", __FUNCTION__, TunerStateString(stateP), deviceIdM); + debug("cSatipTuner::%s(%s) %s <> %s [device %d]", __FUNCTION__, TunerStateString(stateP), TunerStateString(currentStateM), TunerStateString(nextStateM), deviceIdM); + + // validate legal state changes + switch (currentStateM) { + case tsIdle: + if (stateP == tsRelease) + return false; + case tsRelease: + case tsSet: + case tsLocked: + case tsTuned: + default: + break; + } nextStateM = stateP; - // validate legal state changes return true; }