add "High bitrate support" choice in CI Setup (needs new drivers to work)
[enigma2.git] / lib / dvb_ci / dvbci.cpp
index a0166355b7c8391307ef5a04ba580e51ebe7d366..ce1f7d660e8d2d0a446ffb4dffcf5493c55b4c9a 100644 (file)
@@ -897,14 +897,14 @@ RESULT eDVBCIInterfaces::setDescrambleRules(int slotid, SWIG_PYOBJECT(ePyObject)
        {
                --size;
                ePyObject caid = PyList_GET_ITEM(caid_list, size);
-               if (!PyInt_Check(caid))
+               if (!PyLong_Check(caid))
                {
                        char buf[255];
                        snprintf(buf, 255, "eDVBCIInterfaces::setDescrambleRules entry in caid list is not a long it is '%s'!!", PyObject_TypeStr(caid));
                        PyErr_SetString(PyExc_StandardError, buf);
                        return -1;
                }
-               int tmpcaid = PyInt_AsLong(caid);
+               int tmpcaid = PyLong_AsLong(caid);
                if (tmpcaid > 0 && tmpcaid < 0x10000)
                        slot->possible_caids.insert(tmpcaid);
                else
@@ -926,15 +926,26 @@ PyObject *eDVBCIInterfaces::readCICaIds(int slotid)
        {
                int idx=0;
                eDVBCICAManagerSession *ca_manager = slot->getCAManager();
-               const std::vector<uint16_t> &ci_caids = ca_manager->getCAIDs();
-               ePyObject list = PyList_New(ci_caids.size());
-               for (std::vector<uint16_t>::const_iterator it = ci_caids.begin(); it != ci_caids.end(); ++it)
-                       PyList_SET_ITEM(list, idx++, PyLong_FromLong(*it));
+               const std::vector<uint16_t> *ci_caids = ca_manager ? &ca_manager->getCAIDs() : 0;
+               ePyObject list = PyList_New(ci_caids ? ci_caids->size() : 0);
+               if (ci_caids)
+               {
+                       for (std::vector<uint16_t>::const_iterator it = ci_caids->begin(); it != ci_caids->end(); ++it)
+                               PyList_SET_ITEM(list, idx++, PyLong_FromLong(*it));
+               }
                return list;
        }
        return 0;
 }
 
+int eDVBCIInterfaces::setCIClockRate(int slotid, int rate)
+{
+       eDVBCISlot *slot = getSlot(slotid);
+       if (slot)
+               return slot->setClockRate(rate);
+       return -1;
+}
+
 int eDVBCISlot::send(const unsigned char *data, size_t len)
 {
        int res=0;
@@ -1320,4 +1331,21 @@ int eDVBCISlot::setSource(data_source source)
        return 0;
 }
 
+int eDVBCISlot::setClockRate(int rate)
+{
+       char buf[64];
+       snprintf(buf, 64, "/proc/stb/tsmux/ci%d_tsclk", slotid);
+       FILE *ci = fopen(buf, "wb");
+       if (ci)
+       {
+               if (rate)
+                       fprintf(ci, "high");
+               else
+                       fprintf(ci, "normal");
+               fclose(ci);
+               return 0;
+       }
+       return -1;
+}
+
 eAutoInitP0<eDVBCIInterfaces> init_eDVBCIInterfaces(eAutoInitNumbers::dvb, "CI Slots");