fix slotinfo assignment for new "unsupported tuner" handling
authorghost <andreas.monzner@multimedia-labs.de>
Sun, 10 Oct 2010 22:03:40 +0000 (00:03 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Sun, 10 Oct 2010 22:04:12 +0000 (00:04 +0200)
refs bug #587

lib/dvb/dvb.cpp
lib/dvb/frontend.cpp
lib/python/Components/NimManager.py

index 40d4418..5162945 100644 (file)
@@ -320,27 +320,34 @@ PyObject *eDVBResourceManager::setFrontendSlotInformations(ePyObject list)
                PyErr_SetString(PyExc_StandardError, "eDVBResourceManager::setFrontendSlotInformations argument should be a python list");
                return NULL;
        }
-       if ((unsigned int)PyList_Size(list) != m_frontend.size())
+       unsigned int assigned=0;
+       for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
        {
+               int pos=0;
+               while (pos < PyList_Size(list)) {
+                       ePyObject obj = PyList_GET_ITEM(list, pos++);
+                       if (!i->m_frontend->setSlotInfo(obj))
+                               continue;
+                       ++assigned;
+                       break;
+               }
+       }
+       if (assigned != m_frontend.size()) {
                char blasel[256];
-               sprintf(blasel, "eDVBResourceManager::setFrontendSlotInformations list size incorrect %d frontends avail, but %d entries in slotlist",
-                       m_frontend.size(), PyList_Size(list));
+               sprintf(blasel, "eDVBResourceManager::setFrontendSlotInformations .. assigned %d socket informations, but %d registered frontends!",
+                       m_frontend.size(), assigned);
                PyErr_SetString(PyExc_StandardError, blasel);
                return NULL;
        }
-       int pos=0;
-       for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
-       {
-               ePyObject obj = PyList_GET_ITEM(list, pos++);
-               if (!i->m_frontend->setSlotInfo(obj))
-                       return NULL;
-       }
-       pos=0;
        for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_simulate_frontend.begin()); i != m_simulate_frontend.end(); ++i)
        {
-               ePyObject obj = PyList_GET_ITEM(list, pos++);
-               if (!i->m_frontend->setSlotInfo(obj))
-                       return NULL;
+               int pos=0;
+               while (pos < PyList_Size(list)) {
+                       ePyObject obj = PyList_GET_ITEM(list, pos++);
+                       if (!i->m_frontend->setSlotInfo(obj))
+                               continue;
+                       break;
+               }
        }
        Py_RETURN_NONE;
 }
index abbb8d2..6f78197 100644 (file)
@@ -2700,17 +2700,23 @@ int eDVBFrontend::isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm)
 
 bool eDVBFrontend::setSlotInfo(ePyObject obj)
 {
-       ePyObject Id, Descr, Enabled, IsDVBS2;
-       if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 4)
+       ePyObject Id, Descr, Enabled, IsDVBS2, frontendId;
+       if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 5)
                goto arg_error;
        Id = PyTuple_GET_ITEM(obj, 0);
        Descr = PyTuple_GET_ITEM(obj, 1);
        Enabled = PyTuple_GET_ITEM(obj, 2);
        IsDVBS2 = PyTuple_GET_ITEM(obj, 3);
-       if (!PyInt_Check(Id) || !PyString_Check(Descr) || !PyBool_Check(Enabled) || !PyBool_Check(IsDVBS2))
+       frontendId = PyTuple_GET_ITEM(obj, 4);
+       m_slotid = PyInt_AsLong(Id);
+       if (!PyInt_Check(Id) || !PyString_Check(Descr) || !PyBool_Check(Enabled) || !PyBool_Check(IsDVBS2) || !PyInt_Check(frontendId))
                goto arg_error;
        strcpy(m_description, PyString_AS_STRING(Descr));
-       m_slotid = PyInt_AsLong(Id);
+       if (PyInt_AsLong(frontendId) == -1 || PyInt_AsLong(frontendId) != m_dvbid) {
+//             eDebugNoSimulate("skip slotinfo for slotid %d, descr %s",
+//                     m_slotid, m_description);
+               return false;
+       }
        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") ||
index 4d562b9..7f04190 100644 (file)
@@ -150,7 +150,7 @@ class SecConfigure:
 
                for slot in nim_slots:
                        if slot.type is not None:
-                               used_nim_slots.append((slot.slot, slot.description, slot.config.configMode.value != "nothing" and True or False, slot.isCompatible("DVB-S2")))
+                               used_nim_slots.append((slot.slot, slot.description, slot.config.configMode.value != "nothing" and True or False, slot.isCompatible("DVB-S2"), slot.frontend_id is None and -1 or slot.frontend_id))
                eDVBResourceManager.getInstance().setFrontendSlotInformations(used_nim_slots)
 
                for slot in nim_slots: