int mask=0;
for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
if (i->m_inuse)
- mask |= ( 1 << i->m_frontend->getID() );
+ mask |= ( 1 << i->m_frontend->getSlotID() );
/* emit */ frontendUseMaskChanged(mask);
}
}
}
+void eDVBResourceManager::setFrontendSlotInformations(ePyObject list)
+{
+ if (!PyList_Check(list))
+ {
+ PyErr_SetString(PyExc_StandardError, "eDVBResourceManager::setFrontendSlotInformations argument should be a python list");
+ return;
+ }
+ if (PyList_Size(list) != 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));
+ PyErr_SetString(PyExc_StandardError, blasel);
+ return;
+ }
+ int pos=0;
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
+ {
+ ePyObject obj = PyList_GET_ITEM(list, pos++);
+ i->m_frontend->setSlotInfo(obj);
+ }
+}
+
RESULT eDVBResourceManager::allocateFrontend(ePtr<eDVBAllocatedFrontend> &fe, ePtr<iDVBFrontendParameters> &feparm)
{
ePtr<eDVBRegisteredFrontend> best;
return -1;
}
-RESULT eDVBResourceManager::allocateFrontendByIndex(ePtr<eDVBAllocatedFrontend> &fe, int nr)
+RESULT eDVBResourceManager::allocateFrontendByIndex(ePtr<eDVBAllocatedFrontend> &fe, int slot_index)
{
- for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i, --nr)
- if ((!nr) && !i->m_inuse)
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
+ if (!i->m_inuse && i->m_frontend->getSlotID() == slot_index)
{
fe = new eDVBAllocatedFrontend(i);
return 0;
demux = new eDVBAllocatedDemux(i);
if (fe)
- demux->get().setSourceFrontend(fe->m_frontend->getID());
+ demux->get().setSourceFrontend(fe->m_frontend->getDVBID());
else
demux->get().setSourcePVR(0);
return 0;
m_cached_channel=0;
}
-RESULT eDVBResourceManager::allocateRawChannel(eUsePtr<iDVBChannel> &channel, int frontend_index)
+RESULT eDVBResourceManager::allocateRawChannel(eUsePtr<iDVBChannel> &channel, int slot_index)
{
ePtr<eDVBAllocatedFrontend> fe;
m_releaseCachedChannelTimer.stop();
}
- if (allocateFrontendByIndex(fe, frontend_index))
+ if (allocateFrontendByIndex(fe, slot_index))
return errNoFrontend;
eDVBChannel *ch;
DEFINE_REF(eDVBFrontend);
eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok)
- :m_type(-1), m_fe(fe), m_fd(-1), m_sn(0), m_timeout(0), m_tuneTimer(0)
+ :m_type(-1), m_dvbid(fe), m_slotid(fe), m_need_rotor_workaround(false)
+ ,m_fd(-1), m_sn(0), m_timeout(0), m_tuneTimer(0)
#if HAVE_DVB_API_VERSION < 3
,m_secfd(-1)
#endif
}
}
else
- eWarning("sec %d already opened", m_fe);
+ eWarning("sec %d already opened", m_dvbid);
FrontendInfo fe_info;
#else
dvb_frontend_info fe_info;
#endif
- eDebug("opening frontend %d", m_fe);
+ eDebug("opening frontend %d", m_dvbid);
if (m_fd < 0)
{
m_fd = ::open(m_filename, O_RDWR|O_NONBLOCK);
}
}
else
- eWarning("frontend %d already opened", m_fe);
+ eWarning("frontend %d already opened", m_dvbid);
if (m_type == -1)
{
if (::ioctl(m_fd, FE_GET_INFO, &fe_info) < 0)
{
if (linked_fe->m_inuse)
{
- eDebug("dont close frontend %d until the linked frontend %d is still in use",
- m_fe, linked_fe->m_frontend->getID());
+ eDebug("dont close frontend %d until the linked frontend %d in slot %d is still in use",
+ m_dvbid, linked_fe->m_frontend->getDVBID(), linked_fe->m_frontend->getSlotID());
return -1;
}
linked_fe->m_frontend->getData(LINKED_NEXT_PTR, (int&)linked_fe);
}
if (m_fd >= 0)
{
- eDebug("close frontend %d", m_fe);
+ eDebug("close frontend %d", m_dvbid);
m_tuneTimer->stop();
setTone(iDVBFrontend::toneOff);
setVoltage(iDVBFrontend::voltageOff);
if (!::close(m_fd))
m_fd=-1;
else
- eWarning("couldnt close frontend %d", m_fe);
+ eWarning("couldnt close frontend %d", m_dvbid);
m_data[CSW] = m_data[UCSW] = m_data[TONEBURST] = -1;
}
#if HAVE_DVB_API_VERSION < 3
if (!::close(m_secfd))
m_secfd=-1;
else
- eWarning("couldnt close sec %d", m_fe);
+ eWarning("couldnt close sec %d", m_dvbid);
}
#endif
delete m_sn;
#if HAVE_DVB_API_VERSION < 3
if (event.type == FE_COMPLETION_EV)
#else
- eDebug("(%d)fe event: status %x, inversion %s", m_fe, event.status, (event.parameters.inversion == INVERSION_ON) ? "on" : "off");
+ eDebug("(%d)fe event: status %x, inversion %s", m_dvbid, event.status, (event.parameters.inversion == INVERSION_ON) ? "on" : "off");
if (event.status & FE_HAS_LOCK)
#endif
{
return !!(status&FE_HAS_SYNC);
}
case frontendNumber:
- return m_fe;
+ return m_slotid;
}
return 0;
}
if (dest && PyDict_Check(dest))
{
const char *tmp=0;
- PutToDict(dest, "tuner_number", m_fe);
+ PutToDict(dest, "tuner_number", m_dvbid);
switch(m_type)
{
case feSatellite:
#endif
int eDVBFrontend::readInputpower()
{
- int power=m_fe; // this is needed for read inputpower from the correct tuner !
+ int power=m_slotid; // this is needed for read inputpower from the correct tuner !
// open front prozessor
int fp=::open("/dev/dbox/fp0", O_RDWR);
break;
case eSecCommand::SET_POWER_LIMITING_MODE:
{
- int fd = m_fe ?
- ::open("/dev/i2c/1", O_RDWR) :
- ::open("/dev/i2c/0", O_RDWR);
+ if (!m_need_rotor_workaround)
+ break;
+
+ char dev[16];
+
+ // FIXMEEEEEE hardcoded i2c devices for dm7025 and dm8000
+ if (m_slotid < 2)
+ sprintf(dev, "/dev/i2c/%d", m_slotid);
+ else if (m_slotid == 2)
+ sprintf(dev, "/dev/i2c/2"); // first nim socket on DM8000 use /dev/i2c/2
+ else if (m_slotid == 3)
+ sprintf(dev, "/dev/i2c/4"); // second nim socket on DM8000 use /dev/i2c/4
+ int fd = ::open(dev, O_RDWR);
unsigned char data[2];
::ioctl(fd, I2C_SLAVE_FORCE, 0x10 >> 1);
void eDVBFrontend::setFrontend()
{
- eDebug("setting frontend %d", m_fe);
+ eDebug("setting frontend %d", m_dvbid);
m_sn->start();
feEvent(-1);
if (ioctl(m_fd, FE_SET_FRONTEND, &parm) == -1)
eWarning("no SEC module active!");
return -ENOENT;
}
- res = m_sec->prepare(*this, parm, feparm, 1 << m_fe);
+ res = m_sec->prepare(*this, parm, feparm, 1 << m_slotid);
if (!res)
{
eDebug("prepare_sat System %d Freq %d Pol %d SR %d INV %d FEC %d orbpos %d",
RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
{
- eDebug("(%d)tune", m_fe);
+ eDebug("(%d)tune", m_dvbid);
m_timeout->stop();
std::string enable_5V;
char configStr[255];
- snprintf(configStr, 255, "config.Nims.%d.terrestrial_5V", m_fe);
+ snprintf(configStr, 255, "config.Nims.%d.terrestrial_5V", m_slotid);
m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) );
ePythonConfigQuery::getConfigValue(configStr, enable_5V);
if (enable_5V == "True")
eDVBFrontendParametersSatellite sat_parm;
int ret = feparm->getDVBS(sat_parm);
ASSERT(!ret);
- return m_sec->canTune(sat_parm, this, 1 << m_fe);
+ return m_sec->canTune(sat_parm, this, 1 << m_slotid);
}
else if (m_type == eDVBFrontend::feCable)
return 2; // more prio for cable frontends
return 1;
}
+
+void eDVBFrontend::setSlotInfo(ePyObject obj)
+{
+ ePyObject Id, Descr;
+ if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 2)
+ goto arg_error;
+ Id = PyTuple_GET_ITEM(obj, 0);
+ Descr = PyTuple_GET_ITEM(obj, 1);
+ if (!PyInt_Check(Id) || !PyString_Check(Descr))
+ goto arg_error;
+ strcpy(m_description, PyString_AS_STRING(Descr));
+ m_slotid = PyInt_AsLong(Id);
+
+ // 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");
+ return;
+arg_error:
+ PyErr_SetString(PyExc_StandardError,
+ "eDVBFrontend::setSlotInfo must get a tuple with first param slotid and second param slot description");
+}