take care for disabled -C -T frontends
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sun, 15 Jul 2007 22:24:28 +0000 (22:24 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Sun, 15 Jul 2007 22:24:28 +0000 (22:24 +0000)
lib/dvb/frontend.cpp
lib/dvb/frontend.h
lib/python/Components/NimManager.py

index ae72401..04b794d 100644 (file)
@@ -383,7 +383,7 @@ RESULT eDVBFrontendParameters::getHash(unsigned long &hash) const
 DEFINE_REF(eDVBFrontend);
 
 eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok)
-       :m_type(-1), m_dvbid(fe), m_slotid(fe)
+       :m_enabled(false), m_type(-1), m_dvbid(fe), m_slotid(fe)
        ,m_fd(-1), m_need_rotor_workaround(false), m_sn(0), m_timeout(0), m_tuneTimer(0)
 #if HAVE_DVB_API_VERSION < 3
        ,m_secfd(-1)
@@ -2115,7 +2115,7 @@ RESULT eDVBFrontend::setData(int num, int val)
 int eDVBFrontend::isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm)
 {
        int type;
-       if (feparm->getSystem(type) || type != m_type)
+       if (feparm->getSystem(type) || type != m_type || !m_enabled)
                return 0;
 
        if (m_type == eDVBFrontend::feSatellite)
@@ -2133,21 +2133,23 @@ int eDVBFrontend::isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm)
 
 void eDVBFrontend::setSlotInfo(ePyObject obj)
 {
-       ePyObject Id, Descr;
-       if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 2)
+       ePyObject Id, Descr, Enabled;
+       if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 3)
                goto arg_error;
        Id = PyTuple_GET_ITEM(obj, 0);
        Descr = PyTuple_GET_ITEM(obj, 1);
-       if (!PyInt_Check(Id) || !PyString_Check(Descr))
+       Enabled = PyTuple_GET_ITEM(obj, 2);
+       if (!PyInt_Check(Id) || !PyString_Check(Descr) || !PyBool_Check(Enabled))
                goto arg_error;
        strcpy(m_description, PyString_AS_STRING(Descr));
        m_slotid = PyInt_AsLong(Id);
+       m_enabled = Enabled == Py_True;
 
        // HACK.. the rotor workaround is neede for all NIMs with LNBP21 voltage regulator...
        m_need_rotor_workaround = !!strstr(m_description, "Alps BSBE1") || !!strstr(m_description, "Alps -S");
 
-       eDebug("setSlotInfo for dvb frontend %d to slotid %d, descr %s, need rotorworkaround %s",
-               m_dvbid, m_slotid, m_description, m_need_rotor_workaround ? "Yes" : "No");
+       eDebug("setSlotInfo for dvb frontend %d to slotid %d, descr %s, need rotorworkaround %s, enabled %s",
+               m_dvbid, m_slotid, m_description, m_need_rotor_workaround ? "Yes" : "No", m_enabled ? "Yes" : "No" );
        return;
 arg_error:
        PyErr_SetString(PyExc_StandardError,
index 0bef95d..d2070e9 100644 (file)
@@ -38,6 +38,7 @@ class eSecCommandList;
 class eDVBFrontend: public iDVBFrontend, public Object
 {
        DECLARE_REF(eDVBFrontend);
+       bool m_enabled;
        int m_type;
        int m_dvbid;
        int m_slotid;
index 00f9c18..8d3afae 100644 (file)
@@ -108,6 +108,8 @@ class SecConfigure:
 
                nim_slots = self.NimManager.nim_slots
 
+               used_nim_slots = [ ]
+
                for slot in nim_slots:
                        x = slot.slot
                        nim = slot.config
@@ -123,6 +125,11 @@ class SecConfigure:
                                        self.setSatposDepends(sec, x, int(nim.satposDependsTo.value))
                                        self.satposdepends[int(nim.satposDependsTo.value)]=x
 
+                       if slot.type is not None:
+                               used_nim_slots.append((slot.slot, slot.description, nim.configMode.value != "nothing" and True or False))
+
+               eDVBResourceManager.getInstance().setFrontendSlotInformations(used_nim_slots)
+
                for slot in nim_slots:
                        x = slot.slot
                        nim = slot.config
@@ -976,8 +983,6 @@ def InitNimManager(nimmgr):
                        print "pls add support for this frontend type!"         
 #                      assert False
 
-       eDVBResourceManager.getInstance().setFrontendSlotInformations(used_nim_slots)
-
        nimmgr.sec = SecConfigure(nimmgr)
 
 nimmanager = NimManager()