lib/python/Plugins/Extensions/WebBrowser/meta/Makefile
lib/python/Plugins/Extensions/WebBrowser/keymap/Makefile
lib/python/Plugins/Extensions/WebBrowser/desc/Makefile
-lib/python/Plugins/Extensions/VuplusEvent/Makefile
-lib/python/Plugins/Extensions/VuplusEvent/meta/Makefile
lib/python/Plugins/Extensions/StreamTV/Makefile
lib/python/Plugins/Extensions/StreamTV/meta/Makefile
lib/python/Plugins/Extensions/StreamTV/icons/Makefile
ePtr<eDVBFrontend> frontend;
if (!adapter->getFrontend(frontend, i))
{
- int frontendType=0;
- frontend->getFrontendType(frontendType);
eDVBRegisteredFrontend *new_fe = new eDVBRegisteredFrontend(frontend, adapter);
CONNECT(new_fe->stateChanged, eDVBResourceManager::feStateChanged);
m_frontend.push_back(new_fe);
frontend->setSEC(m_sec);
// we must link all dvb-t frontends ( for active antenna voltage )
- if (frontendType == iDVBFrontend::feTerrestrial)
+ if (frontend->supportsDeliverySystem(SYS_DVBT, false) || frontend->supportsDeliverySystem(SYS_DVBT2, false))
{
if (prev_dvbt_frontend)
{
ePtr<eDVBFrontend> frontend;
if (!adapter->getFrontend(frontend, i, true))
{
- int frontendType=0;
- frontend->getFrontendType(frontendType);
eDVBRegisteredFrontend *new_fe = new eDVBRegisteredFrontend(frontend, adapter);
// CONNECT(new_fe->stateChanged, eDVBResourceManager::feStateChanged);
m_simulate_frontend.push_back(new_fe);
frontend->setSEC(m_sec);
// we must link all dvb-t frontends ( for active antenna voltage )
- if (frontendType == iDVBFrontend::feTerrestrial)
+ if (frontend->supportsDeliverySystem(SYS_DVBT, false) || frontend->supportsDeliverySystem(SYS_DVBT2, false))
{
if (prev_dvbt_frontend)
{
Py_RETURN_NONE;
}
+bool eDVBResourceManager::frontendIsCompatible(int index, const char *type)
+{
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
+ {
+ if (i->m_frontend->getSlotID() == index)
+ {
+ if (!strcmp(type, "DVB-S2"))
+ {
+ return i->m_frontend->supportsDeliverySystem(SYS_DVBS2, false);
+ }
+ else if (!strcmp(type, "DVB-S"))
+ {
+ return i->m_frontend->supportsDeliverySystem(SYS_DVBS, false);
+ }
+ else if (!strcmp(type, "DVB-T2"))
+ {
+ return i->m_frontend->supportsDeliverySystem(SYS_DVBT2, false);
+ }
+ else if (!strcmp(type, "DVB-T"))
+ {
+ return i->m_frontend->supportsDeliverySystem(SYS_DVBT, false);
+ }
+ else if (!strcmp(type, "DVB-C"))
+ {
+#if DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 6
+ return i->m_frontend->supportsDeliverySystem(SYS_DVBC_ANNEX_A, false);
+#else
+ return i->m_frontend->supportsDeliverySystem(SYS_DVBC_ANNEX_AC, false);
+#endif
+ }
+ }
+ }
+ return false;
+}
+
+void eDVBResourceManager::setFrontendType(int index, const char *type)
+{
+ eDebug("[eDVBResourceManager::setFrontendType] index : %d, type : %s", index, type);
+
+ for (eSmartPtrList<eDVBRegisteredFrontend>::iterator i(m_frontend.begin()); i != m_frontend.end(); ++i)
+ {
+ if (i->m_frontend->getSlotID() == index)
+ {
+ std::vector<fe_delivery_system_t> whitelist;
+ if (!strcmp(type, "DVB-S2") || !strcmp(type, "DVB-S"))
+ {
+ whitelist.push_back(SYS_DVBS);
+ whitelist.push_back(SYS_DVBS2);
+ }
+ else if (!strcmp(type, "DVB-T2") || !strcmp(type, "DVB-T"))
+ {
+ whitelist.push_back(SYS_DVBT);
+ whitelist.push_back(SYS_DVBT2);
+ }
+ else if (!strcmp(type, "DVB-C"))
+ {
+#if DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 6
+ whitelist.push_back(SYS_DVBC_ANNEX_A);
+#else
+ whitelist.push_back(SYS_DVBC_ANNEX_AC);
+#endif
+ }
+ i->m_frontend->setDeliverySystemWhitelist(whitelist);
+ break;
+ }
+ }
+}
+
RESULT eDVBResourceManager::allocateFrontend(ePtr<eDVBAllocatedFrontend> &fe, ePtr<iDVBFrontendParameters> &feparm, bool simulate)
{
eSmartPtrList<eDVBRegisteredFrontend> &frontends = simulate ? m_simulate_frontend : m_frontend;
PSignal1<void,int> frontendUseMaskChanged;
SWIG_VOID(RESULT) allocateRawChannel(eUsePtr<iDVBChannel> &SWIG_OUTPUT, int slot_index);
PyObject *setFrontendSlotInformations(SWIG_PYOBJECT(ePyObject) list);
+ bool frontendIsCompatible(int index, const char *type);
+ void setFrontendType(int index, const char *type);
};
SWIG_TEMPLATE_TYPEDEF(ePtr<eDVBResourceManager>, eDVBResourceManager);
SWIG_EXTEND(ePtr<eDVBResourceManager>,
RESULT eDVBFrontendParameters::getSystem(int &t) const
{
- if (m_type == -1)
- return -1;
t = m_type;
- return 0;
+ return (m_type == -1) ? -1 : 0;
}
RESULT eDVBFrontendParameters::getDVBS(eDVBFrontendParametersSatellite &p) const
eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok, bool simulate, eDVBFrontend *simulate_fe)
- :m_simulate(simulate), m_enabled(false), m_type(-1), m_simulate_fe(simulate_fe), m_dvbid(fe), m_slotid(fe)
- ,m_fd(-1), m_rotor_mode(false), m_need_rotor_workaround(false), m_can_handle_dvbs2(false), m_can_handle_dvbt2(false)
+ :m_simulate(simulate), m_enabled(false), m_simulate_fe(simulate_fe), m_dvbid(fe), m_slotid(fe)
+ ,m_fd(-1), m_rotor_mode(false), m_need_rotor_workaround(false)
,m_state(stateClosed), m_timeout(0), m_tuneTimer(0)
#if HAVE_DVB_API_VERSION < 3
,m_secfd(-1)
void eDVBFrontend::reopenFrontend()
{
sleep(1);
- m_type = -1;
+ m_delsys.clear();
openFrontend();
}
}
else
eWarning("frontend %d already opened", m_dvbid);
- if (m_type == -1)
+
+ if (m_delsys.empty())
{
+#ifdef DTV_ENUM_DELSYS
+ struct dtv_property p[1];
+ p[0].cmd = DTV_ENUM_DELSYS;
+ struct dtv_properties cmdseq;
+ cmdseq.num = 1;
+ cmdseq.props = p;
+ if (::ioctl(m_fd, FE_GET_PROPERTY, &cmdseq) >= 0)
+ {
+ m_delsys.clear();
+ unsigned int i;
+ for (i = 0; i < p[0].u.buffer.len ; i++)
+ {
+ fe_delivery_system_t delsys = (fe_delivery_system_t)p[0].u.buffer.data[i];
+ m_delsys[delsys] = true;
+ }
+ }
+#else
if (::ioctl(m_fd, FE_GET_INFO, &fe_info) < 0)
{
eWarning("ioctl FE_GET_INFO failed");
m_fd = -1;
return -1;
}
-
+ /* old DVB API, fill delsys map with some defaults */
switch (fe_info.type)
{
- case FE_QPSK:
- m_type = iDVBFrontend::feSatellite;
- break;
- case FE_QAM:
- m_type = iDVBFrontend::feCable;
- break;
- case FE_OFDM:
- m_type = iDVBFrontend::feTerrestrial;
- break;
- default:
- eWarning("unknown frontend type.");
- ::close(m_fd);
- m_fd = -1;
- return -1;
+ case FE_QPSK:
+ {
+ m_delsys[SYS_DVBS] = true;
+#if DVB_API_VERSION >= 5
+ if (fe_info.caps & FE_CAN_2G_MODULATION) m_delsys[SYS_DVBS2] = true;
+#endif
+ break;
+ }
+ case FE_QAM:
+ {
+#if DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 6
+ m_delsys[SYS_DVBC_ANNEX_A] = true;
+#else
+ m_delsys[SYS_DVBC_ANNEX_AC] = true;
+#endif
+ break;
+ }
+ case FE_OFDM:
+ {
+ m_delsys[SYS_DVBT] = true;
+#if DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 3
+ if (fe_info.caps & FE_CAN_2G_MODULATION) m_delsys[SYS_DVBT2] = true;
+#endif
+ break;
+ }
+ case FE_ATSC: // placeholder to prevent warning
+ {
+ break;
+ }
}
- if (m_simulate_fe)
- m_simulate_fe->m_type = m_type;
- eDebugNoSimulate("detected %s frontend", "satellite\0cable\0 terrestrial"+fe_info.type*10);
+#endif
}
-#if HAVE_DVB_API_VERSION < 3
- if (m_type == iDVBFrontend::feSatellite)
+ if (m_simulate_fe)
{
- if (m_secfd < 0)
- {
- if (!m_simulate)
- {
- m_secfd = ::open(m_sec_filename, O_RDWR);
- if (m_secfd < 0)
- {
- eWarning("failed! (%s) %m", m_sec_filename);
- ::close(m_fd);
- m_fd=-1;
- return -1;
- }
- }
- }
- else
- eWarning("sec %d already opened", m_dvbid);
+ m_simulate_fe->m_delsys = m_delsys;
}
-#endif
m_sn = eSocketNotifier::create(eApp, m_fd, eSocketNotifier::Read, false);
CONNECT(m_sn->activated, eDVBFrontend::feEvent);
float SDS_SNRE = snr << 16;
float snr_in_db;
- if (oparm.sat.system == eDVBFrontendParametersSatellite::System_DVB_S) // DVB-S1 / QPSK
+ eDVBFrontendParametersSatellite sparm;
+ oparm.getDVBS(sparm);
+
+ if (sparm.system == eDVBFrontendParametersSatellite::System_DVB_S) // DVB-S1 / QPSK
{
static float SNR_COEFF[6] = {
100.0 / 4194304.0,
float fval1 = SDS_SNRE / 268435456.0,
fval2, fval3, fval4;
- if (oparm.sat.modulation == eDVBFrontendParametersSatellite::Modulation_QPSK)
+ if (sparm.modulation == eDVBFrontendParametersSatellite::Modulation_QPSK)
{
fval2 = 6.76;
fval3 = 4.35;
{
if (ret == 0x12345678) // no snr db calculation avail.. return untouched snr value..
return snr;
- switch(m_type)
+
+ int type = -1;
+ oparm.getSystem(type);
+ switch(type)
{
case feSatellite:
return ret >= sat_max ? 65536 : ret * 65536 / sat_max;
{
if (dest && PyDict_Check(dest))
{
+ int type = -1;
FRONTENDPARAMETERS front;
#if HAVE_DVB_API_VERSION >= 5
struct dtv_property p[16];
struct dtv_properties cmdseq;
cmdseq.props = p;
cmdseq.num = 0;
- switch(m_type)
+ oparm.getSystem(type);
+ switch(type)
{
case feSatellite:
p[0].cmd = DTV_DELIVERY_SYSTEM;
eDebug("FE_GET_PROPERTY failed (%m)");
original = true;
}
- else if (m_type == feSatellite && // use for DVB-S(2) only
+ else if (type == feSatellite && // use for DVB-S(2) only
ioctl(m_fd, FE_GET_FRONTEND, &front)<0)
{
eDebug("FE_GET_FRONTEND failed (%m)");
#endif
if (original)
{
- switch(m_type)
+ switch(type)
{
case feSatellite:
- PutSatelliteDataToDict(dest, oparm.sat);
+ eDVBFrontendParametersSatellite sparm;
+ oparm.getDVBS(sparm);
+ PutSatelliteDataToDict(dest, sparm);
break;
case feCable:
- PutCableDataToDict(dest, oparm.cab);
+ eDVBFrontendParametersCable cparm;
+ oparm.getDVBC(cparm);
+ PutCableDataToDict(dest, cparm);
break;
case feTerrestrial:
- PutTerrestrialDataToDict(dest, oparm.ter);
+ eDVBFrontendParametersTerrestrial tparm;
+ oparm.getDVBT(tparm);
+ PutTerrestrialDataToDict(dest, tparm);
break;
}
}
{
FRONTENDPARAMETERS &parm = front;
#if HAVE_DVB_API_VERSION >= 5
- switch(m_type)
+ switch(type)
{
case feSatellite:
- fillDictWithSatelliteData(dest, parm, p, m_data[FREQ_OFFSET], oparm.sat.orbital_position, oparm.sat.polarisation);
+ eDVBFrontendParametersSatellite sparm;
+ oparm.getDVBS(sparm);
+ fillDictWithSatelliteData(dest, parm, p, m_data[FREQ_OFFSET], sparm.orbital_position, sparm.polarisation);
break;
case feCable:
fillDictWithCableData(dest, p);
break;
}
PutToDict(dest, "inversion", tmp);
- switch(m_type)
+ switch(type)
{
+ eDVBFrontendParametersSatellite sparm;
+ oparm.getDVBS(sparm);
case feSatellite:
- fillDictWithSatelliteData(dest, parm, m_data[FREQ_OFFSET], oparm.sat.orbital_position, oparm.sat.polarisation);
+ fillDictWithSatelliteData(dest, parm, m_data[FREQ_OFFSET], sparm.orbital_position, sparm.polarisation);
break;
case feCable:
fillDictWithCableData(dest, parm);
{
const char *tmp=0;
PutToDict(dest, "tuner_number", m_slotid);
- switch(m_type)
+
+ if (supportsDeliverySystem(SYS_DVBS, true) || supportsDeliverySystem(SYS_DVBS2, true))
{
- case feSatellite:
- tmp = "DVB-S";
- break;
- case feCable:
- tmp = "DVB-C";
- break;
- case feTerrestrial:
- tmp = "DVB-T";
- break;
- default:
- tmp = "UNKNOWN";
- break;
+ tmp = "DVB-S";
+ }
+#if DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 6
+ else if (supportsDeliverySystem(SYS_DVBC_ANNEX_A, true))
+#else
+ else if (supportsDeliverySystem(SYS_DVBC_ANNEX_AC, true))
+#endif
+ {
+ tmp = "DVB-C";
+ }
+ else if (supportsDeliverySystem(SYS_DVBT, true) || supportsDeliverySystem(SYS_DVBT2, true))
+ {
+ tmp = "DVB-T";
+ }
+ else
+ {
+ tmp = "UNKNOWN";
}
PutToDict(dest, "tuner_type", tmp);
}
if (!m_simulate)
{
eDebug("setting frontend %d", m_dvbid);
+
+ int type = -1;
+ oparm.getSystem(type);
+
if (recvEvents)
m_sn->start();
feEvent(-1); // flush events
#if HAVE_DVB_API_VERSION >= 5
- if (m_type == iDVBFrontend::feSatellite)
+ if (type == iDVBFrontend::feSatellite)
{
fe_rolloff_t rolloff = ROLLOFF_35;
fe_pilot_t pilot = PILOT_OFF;
fe_modulation_t modulation = QPSK;
fe_delivery_system_t system = SYS_DVBS;
- switch(oparm.sat.system)
+ eDVBFrontendParametersSatellite sparm;
+ oparm.getDVBS(sparm);
+ switch(sparm.system)
{
case eDVBFrontendParametersSatellite::System_DVB_S: system = SYS_DVBS; break;
case eDVBFrontendParametersSatellite::System_DVB_S2: system = SYS_DVBS2; break;
};
- switch(oparm.sat.modulation)
+ switch(sparm.modulation)
{
case eDVBFrontendParametersSatellite::Modulation_QPSK: modulation = QPSK; break;
case eDVBFrontendParametersSatellite::Modulation_8PSK: modulation = PSK_8; break;
case eDVBFrontendParametersSatellite::Modulation_QAM16: modulation = QAM_16; break;
};
- switch(oparm.sat.pilot)
+ switch(sparm.pilot)
{
case eDVBFrontendParametersSatellite::Pilot_Off: pilot = PILOT_OFF; break;
case eDVBFrontendParametersSatellite::Pilot_On: pilot = PILOT_ON; break;
case eDVBFrontendParametersSatellite::Pilot_Unknown: pilot = PILOT_AUTO; break;
};
- switch(oparm.sat.rolloff)
+ switch(sparm.rolloff)
{
case eDVBFrontendParametersSatellite::RollOff_alpha_0_20: rolloff = ROLLOFF_20; break;
case eDVBFrontendParametersSatellite::RollOff_alpha_0_25: rolloff = ROLLOFF_25; break;
return;
}
}
- else if (m_type == iDVBFrontend::feCable)
+ else if (type == iDVBFrontend::feCable)
{
struct dtv_property p[8];
struct dtv_properties cmdseq;
return;
}
}
- else if (m_type == iDVBFrontend::feTerrestrial)
+ else if (type == iDVBFrontend::feTerrestrial)
{
fe_delivery_system_t system = SYS_DVBT;
- switch (oparm.ter.system)
+ eDVBFrontendParametersTerrestrial tparm;
+ oparm.getDVBT(tparm);
+ switch (tparm.system)
{
default:
case eDVBFrontendParametersTerrestrial::System_DVB_T: system = SYS_DVBT; break;
case eDVBFrontendParametersTerrestrial::System_DVB_T2: system = SYS_DVBT2; break;
}
int bandwidth = 0;
- switch (oparm.ter.bandwidth)
+ switch (tparm.bandwidth)
{
case eDVBFrontendParametersTerrestrial::Bandwidth_8MHz: bandwidth = 8000000; break;
case eDVBFrontendParametersTerrestrial::Bandwidth_7MHz: bandwidth = 7000000; break;
p[cmdseq.num].cmd = DTV_BANDWIDTH_HZ, p[cmdseq.num].u.data = bandwidth, cmdseq.num++;
p[cmdseq.num].cmd = DTV_INVERSION, p[cmdseq.num].u.data = parm_inversion, cmdseq.num++;
#if DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 9
- p[cmdseq.num].cmd = DTV_STREAM_ID , p[cmdseq.num].u.data = oparm.ter.plpid, cmdseq.num++;
+ p[cmdseq.num].cmd = DTV_STREAM_ID , p[cmdseq.num].u.data = tparm.plpid, cmdseq.num++;
#elif DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 3
- p[cmdseq.num].cmd = DTV_DVBT2_PLP_ID , p[cmdseq.num].u.data = oparm.ter.plpid, cmdseq.num++;
+ p[cmdseq.num].cmd = DTV_DVBT2_PLP_ID , p[cmdseq.num].u.data = tparm.plpid, cmdseq.num++;
#endif
p[cmdseq.num].cmd = DTV_TUNE, cmdseq.num++;
if (ioctl(m_fd, FE_SET_PROPERTY, &cmdseq) == -1)
}
}
else
-#endif
+#endif /* HAVE_DVB_API_VERSION >= 5 */
{
if (ioctl(m_fd, FE_SET_FRONTEND, &parm) == -1)
{
}
}
-RESULT eDVBFrontend::getFrontendType(int &t)
-{
- if (m_type == -1)
- return -ENODEV;
- t = m_type;
- return 0;
-}
-
RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm, unsigned int tunetimeout)
{
int res;
}
eDebugNoSimulate("tuning to %d mhz", parm_frequency/1000);
}
- oparm.sat = feparm;
+ oparm.setDVBS(feparm, feparm.no_rotor_command_on_tune);
return res;
}
parm_u_qam_fec_inner,
parm_u_qam_modulation,
parm_inversion);
- oparm.cab = feparm;
+ oparm.setDVBC(feparm);
return 0;
}
parm_inversion,
feparm.system,
feparm.plpid);
- oparm.ter = feparm;
+ oparm.setDVBT(feparm);
return 0;
}
int res=0;
- if (!m_sn && !m_simulate)
+ int type;
+ if (where.getSystem(type) < 0)
{
- eDebug("no frontend device opened... do not try to tune !!!");
- res = -ENODEV;
+ res = -EINVAL;
goto tune_error;
}
- if (m_type == -1)
+ if (!m_sn && !m_simulate)
{
+ eDebug("no frontend device opened... do not try to tune !!!");
res = -ENODEV;
goto tune_error;
}
where.calcLockTimeout(timeout);
- switch (m_type)
+ switch (type)
{
case feSatellite:
{
break;
}
+ default:
+ {
+ res = -EINVAL;
+ goto tune_error;
+ }
}
m_sec_sequence.current() = m_sec_sequence.begin();
RESULT eDVBFrontend::setVoltage(int voltage)
{
- if (m_type == feCable)
- return -1;
+
#if HAVE_DVB_API_VERSION < 3
secVoltage vlt;
#else
#if HAVE_DVB_API_VERSION < 3
return ::ioctl(m_secfd, SEC_SET_VOLTAGE, vlt);
#else
- if (m_type == feSatellite && ::ioctl(m_fd, FE_ENABLE_HIGH_LNB_VOLTAGE, increased) < 0)
- perror("FE_ENABLE_HIGH_LNB_VOLTAGE");
+ ::ioctl(m_fd, FE_ENABLE_HIGH_LNB_VOLTAGE, increased);
return ::ioctl(m_fd, FE_SET_VOLTAGE, vlt);
#endif
}
RESULT eDVBFrontend::setTone(int t)
{
- if (m_type != feSatellite)
- return -1;
#if HAVE_DVB_API_VERSION < 3
secToneMode_t tone;
#else
int score = 0;
bool preferred = (eDVBFrontend::getPreferredFrontend() >= 0 && m_slotid == eDVBFrontend::getPreferredFrontend());
- if (feparm->getSystem(type) || type != m_type || !m_enabled)
+ if (feparm->getSystem(type) || !m_enabled)
return 0;
- if (m_type == eDVBFrontend::feSatellite)
+ if (type == eDVBFrontend::feSatellite)
{
eDVBFrontendParametersSatellite sat_parm;
+ bool can_handle_dvbs, can_handle_dvbs2;
+ can_handle_dvbs = supportsDeliverySystem(SYS_DVBS, true);
+ can_handle_dvbs2 = supportsDeliverySystem(SYS_DVBS2, true);
if (feparm->getDVBS(sat_parm) < 0)
{
return 0;
}
- if (sat_parm.system == eDVBFrontendParametersSatellite::System_DVB_S2 && !m_can_handle_dvbs2)
+ if (sat_parm.system == eDVBFrontendParametersSatellite::System_DVB_S2 && !can_handle_dvbs2)
+ {
+ return 0;
+ }
+ if (sat_parm.system == eDVBFrontendParametersSatellite::System_DVB_S && !can_handle_dvbs)
{
return 0;
}
score = m_sec ? m_sec->canTune(sat_parm, this, 1 << m_slotid) : 0;
- if (score > 1 && sat_parm.system == eDVBFrontendParametersSatellite::System_DVB_S && m_can_handle_dvbs2)
+ if (score > 1 && sat_parm.system == eDVBFrontendParametersSatellite::System_DVB_S && can_handle_dvbs2)
{
/* prefer to use a S tuner, try to keep S2 free for S2 transponders */
score--;
}
}
- else if (m_type == eDVBFrontend::feCable)
+ else if (type == eDVBFrontend::feCable)
{
eDVBFrontendParametersCable cab_parm;
if (feparm->getDVBC(cab_parm) < 0)
{
return 0;
}
+#if DVB_API_VERSION > 5 || DVB_API_VERSION == 5 && DVB_API_VERSION_MINOR >= 6
+ if (!supportsDeliverySystem(SYS_DVBC_ANNEX_A, true))
+ {
+ return 0;
+ }
+#else
+ if (!supportsDeliverySystem(SYS_DVBC_ANNEX_AC, true))
+ {
+ return 0;
+ }
+#endif
score = 2;
}
- else if (m_type == eDVBFrontend::feTerrestrial)
+ else if (type == eDVBFrontend::feTerrestrial)
{
eDVBFrontendParametersTerrestrial ter_parm;
+ bool can_handle_dvbt, can_handle_dvbt2;
+ can_handle_dvbt = supportsDeliverySystem(SYS_DVBT, true);
+ can_handle_dvbt2 = supportsDeliverySystem(SYS_DVBT2, true);
if (feparm->getDVBT(ter_parm) < 0)
{
return 0;
}
- if (ter_parm.system == eDVBFrontendParametersTerrestrial::System_DVB_T2 && !m_can_handle_dvbt2)
+ if (ter_parm.system == eDVBFrontendParametersTerrestrial::System_DVB_T && !can_handle_dvbt)
+ {
+ return 0;
+ }
+ if (ter_parm.system == eDVBFrontendParametersTerrestrial::System_DVB_T2 && !can_handle_dvbt2)
{
return 0;
}
score = 2;
- if (ter_parm.system == eDVBFrontendParametersTerrestrial::System_DVB_T && m_can_handle_dvbt2)
+ if (ter_parm.system == eDVBFrontendParametersTerrestrial::System_DVB_T && can_handle_dvbt2)
{
/* prefer to use a T tuner, try to keep T2 free for T2 transponders */
score--;
return score;
}
+bool eDVBFrontend::supportsDeliverySystem(const fe_delivery_system_t &sys, bool obeywhitelist)
+{
+ std::map<fe_delivery_system_t, bool>::iterator it = m_delsys.find(sys);
+ if (it != m_delsys.end() && it->second)
+ {
+ if (obeywhitelist && !m_delsys_whitelist.empty())
+ {
+ it = m_delsys_whitelist.find(sys);
+ if (it == m_delsys_whitelist.end() || !it->second) return false;
+ }
+ return true;
+ }
+ return false;
+}
+
+void eDVBFrontend::setDeliverySystemWhitelist(const std::vector<fe_delivery_system_t> &whitelist)
+{
+ m_delsys_whitelist.clear();
+ for (unsigned int i = 0; i < whitelist.size(); i++)
+ {
+ m_delsys_whitelist[whitelist[i]] = true;
+ }
+ if (m_simulate_fe)
+ {
+ m_simulate_fe->setDeliverySystemWhitelist(whitelist);
+ }
+}
+
bool eDVBFrontend::setSlotInfo(ePyObject obj)
{
ePyObject Id, Descr, Enabled, IsDVBS2, IsDVBT2, frontendId;
!!strstr(m_description, "Alps BSBE2") ||
!!strstr(m_description, "Alps -S") ||
!!strstr(m_description, "BCM4501");
- m_can_handle_dvbs2 = IsDVBS2 == Py_True;
- m_can_handle_dvbt2 = IsDVBT2 == Py_True;
+ if (IsDVBS2 == Py_True)
+ {
+ /* HACK for legacy dvb api without DELSYS support */
+ m_delsys[SYS_DVBS2] = true;
+ }
+ if (IsDVBT2 == Py_True)
+ {
+ /* HACK for legacy dvb api without DELSYS support */
+ m_delsys[SYS_DVBT2] = true;
+ }
eDebugNoSimulate("setSlotInfo for dvb frontend %d to slotid %d, descr %s, need rotorworkaround %s, enabled %s, DVB-S2 %s, DVB-T2 %s",
- m_dvbid, m_slotid, m_description, m_need_rotor_workaround ? "Yes" : "No", m_enabled ? "Yes" : "No", m_can_handle_dvbs2 ? "Yes" : "No", m_can_handle_dvbt2 ? "Yes" : "No" );
+ m_dvbid, m_slotid, m_description, m_need_rotor_workaround ? "Yes" : "No", m_enabled == Py_True ? "Yes" : "No", IsDVBS2 == Py_True ? "Yes" : "No", IsDVBT2 == Py_True ? "Yes" : "No" );
return true;
arg_error:
PyErr_SetString(PyExc_StandardError,
DECLARE_REF(eDVBFrontend);
bool m_simulate;
bool m_enabled;
- int m_type;
eDVBFrontend *m_simulate_fe; // only used to set frontend type in dvb.cpp
int m_dvbid;
int m_slotid;
int m_fd;
bool m_rotor_mode;
bool m_need_rotor_workaround;
- bool m_can_handle_dvbs2;
- bool m_can_handle_dvbt2;
+ std::map<fe_delivery_system_t, bool> m_delsys, m_delsys_whitelist;
char m_filename[128];
char m_description[128];
#if HAVE_DVB_API_VERSION < 3
char m_sec_filename[128];
#endif
FRONTENDPARAMETERS parm;
- union {
- eDVBFrontendParametersSatellite sat;
- eDVBFrontendParametersCable cab;
- eDVBFrontendParametersTerrestrial ter;
- } oparm;
+ eDVBFrontendParameters oparm;
int m_state;
ePtr<iDVBSatelliteEquipmentControl> m_sec;
virtual ~eDVBFrontend();
int readInputpower();
- RESULT getFrontendType(int &type);
RESULT tune(const iDVBFrontendParameters &where);
RESULT prepare_sat(const eDVBFrontendParametersSatellite &, unsigned int timeout);
RESULT prepare_cable(const eDVBFrontendParametersCable &);
static int getTypePriorityOrder() { return PriorityOrder; }
static void setPreferredFrontend(int index) { PreferredFrontendIndex = index; }
static int getPreferredFrontend() { return PreferredFrontendIndex; }
+ bool supportsDeliverySystem(const fe_delivery_system_t &sys, bool obeywhitelist);
+ void setDeliverySystemWhitelist(const std::vector<fe_delivery_system_t> &whitelist);
void reopenFrontend();
int openFrontend();
class iDVBFrontend: public iDVBFrontend_ENUMS, public iObject
{
public:
- virtual RESULT getFrontendType(int &SWIG_OUTPUT)=0;
virtual RESULT tune(const iDVBFrontendParameters &where)=0;
virtual int closeFrontend(bool force = false, bool no_delayed = false)=0;
virtual void reopenFrontend()=0;
"DVB-T2": ("DVB-T", "DVB-T2", None)
}
+ def getType(self):
+ try:
+ if self.isMultiType():
+ return self.multi_type[self.config.multiType.value]
+ except:
+ pass
+ return self.type
+
def isCompatible(self, what):
if not self.isSupported():
return False
- return what in self.compatible[self.type]
+ return what in self.compatible[self.getType()]
def canBeCompatible(self, what):
if self.isCompatible(what):
return True
return False
- def getType(self):
- return self.type
-
def connectableTo(self):
connectable = {
"DVB-S": ("DVB-S", "DVB-S2"),
"DVB-S2": ("DVB-S", "DVB-S2"),
"DVB-T2": ("DVB-T", "DVB-T2",)
}
- return connectable[self.type]
+ return connectable[self.getType()]
def getSlotName(self):
# get a friendly description for a slot name.
"DVB-S2": "DVB-S2",
"DVB-T2": "DVB-T2",
None: _("empty")
- }[self.type]
+ }[self.getType()]
friendly_type = property(getFriendlyType)
friendly_full_description = property(getFriendlyFullDescription)
config_mode = property(lambda self: config.Nims[self.slot].configMode.value)
config = property(lambda self: config.Nims[self.slot])
- empty = property(lambda self: self.type is None)
+ empty = property(lambda self: self.getType() is None)
class NimManager:
def getConfiguredSats(self):
entry["frontend_device"] = entry["internally_connectable"] = None
if not (entry.has_key("multi_type")):
entry["multi_type"] = {}
+
+ # get MultiType from DTV_ENUM_DELSYS
+ if entry["frontend_device"] is not None:
+ types = [type for type in ["DVB-C", "DVB-T2", "DVB-T", "DVB-S2", "DVB-S", "ATSC"] if eDVBResourceManager.getInstance().frontendIsCompatible(entry["frontend_device"], type)]
+ if "DVB-T2" in types and "DVB-T" in types:
+ # DVB-T2 implies DVB-T support
+ types.remove("DVB-T")
+ if "DVB-S2" in types and "DVB-S" in types:
+ # DVB-S2 implies DVB-S support
+ types.remove("DVB-S")
+ if len(types) > 1:
+ entry["multi_type"] = {}
+ for type in types:
+ entry["multi_type"][str(types.index(type))] = type
+
self.nim_slots.append(NIM(slot = id, description = entry["name"], type = entry["type"], has_outputs = entry["has_outputs"], internally_connectable = entry["internally_connectable"], multi_type = entry["multi_type"], frontend_id = entry["frontend_device"], i2c = entry["i2c"], is_empty = entry["isempty"]))
def hasNimType(self, chktype):
return False
def getNimType(self, slotid):
- return self.nim_slots[slotid].type
+ return self.nim_slots[slotid].getType()
def getNimDescription(self, slotid):
return self.nim_slots[slotid].friendly_full_description
if nimmgr.nim_slots[slot_id].description == 'Alps BSBE2':
open("/proc/stb/frontend/%d/tone_amplitude" %(fe_id), "w").write(configElement.value)
- def tunerTypeChanged(nimmgr, configElement):
- fe_id = configElement.fe_id
-
- cur_type = int(open("/proc/stb/frontend/%d/mode" % (fe_id), "r").read())
- if cur_type != int(configElement.value):
- print "tunerTypeChanged feid %d from %d to mode %d" % (fe_id, cur_type, int(configElement.value))
-
- try:
- oldvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline()
- open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0")
- except:
- print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"
-
- frontend = eDVBResourceManager.getInstance().allocateRawChannel(fe_id).getFrontend()
- frontend.closeFrontend()
- open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value)
- frontend.reopenFrontend()
- try:
- open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(oldvalue)
- except:
- print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"
- nimmgr.enumerateNIMs()
- else:
- print "tuner type is already already %d" %cur_type
-
- empty_slots = 0
- for slot in nimmgr.nim_slots:
- x = slot.slot
- nim = config.Nims[x]
- addMultiType = False
+ def createSatConfig(nim, x, empty_slots):
+ print "[Nimmanager] slot %d create config satellite.." % slot.slot
try:
- nim.multiType
+ nim.toneAmplitude
except:
- addMultiType = True
- if slot.isMultiType() and addMultiType:
- typeList = []
- for id in slot.getMultiTypeList().keys():
- type = slot.getMultiTypeList()[id]
- typeList.append((id, type))
- nim.multiType = ConfigSelection(typeList, "0")
-
- nim.multiType.fe_id = x - empty_slots
- nim.multiType.addNotifier(boundFunction(tunerTypeChanged, nimmgr))
-
- empty_slots = 0
- for slot in nimmgr.nim_slots:
- x = slot.slot
- nim = config.Nims[x]
-
- if slot.isCompatible("DVB-S"):
nim.toneAmplitude = ConfigSelection([("11", "340mV"), ("10", "360mV"), ("9", "600mV"), ("8", "700mV"), ("7", "800mV"), ("6", "900mV"), ("5", "1100mV")], "7")
nim.toneAmplitude.fe_id = x - empty_slots
nim.toneAmplitude.slot_id = x
nim.fastTurningBegin = ConfigDateTime(default = mktime(btime.timetuple()), formatstring = _("%H:%M"), increment = 900)
etime = datetime(1970, 1, 1, 19, 0);
nim.fastTurningEnd = ConfigDateTime(default = mktime(etime.timetuple()), formatstring = _("%H:%M"), increment = 900)
- config_mode_choices = [ ("nothing", _("nothing connected")),
- ("simple", _("simple")), ("advanced", _("advanced"))]
- if len(nimmgr.getNimListOfType(slot.type, exception = x)) > 0:
- config_mode_choices.append(("equal", _("equal to")))
- config_mode_choices.append(("satposdepends", _("second cable of motorized LNB")))
- if len(nimmgr.canConnectTo(x)) > 0:
- config_mode_choices.append(("loopthrough", _("loopthrough to")))
- nim.advanced = ConfigNothing()
- tmp = ConfigSelection(config_mode_choices, "nothing")
- tmp.slot_id = x
- tmp.addNotifier(configModeChanged, initial_call = False)
- nim.configMode = tmp
- elif slot.isCompatible("DVB-C"):
- nim.configMode = ConfigSelection(
- choices = {
- "enabled": _("enabled"),
- "nothing": _("nothing connected"),
- },
- default = "enabled")
+
+ def createCableConfig(nim, x):
+ print "[Nimmanager] slot %d create config cable.." % slot.slot
+ try:
+ nim.cable
+ except:
list = [ ]
n = 0
for x in nimmgr.cablesList:
nim.cable.scan_sr_6875 = ConfigYesNo(default = True)
nim.cable.scan_sr_ext1 = ConfigInteger(default = 0, limits = (0, 7230))
nim.cable.scan_sr_ext2 = ConfigInteger(default = 0, limits = (0, 7230))
- elif slot.isCompatible("DVB-T"):
- nim.configMode = ConfigSelection(
- choices = {
- "enabled": _("enabled"),
- "nothing": _("nothing connected"),
- },
- default = "enabled")
+
+ def createTerrestrialConfig(nim, x):
+ print "[Nimmanager] slot %d create config terrestrial.." % slot.slot
+ try:
+ nim.terrestrial
+ except:
list = []
n = 0
for x in nimmgr.terrestrialsList:
n += 1
nim.terrestrial = ConfigSelection(choices = list)
nim.terrestrial_5V = ConfigOnOff()
+
+ def tunerTypeChanged(nimmgr, configElement):
+ fe_id = configElement.fe_id
+ eDVBResourceManager.getInstance().setFrontendType(nimmgr.nim_slots[fe_id].frontend_id, nimmgr.nim_slots[fe_id].getType())
+ import os
+ if os.path.exists("/proc/stb/frontend/%d/mode" % fe_id):
+ cur_type = int(open("/proc/stb/frontend/%d/mode" % (fe_id), "r").read())
+ if cur_type == int(configElement.value):
+ print "tuner type is already already %d" %cur_type
+ return
+ print "tunerTypeChanged feid %d from %d to mode %d" % (fe_id, cur_type, int(configElement.value))
+
+ print "tunerTypeChanged feid %d, mode %d" % (fe_id, int(configElement.value))
+
+ try:
+ oldvalue = open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "r").readline()
+ open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write("0")
+ except:
+ print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"
+
+ frontend = eDVBResourceManager.getInstance().allocateRawChannel(fe_id).getFrontend()
+ frontend.closeFrontend()
+
+ if os.path.exists("/proc/stb/frontend/%d/mode" % fe_id):
+ open("/proc/stb/frontend/%d/mode" % (fe_id), "w").write(configElement.value)
+
+ frontend.reopenFrontend()
+ try:
+ open("/sys/module/dvb_core/parameters/dvb_shutdown_timeout", "w").write(oldvalue)
+ except:
+ print "[info] no /sys/module/dvb_core/parameters/dvb_shutdown_timeout available"
+ nimmgr.enumerateNIMs()
+
+ empty_slots = 0
+ for slot in nimmgr.nim_slots:
+ print "[InitNimManager] check multi type slot %d" % slot.slot
+ x = slot.slot
+ nim = config.Nims[x]
+ addMultiType = False
+ try:
+ nim.multiType
+ except:
+ addMultiType = True
+ if slot.isMultiType() and addMultiType:
+ print "[InitNimManager] slot %d is multi type : " % slot.slot, slot.getMultiTypeList()
+ typeList = []
+ for id in slot.getMultiTypeList().keys():
+ type = slot.getMultiTypeList()[id]
+ typeList.append((id, type))
+ nim.multiType = ConfigSelection(typeList, "0")
+ nim.multiType.fe_id = x - empty_slots
+ nim.multiType.addNotifier(boundFunction(tunerTypeChanged, nimmgr))
+
+ empty_slots = 0
+ for slot in nimmgr.nim_slots:
+ x = slot.slot
+ nim = config.Nims[x]
+
+ if slot.isCompatible("DVB-S"):
+ createSatConfig(nim, x, empty_slots)
+ config_mode_choices = [ ("nothing", _("nothing connected")),
+ ("simple", _("simple")), ("advanced", _("advanced"))]
+ if len(nimmgr.getNimListOfType(slot.getType(), exception = x)) > 0:
+ config_mode_choices.append(("equal", _("equal to")))
+ config_mode_choices.append(("satposdepends", _("second cable of motorized LNB")))
+ if len(nimmgr.canConnectTo(x)) > 0:
+ config_mode_choices.append(("loopthrough", _("loopthrough to")))
+ nim.advanced = ConfigNothing()
+ tmp = ConfigSelection(config_mode_choices, "nothing")
+ tmp.slot_id = x
+ tmp.addNotifier(configModeChanged, initial_call = False)
+ nim.configMode = tmp
+ elif slot.isCompatible("DVB-C"):
+ nim.configMode = ConfigSelection(
+ choices = {
+ "enabled": _("enabled"),
+ "nothing": _("nothing connected"),
+ },
+ default = "enabled")
+ createCableConfig(nim, x)
+ elif slot.isCompatible("DVB-T"):
+ nim.configMode = ConfigSelection(
+ choices = {
+ "enabled": _("enabled"),
+ "nothing": _("nothing connected"),
+ },
+ default = "enabled")
+ createTerrestrialConfig(nim, x)
else:
+ print "[Nimmanager] slot %d create config nothing.." % slot.slot
empty_slots += 1
nim.configMode = ConfigSelection(choices = { "nothing": _("disabled") }, default="nothing");
- if slot.type is not None:
- print "pls add support for this frontend type!", slot.type
+ if slot.getType() is not None:
+ print "pls add support for this frontend type!", slot.getType()
# assert False
nimmgr.sec = SecConfigure(nimmgr)
installdir = $(pkglibdir)/python/Plugins/Extensions
SUBDIRS = TuxboxPlugins CutListEditor PicturePlayer MediaScanner MediaPlayer GraphMultiEPG SocketMMI DVDBurn Modem WebBrowser \
- VuplusEvent StreamTV DLNABrowser DLNAServer HbbTV BackupSuiteUSB BackupSuiteHDD
+ StreamTV DLNABrowser DLNAServer HbbTV BackupSuiteUSB BackupSuiteHDD
if HAVE_LIBDDVD
SUBDIRS += DVDPlayer
+++ /dev/null
-installdir = $(pkglibdir)/python/Plugins/Extensions/VuplusEvent
-
-SUBDIRS = meta
-
-install_PYTHON = \
- __init__.py \
- plugin.py \
- _vuplusauthenticity.so \
- vuplusauthenticity.py
+++ /dev/null
-installdir = $(datadir)/meta
-
-dist_install_DATA = plugin_vuplusevent.xml
+++ /dev/null
-<default>
- <prerequisites>
- <tag type="System" />
- </prerequisites>
- <info>
- <author>hschang</author>
- <name>Return the Love Event (only for genuine box)</name>
- <packagename>enigma2-plugin-systemplugins-vuplusevent</packagename>
- <shortdescription>Don't lose the chance to get the gift.</shortdescription>
- <description>Don't lose the chance to get the gift.</description>
- </info>
- <files type="package">
- <file type="package" name="enigma2-plugin-systemplugins-vuplusevent" />
- </files>
-
-</default>
+++ /dev/null
-from Screens.Screen import Screen
-from Components.ActionMap import ActionMap
-from Components.ConfigList import ConfigListScreen
-from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigSelection, ConfigText, ConfigInteger,NoSave
-from Components.Sources.StaticText import StaticText
-from Components.Label import Label
-from Plugins.Plugin import PluginDescriptor
-from Tools.Directories import resolveFilename, SCOPE_PLUGINS, fileExists
-from Screens.MessageBox import MessageBox
-from enigma import eTimer
-import vuplusauthenticity
-import os
-import socket
-import urllib2
-
-default_email_address = "Please input your E-mail address"
-config.plugins.vuplusauthenticity = ConfigSubsection()
-config.plugins.vuplusauthenticity.sn_a = NoSave(ConfigSelection(default = "MSA", choices = [ ("MSA", _("MSA")), ("MA", _("MA")), ("MB", _("MB")), ("MC", _("MC")), ("C", _("C")), ("D", _("D")), ("E", _("E")), ("F", _("F")), ("G", _("G"))] ))
-config.plugins.vuplusauthenticity.sn_b = NoSave(ConfigInteger(default = 0, limits = (1, 9999999999)))
-config.plugins.vuplusauthenticity.sn_b_mx = NoSave(ConfigInteger(default = 0, limits = (1, 999999999)))
-config.plugins.vuplusauthenticity.sn_b_msa = NoSave(ConfigInteger(default = 0, limits = (1, 9999999)))
-config.plugins.vuplusauthenticity.email = NoSave(ConfigText(default = default_email_address, visible_width = 50, fixed_size = False))
-
-GENUINE_MESSAGES={
- -6 : "UNEXPECTED ERROR(2).",
- -5 : "INVALID SERIAL NUMBER.",
- -4 : " Connect to server failed, \nplease check your network configuration and retry.",
- -3 : "UNEXPECTED ERROR(1).",
- -2 : "DEVICE OPEN ERROR.",
- -1 : "AUTHENTICATION FAILED.",
- 0 : "AUTHENTICATION SUCCESS."
-}
-
-class VuplusAuthenticity(Screen, ConfigListScreen):
- skin = """
- <screen name="VuplusAuthenticity" position="center,center" size="600,320" title="Return the Love Event (only for genuine box)">
- <ePixmap pixmap="skin_default/buttons/red.png" position="140,15" size="140,40" alphatest="on" />
- <ePixmap pixmap="skin_default/buttons/green.png" position="320,15" size="140,40" alphatest="on" />
-
- <widget source="key_red" render="Label" position="140,15" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1" />
- <widget source="key_green" render="Label" position="320,15" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1" />
-
- <widget name="config" zPosition="2" position="10,70" size="580,80" scrollbarMode="showOnDemand" transparent="1" />
- <widget name="text1" position="10,160" size="580,50" font="Regular;32" halign="center" valign="center"/>
- <widget name="text2" position="10,220" size="580,100" font="Regular;18" halign="center" valign="center"/>
- </screen>
- """
- def __init__(self,session):
- Screen.__init__(self,session)
- self.session = session
- self["shortcuts"] = ActionMap(["ShortcutActions", "SetupActions" ],
- {
- "ok": self.Start,
- "cancel": self.keyExit,
- "red": self.keyExit,
- "green": self.Start,
- }, -2)
- self.genuine = None
- self.list = []
- ConfigListScreen.__init__(self, self.list, session = self.session)
- self["key_red"] = StaticText(_("Exit"))
- self["key_green"] = StaticText(_("Start"))
- self["text1"]=Label("Press green button to start")
- self["text2"]=Label("With this plugin you can verify the authenticity of your Vu+.\nFor more information, please visit our website \nhttp://vuplus.com")
- self.createSetup()
- self.onLayoutFinish.append(self.checkKernelVer)
- self.checkTimer = eTimer()
- self.checkTimer.callback.append(self.invalidKVer)
- self.requestauth_timer = eTimer()
- self.requestauth_timer.callback.append(self.requestauth)
-
- def checkKernelVer(self):
- KVer = os.uname()[2]
- if float(KVer[:3]) < 3.1:
- self.checkTimer.start(0,True)
-
- def invalidKVer(self):
- self.session.openWithCallback(self.close, MessageBox, _("For use this plugin, you must update the kernel version to 3.1 or later"), MessageBox.TYPE_ERROR)
-
- def createSetup(self):
- self.list = []
- self.sn_aEntry = getConfigListEntry(_("1-1. Serial Number (The first two or three letters of SN)"), config.plugins.vuplusauthenticity.sn_a)
- if config.plugins.vuplusauthenticity.sn_a.value == "MSA":
- self.sn_bEntry = getConfigListEntry(_("1-2. Serial Number (The remaining numbers of SN)"), config.plugins.vuplusauthenticity.sn_b_msa)
- elif config.plugins.vuplusauthenticity.sn_a.value in [ 'MA', 'MB', 'MC' ]:
- self.sn_bEntry = getConfigListEntry(_("1-2. Serial Number (The remaining numbers of SN)"), config.plugins.vuplusauthenticity.sn_b_mx)
- else:
- self.sn_bEntry = getConfigListEntry(_("1-2. Serial Number (The remaining numbers of SN)"), config.plugins.vuplusauthenticity.sn_b)
- self.emailEntry = getConfigListEntry(_("2. Contact"), config.plugins.vuplusauthenticity.email)
- self.list.append( self.sn_aEntry )
- self.list.append( self.sn_bEntry )
- self.list.append( self.emailEntry )
- self["config"].list = self.list
- self["config"].l.setList(self.list)
-
- def confirmValidSN(self):
- if config.plugins.vuplusauthenticity.sn_a.value == 'MSA':
- sn_length = 7
- sn = str(config.plugins.vuplusauthenticity.sn_b_msa.value)
- elif config.plugins.vuplusauthenticity.sn_a.value in [ 'MA', 'MB', 'MC' ]:
- sn_length = 9
- sn = str(config.plugins.vuplusauthenticity.sn_b_mx.value)
- else:
- sn_length = 10
- sn = str(config.plugins.vuplusauthenticity.sn_b.value)
- if len(sn) > sn_length or sn == '0':
- return False
- else:
- while(len(sn)<sn_length):
- sn = '0'+sn
- if sn_length == 10:
- if int(sn[:3]) == 0 or int(sn[3:5]) not in range(1,53) or int(sn[-5:]) == 0:
- return False
- else:
- return True
- if sn_length == 9:
- if int(sn[:2]) not in range(28) or int(sn[2:4]) not in range(1,53) or int(sn[-5:]) == 0:
- return False
- else:
- return True
- else:
- if int(sn[:2]) not in range(1,53) or int(sn[-5:]) == 0:
- return False
- else:
- return True
-
- def displayResult(self, ret = -5):
- global GENUINE_MESSAGES
- self["text1"].setText(GENUINE_MESSAGES[ret])
- self["key_green"].text = _("Restart")
-
- def Start(self):
- self["text1"].setText("WAITING......")
- msg = "Please note that you agree to send software information of the box by applying the event.\nThe collected data will be used in a form that does not personally identify you."
- self.session.openWithCallback(self.userConfirmCallback, MessageBoxGenuine, _(msg), MessageBox.TYPE_YESNO)
-
- def userConfirmCallback(self,ret):
- if ret:
- self.requestauth_timer.start(0,True)
- else:
- self["text1"].setText("Press green button to start")
-
- def getModel(self):
- if fileExists("/proc/stb/info/vumodel"):
- vumodel = open("/proc/stb/info/vumodel")
- info=vumodel.read().strip()
- vumodel.close()
- return info
- else:
- return "unknown"
-
- def requestauth(self):
- if(not self.confirmValidSN()):
- self.displayResult(-5)
- return
- if config.plugins.vuplusauthenticity.sn_a.value == 'MSA':
- sn_length = 7
- sn_b = str(config.plugins.vuplusauthenticity.sn_b_msa.value)
- if config.plugins.vuplusauthenticity.sn_a.value in [ 'MA', 'MB', 'MC' ]:
- sn_length = 9
- sn_b = str(config.plugins.vuplusauthenticity.sn_b_mx.value)
- else:
- sn_length = 10
- sn_b = str(config.plugins.vuplusauthenticity.sn_b.value)
- while(len(sn_b)<sn_length):
- sn_b = '0'+sn_b
- serial_number = config.plugins.vuplusauthenticity.sn_a.value + sn_b
- model =self.getModel()
- email = config.plugins.vuplusauthenticity.email.value
- if len(email) == 0 or email == default_email_address:
- email = "none"
- try:
- ret=vuplusauthenticity.requestauth(serial_number, model, email)
- self.displayResult(ret)
- except :
- self.displayResult(-6)
-
- def keyLeft(self):
- ConfigListScreen.keyLeft(self)
- self.createSetup()
-
- def keyRight(self):
- ConfigListScreen.keyRight(self)
- self.createSetup()
-
- def keyExit(self):
- self.close()
-
-class MessageBoxGenuine(MessageBox):
- skin = """
- <screen name="MessageBoxGenuine" position="center,center" size="600,10" title="Message">
- <widget name="text" position="65,8" size="420,0" font="Regular;22" />
- <widget name="ErrorPixmap" pixmap="Vu_HD/icons/input_error.png" position="5,5" size="53,53" alphatest="blend" />
- <widget name="QuestionPixmap" pixmap="Vu_HD/icons/input_question.png" position="5,5" size="53,53" alphatest="blend" />
- <widget name="InfoPixmap" pixmap="Vu_HD/icons/input_info.png" position="5,5" size="53,53" alphatest="blend" />
- <widget name="list" position="100,100" size="380,375" transparent="1" />
- <applet type="onLayoutFinish">
-# this should be factored out into some helper code, but currently demonstrates applets.
-from enigma import eSize, ePoint
-
-orgwidth = self.instance.size().width()
-orgpos = self.instance.position()
-textsize = self["text"].getSize()
-
-# y size still must be fixed in font stuff...
-textsize = (textsize[0] + 50, textsize[1] + 50)
-offset = 0
-if self.type == self.TYPE_YESNO:
- offset = 60
-wsizex = textsize[0] + 60
-wsizey = textsize[1] + offset
-if (280 > wsizex):
- wsizex = 280
-wsize = (wsizex, wsizey)
-
-
-# resize
-self.instance.resize(eSize(*wsize))
-
-# resize label
-self["text"].instance.resize(eSize(*textsize))
-
-# move list
-listsize = (wsizex, 50)
-self["list"].instance.move(ePoint(0, textsize[1]))
-self["list"].instance.resize(eSize(*listsize))
-
-# center window
-newwidth = wsize[0]
-self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y()))
- </applet>
- </screen>"""
- def __init__(self, session, text, type = MessageBox.TYPE_YESNO, timeout = -1, close_on_any_key = False, default = True, enable_input = True, msgBoxID = None):
- MessageBox.__init__(self,session, text, type, timeout, close_on_any_key, default, enable_input,msgBoxID)
- if type == MessageBox.TYPE_YESNO:
- self.list = [ (_("Agree"), 0), (_("Exit"), 1) ]
- self["list"].setList(self.list)
-
-def main(session, **kwargs):
- session.open(VuplusAuthenticity)
-
-def Plugins(**kwargs):
- return [PluginDescriptor(name=_("Return the Love Event"), description="Don't lose the chance to get the gift.", where = PluginDescriptor.WHERE_PLUGINMENU, needsRestart = False, fnc=main)]
-
+++ /dev/null
-# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.39
-#
-# Do not make changes to this file unless you know what you are doing--modify
-# the SWIG interface file instead.
-# This file is compatible with both classic and new-style classes.
-
-from sys import version_info
-if version_info >= (2,6,0):
- def swig_import_helper():
- from os.path import dirname
- import imp
- fp = None
- try:
- fp, pathname, description = imp.find_module('_vuplusauthenticity', [dirname(__file__)])
- except ImportError:
- import _vuplusauthenticity
- return _vuplusauthenticity
- if fp is not None:
- try:
- _mod = imp.load_module('_vuplusauthenticity', fp, pathname, description)
- finally:
- fp.close()
- return _mod
- _vuplusauthenticity = swig_import_helper()
- del swig_import_helper
-else:
- import _vuplusauthenticity
-del version_info
-try:
- _swig_property = property
-except NameError:
- pass # Python < 2.2 doesn't have 'property'.
-def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
- if (name == "thisown"): return self.this.own(value)
- if (name == "this"):
- if type(value).__name__ == 'SwigPyObject':
- self.__dict__[name] = value
- return
- method = class_type.__swig_setmethods__.get(name,None)
- if method: return method(self,value)
- if (not static) or hasattr(self,name):
- self.__dict__[name] = value
- else:
- raise AttributeError("You cannot add attributes to %s" % self)
-
-def _swig_setattr(self,class_type,name,value):
- return _swig_setattr_nondynamic(self,class_type,name,value,0)
-
-def _swig_getattr(self,class_type,name):
- if (name == "thisown"): return self.this.own()
- method = class_type.__swig_getmethods__.get(name,None)
- if method: return method(self)
- raise AttributeError(name)
-
-def _swig_repr(self):
- try: strthis = "proxy of " + self.this.__repr__()
- except: strthis = ""
- return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
-
-try:
- _object = object
- _newclass = 1
-except AttributeError:
- class _object : pass
- _newclass = 0
-
-
-
-def requestauth(*args):
- return _vuplusauthenticity.requestauth(*args)
-requestauth = _vuplusauthenticity.requestauth
-
-
#print "inversion:", 2
tlist.append(parm)
-def getInitialTerrestrialTransponderList(tlist, region):
+def getInitialTerrestrialTransponderList(tlist, region, skip_t2 = False):
list = nimmanager.getTranspondersTerrestrial(region)
#self.transponders[self.parsedTer].append((2,freq,bw,const,crh,crl,guard,transm,hierarchy,inv,system,plpid))
for x in list:
if x[0] == 2: #TERRESTRIAL
- if x[10] == eDVBFrontendParametersTerrestrial.System_DVB_T2:
+ if skip_t2 and x[10] == eDVBFrontendParametersTerrestrial.System_DVB_T2:
# Should be searching on TerrestrialTransponderSearchSupport.
continue
parm = buildTerTransponder(x[1], x[9], x[2], x[4], x[5], x[3], x[7], x[6], x[8], x[10], x[11])
"DVBC_BAND_US_HYPER" : 1 << 11,
}
-class SimpleNimSockets:
- def __init__(self):
- self.nim_sockets = []
-
- def Parse(self):
- self.nim_sockets = []
-
- nim_slot_idx = -1
- fp = file('/proc/bus/nim_sockets')
- for line in fp:
- line = line.strip()
- if line == "": continue
-
- if line.startswith('NIM Socket '):
- nim_slot_idx += 1
- self.nim_sockets.append({'slot_idx':str(nim_slot_idx)})
- elif line.startswith('Type:'):
- line_token = line.split(":")
- self.nim_sockets[nim_slot_idx]["type"] = line_token[1].strip()
- elif line.startswith('Name:'):
- line_token = line.split(":")
- self.nim_sockets[nim_slot_idx]["name"] = line_token[1].strip()
- elif line.startswith('Frontend_Device:'):
- line_token = line.split(":")
- self.nim_sockets[nim_slot_idx]["frontend_device"] = line_token[1].strip()
- elif line.startswith('Mode '):
- line_token = line.split(":")
- mode=[]
- try: mode=self.nim_sockets[nim_slot_idx]["mode"]
- except: mode=[]
- mode.append(line_token[1].strip())
- self.nim_sockets[nim_slot_idx]["mode"] = mode
- elif line.startswith('I2C_Device:'):
- line_token = line.split(":")
- self.nim_sockets[nim_slot_idx]["i2c_device"] = line_token[1].strip()
- fp.close()
-
- def GetTunerName(self, socket_id, type):
- if len(self.nim_sockets) == 0:
- return None
- try:
- nim_socket = self.nim_sockets[socket_id]
- if nim_socket['type'] in type:
- name_token = nim_socket['name'].split(' ')
- return name_token[2][4:-1]
- except Exception, err:
- print "SimpleNimSockets ->", err
- return ""
-
- def GetDeviceId(self, filter):
- tuners={}
- device_id = 0
- socket_id = 0
- for nim_socket in self.nim_sockets:
- name_token = nim_socket['name'].split(' ')
- name = name_token[2][4:-1]
- if name == filter:
- #print nim_socket['type'], name, device_id
- tuners[str(socket_id)] = {'id' : device_id, 'type' : nim_socket['type']}
- if device_id: device_id = 0
- else: device_id = 1
- socket_id += 1
- return tuners
+cable_autoscan_nimtype = {
+'SSH108' : 'ssh108',
+'TT3L10' : 'tt3l10',
+'TURBO' : 'vuplus_turbo_c'
+}
+
+terrestrial_autoscan_nimtype = {
+'SSH108' : 'ssh108_t2_scan',
+'TT3L10' : 'tt3l10_t2_scan',
+'TURBO' : 'vuplus_turbo_t'
+}
+
+def GetDeviceId(filter, nim_idx):
+ tuners={}
+ device_id = 0
+ socket_id = 0
+ for nim in nimmanager.nim_slots:
+ name_token = nim.description.split(' ')
+ name = name_token[-1][4:-1]
+ if name == filter:
+ if socket_id == nim_idx:
+ break
+
+ if device_id: device_id = 0
+ else: device_id = 1
+ socket_id += 1
+ return device_id
class CableTransponderSearchSupport:
# def setCableTransponderSearchResult(self, tlist):
self.cable_search_session["text"].setText(tmpstr)
def startCableTransponderSearch(self, nim_idx):
- def GetCommand(nimIdx):
- _supportNimType = { 'SSH108':'ssh108', 'TT3L10':'tt3l10' }
-
- simple_ns = SimpleNimSockets()
+ def GetCommand(nim_idx):
+ global cable_autoscan_nimtype
try:
- simple_ns.Parse()
- nim_name = simple_ns.GetTunerName(nimIdx, ['DVB-C'])
+ nim_name = nimmanager.getNimName(nim_idx)
if nim_name is not None and nim_name != "":
device_id = ""
+ nim_name = nim_name.split(' ')[-1][4:-1]
if nim_name == 'TT3L10':
try:
- device_id = simple_ns.GetDeviceId('TT3L10')[str(nimIdx)]['id']
+ device_id = GetDeviceId('TT3L10', nimIdx)
device_id = "--device=%s" % (device_id)
except: device_id = ""
if device_id == "":
return "tda1002x"
- #print nimIdx, nim_name, _supportNimType[nim_name], device_id
+# print nimIdx, nim_name, cable_autoscan_nimtype[nim_name], device_id
try:
- command = "%s %s" % (_supportNimType[nim_name], device_id)
+ command = "%s %s" % (cable_autoscan_nimtype[nim_name], device_id)
return command
except: pass
- except: pass
+ except Exception, err:
+ print "GetCommand ->", err
return "tda1002x"
if not self.tryGetRawFrontend(nim_idx):
print self.terrestrial_search_data
data = self.terrestrial_search_data.split()
if len(data):
+# print "[setTerrestrialTransponderData] data : ", data
if data[0] == 'OK':
# DVB-T : OK frequency bandwidth delivery system -1
# DVB-T2 : OK frequency bandwidth delivery system number_of_plp plp_id0:plp_type0
self.__tlist.append(parm)
else:
plp_list = data[5:]
- plp_num = data[4]
+ plp_num = int(data[4])
if len(plp_list) > plp_num:
plp_list = plp_list[:plp_num]
for plp in plp_list:
else:
return None
- def startTerrestrialTransponderSearch(self, nim_idx, region):
- def GetCommand(nimIdx):
- _supportNimType = { 'SSH108':'ssh108_t2_scan', 'TT3L10':'tt3l10_t2_scan' }
-
- simple_ns = SimpleNimSockets()
- try:
- simple_ns.Parse()
- nim_name = simple_ns.GetTunerName(nimIdx, ['DVB-T','DVB-T2'])
- if nim_name is not None and nim_name != "":
- device_id = ""
- if nim_name == 'TT3L10':
- try:
- device_id = simple_ns.GetDeviceId('TT3L10')[str(nimIdx)]['id']
- device_id = "--device %s" % (device_id)
- except: device_id = ""
- if device_id == "":
- return "ssh108_t2_scan"
- #print nimIdx, nim_name, _supportNimType[nim_name], device_id
- try:
- command = "%s %s" % (_supportNimType[nim_name], device_id)
- return command
- except: pass
- except: pass
- return "ssh108_t2_scan"
+ def terrestrialTransponderGetCmd(self, nim_idx):
+ global terrestrial_autoscan_nimtype
+ try:
+ nim_name = nimmanager.getNimName(nim_idx)
+ if nim_name is not None and nim_name != "":
+ device_id = ""
+ nim_name = nim_name.split(' ')[-1][4:-1]
+ if nim_name == 'TT3L10':
+ try:
+ device_id = GetDeviceId('TT3L10', nimIdx)
+ device_id = "--device %s" % (device_id)
+ except: device_id = ""
+ if device_id == "":
+ return "ssh108_t2_scan"
+# print nimIdx, nim_name, terrestrial_autoscan_nimtype[nim_name], device_id
+ try:
+ command = "%s %s" % (terrestrial_autoscan_nimtype[nim_name], device_id)
+ return command
+ except: pass
+ except Exception, err:
+ print "terrestrialTransponderGetCmd ->", err
+ return ""
+ def startTerrestrialTransponderSearch(self, nim_idx, region):
if not self.tryGetRawFrontend(nim_idx):
self.session.nav.stopService()
if not self.tryGetRawFrontend(nim_idx):
self.terrestrial_search_container.appClosed.append(self.terrestrialTransponderSearchClosed)
self.terrestrial_search_container.dataAvail.append(self.getTerrestrialTransponderData)
- self.terrestrial_search_binName = GetCommand(nim_idx)
+ self.terrestrial_search_binName = self.terrestrialTransponderGetCmd(nim_idx)
self.terrestrial_search_bus = nimmanager.getI2CDevice(nim_idx)
if self.terrestrial_search_bus is None:
- print "ERROR: could not get I2C device for nim", nim_idx, "for terrestrial transponder search"
+# print "ERROR: could not get I2C device for nim", nim_idx, "for terrestrial transponder search"
self.terrestrial_search_bus = 2
self.terrestrial_search_list = []
plpid = self.scan_ter.plp_id.value)
removeAll = False
elif self.scan_typeterrestrial.value == "complete":
- getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(index_to_scan))
+ skip_t2 = True
if nim.isCompatible("DVB-T2"):
- action = SEARCH_TERRESTRIAL2_TRANSPONDERS
+ scan_util = len(self.terrestrialTransponderGetCmd(self.feid)) and True or False
+ if scan_util:
+ action = SEARCH_TERRESTRIAL2_TRANSPONDERS
+ else:
+ skip_t2 = False
+
+ getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(index_to_scan), skip_t2)
flags = self.scan_networkScan.value and eComponentScan.scanNetworkSearch or 0
if nim.isCompatible("DVB-S"):
networks = nimmanager.getSatListForNim(nim.slot)
elif not nim.empty:
- networks = [ nim.type ] # "DVB-C" or "DVB-T". TODO: seperate networks for different C/T tuners, if we want to support that.
+ networks = [ nim.getType() ] # "DVB-C" or "DVB-T". TODO: seperate networks for different C/T tuners, if we want to support that.
else:
# empty tuners provide no networks.
networks = [ ]
if "DVB-T2" in known_networks: # we need to remove "DVB-T" when networks have "DVB-T2"
nims_dvb_t = []
for nim in nims_to_scan:
- if nim.type == "DVB-T":
+ if nim.getType() == "DVB-T":
nims_dvb_t.append(nim)
for nim in nims_dvb_t:
else:
action = SEARCH_CABLE_TRANSPONDERS
elif nim.isCompatible("DVB-T"):
- getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(nim.slot))
+ skip_t2 = True
if nim.isCompatible("DVB-T2"):
- action = SEARCH_TERRESTRIAL2_TRANSPONDERS
+ scan_util = len(self.terrestrialTransponderGetCmd(nim.slot)) and True or False
+ if scan_util:
+ action = SEARCH_TERRESTRIAL2_TRANSPONDERS
+ else:
+ skip_t2 = False
+ getInitialTerrestrialTransponderList(tlist, nimmanager.getTerrestrialDescription(nim.slot), skip_t2)
else:
assert False