#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
+#include <fstream>
DEFINE_REF(eDVBRegisteredFrontend);
DEFINE_REF(eDVBRegisteredDemux);
num_adapter++;
}
+ setUsbTuner();
+
int fd = open("/proc/stb/info/model", O_RDONLY);
char tmp[255];
int rd = fd >= 0 ? read(fd, tmp, 255) : 0;
}
+void eDVBResourceManager::setUsbTuner()
+{
+ std::ifstream in("/proc/bus/nim_sockets");
+ std::string line;
+
+ int res = -1;
+ int fe_idx = -1;
+ int usbtuner_idx[8] = {0};
+ int usbtuner_count = 0;
+
+ if (in.is_open())
+ {
+ while(!in.eof())
+ {
+ getline(in, line);
+ if ((res = sscanf(line.c_str(), "NIM Socket %d:", &fe_idx)) == 1)
+ continue;
+
+ if ((fe_idx != -1) && (line.find("\tName: ") == 0) && (line.find("VTUNER") != -1))
+ usbtuner_idx[usbtuner_count++] = fe_idx;
+ }
+ in.close();
+ }
+
+ if (usbtuner_count)
+ {
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_frontend.begin()); it != m_frontend.end(); ++it)
+ {
+ int slotid = it->m_frontend->getSlotID();
+ for (int i=0; i < usbtuner_count ; i++)
+ {
+ if (slotid == usbtuner_idx[i])
+ {
+ it->m_frontend->setUSBTuner(true);
+ break;
+ }
+ }
+ }
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator it(m_simulate_frontend.begin()); it != m_simulate_frontend.end(); ++it)
+ {
+ int slotid = it->m_frontend->getSlotID();
+ for (int i=0; i < usbtuner_count ; i++)
+ {
+ if (slotid == usbtuner_idx[i])
+ {
+ it->m_frontend->setUSBTuner(true);
+ break;
+ }
+ }
+ }
+ }
+}
+
PyObject *eDVBResourceManager::setFrontendSlotInformations(ePyObject list)
{
if (!PyList_Check(list))