From 5e037c72eaaca8aaaad9591e31569208b8d36381 Mon Sep 17 00:00:00 2001 From: ghost Date: Mon, 1 Mar 2010 19:37:57 +0100 Subject: [PATCH] fix no more turning positioner after leave positioner setup in some cases this fixes bug #321 --- lib/dvb/frontend.cpp | 19 +++++++++++++++++-- lib/dvb/frontend.h | 1 + lib/dvb/sec.cpp | 5 +++++ lib/python/Components/TuneTest.py | 5 +++-- .../SystemPlugins/PositionerSetup/plugin.py | 2 +- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index c0263fb4..f85a37fe 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -455,7 +455,7 @@ int eDVBFrontend::PriorityOrder=0; eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok, bool simulate) :m_simulate(simulate), m_enabled(false), m_type(-1), m_dvbid(fe), m_slotid(fe) - ,m_fd(-1), m_need_rotor_workaround(false), m_can_handle_dvbs2(false) + ,m_fd(-1), m_rotor_mode(false), m_need_rotor_workaround(false), m_can_handle_dvbs2(false) ,m_state(stateClosed), m_timeout(0), m_tuneTimer(0) #if HAVE_DVB_API_VERSION < 3 ,m_secfd(-1) @@ -692,7 +692,8 @@ void eDVBFrontend::feEvent(int w) { eDebug("stateLostLock"); state = stateLostLock; - sec_fe->m_data[CSW] = sec_fe->m_data[UCSW] = sec_fe->m_data[TONEBURST] = -1; // reset diseqc + if (!m_rotor_mode) + sec_fe->m_data[CSW] = sec_fe->m_data[UCSW] = sec_fe->m_data[TONEBURST] = -1; // reset diseqc } } if (m_state != state) @@ -2343,6 +2344,20 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) res = -EINVAL; goto tune_error; } + if (m_rotor_mode != feparm.no_rotor_command_on_tune && !feparm.no_rotor_command_on_tune) + { + eDVBFrontend *sec_fe = this; + long tmp = m_data[LINKED_PREV_PTR]; + while (tmp != -1) + { + eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*)tmp; + sec_fe = linked_fe->m_frontend; + sec_fe->getData(LINKED_NEXT_PTR, tmp); + } + eDebug("(fe%d) reset diseqc after leave rotor mode!", m_dvbid); + sec_fe->m_data[CSW] = sec_fe->m_data[UCSW] = sec_fe->m_data[TONEBURST] = sec_fe->m_data[ROTOR_CMD] = sec_fe->m_data[ROTOR_POS] = -1; // reset diseqc + } + m_rotor_mode = feparm.no_rotor_command_on_tune; if (!m_simulate) m_sec->setRotorMoving(m_slotid, false); res=prepare_sat(feparm, timeout); diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index bac27539..4cf05081 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -75,6 +75,7 @@ private: int m_dvbid; int m_slotid; int m_fd; + bool m_rotor_mode; bool m_need_rotor_workaround; bool m_can_handle_dvbs2; char m_filename[128]; diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index 91246889..44cbe709 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -156,6 +156,11 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite ret = 15000; } + if (sat.no_rotor_command_on_tune && !rotor) { + eSecDebugNoSimulate("no rotor but no_rotor_command_on_tune is set.. ignore lnb %d", idx); + continue; + } + eSecDebugNoSimulate("ret1 %d", ret); if (linked_in_use) diff --git a/lib/python/Components/TuneTest.py b/lib/python/Components/TuneTest.py index f9ab3edb..44b19091 100644 --- a/lib/python/Components/TuneTest.py +++ b/lib/python/Components/TuneTest.py @@ -1,8 +1,9 @@ from enigma import eDVBFrontendParametersSatellite, eDVBFrontendParameters, eDVBResourceManager, eTimer class Tuner: - def __init__(self, frontend): + def __init__(self, frontend, ignore_rotor=False): self.frontend = frontend + self.ignore_rotor = ignore_rotor # transponder = (frequency, symbolrate, polarisation, fec, inversion, orbpos, system, modulation, rolloff, pilot, tsid, onid) # 0 1 2 3 4 5 6 7 8 9 10 11 @@ -21,7 +22,7 @@ class Tuner: parm.rolloff = transponder[8] parm.pilot = transponder[9] feparm = eDVBFrontendParameters() - feparm.setDVBS(parm) + feparm.setDVBS(parm, self.ignore_rotor) self.lastparm = feparm self.frontend.tune(feparm) diff --git a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py index fa533c0b..3cc9e751 100644 --- a/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py +++ b/lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py @@ -77,7 +77,7 @@ class PositionerSetup(Screen): self.frontendStatus = { } self.diseqc = Diseqc(self.frontend) - self.tuner = Tuner(self.frontend) + self.tuner = Tuner(self.frontend, True) #True means we dont like that the normal sec stuff sends commands to the rotor! tp = ( cur.get("frequency", 0) / 1000, cur.get("symbol_rate", 0) / 1000, -- 2.30.2