X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/b2eebd0fef155a40a8a74468c4488cfb0c656a9a..1c6c579ff6302c3301eb21bd0933d5ede824a384:/lib/dvb/frontend.cpp diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index b6e5e8ab..05f354e9 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -125,6 +125,7 @@ void eDVBFrontendParametersSatellite::set(const SatelliteDeliverySystemDescripto if ( fec != FEC::fNone && fec > FEC::f9_10 ) fec = FEC::fAuto; inversion = Inversion::Unknown; + pilot = Pilot::Unknown; orbital_position = ((descriptor.getOrbitalPosition() >> 12) & 0xF) * 1000; orbital_position += ((descriptor.getOrbitalPosition() >> 8) & 0xF) * 100; orbital_position += ((descriptor.getOrbitalPosition() >> 4) & 0xF) * 10; @@ -138,16 +139,16 @@ void eDVBFrontendParametersSatellite::set(const SatelliteDeliverySystemDescripto eDebug("satellite_delivery_descriptor non valid modulation type.. force QPSK"); modulation=QPSK; } - roll_off = descriptor.getRollOff(); + rolloff = descriptor.getRollOff(); if (system == System::DVB_S2) { - eDebug("SAT DVB-S2 freq %d, %s, pos %d, sr %d, fec %d, modulation %d, roll_off %d", + eDebug("SAT DVB-S2 freq %d, %s, pos %d, sr %d, fec %d, modulation %d, rolloff %d", frequency, polarisation ? "hor" : "vert", orbital_position, symbol_rate, fec, modulation, - roll_off); + rolloff); } else { @@ -371,9 +372,42 @@ RESULT eDVBFrontendParameters::getHash(unsigned long &hash) const } case iDVBFrontend::feCable: hash = 0xFFFF0000; + hash |= (cable.frequency/1000)&0xFFFF; return 0; case iDVBFrontend::feTerrestrial: hash = 0xEEEE0000; + hash |= (terrestrial.frequency/1000)&0xFFFF; + return 0; + default: + return -1; + } +} + +RESULT eDVBFrontendParameters::calcLockTimeout(unsigned int &timeout) const +{ + switch (m_type) + { + case iDVBFrontend::feSatellite: + { + /* high symbol rate transponders tune faster, due to + requiring less zigzag and giving more symbols faster. + + 5s are definitely not enough on really low SR when + zigzag has to find the exact frequency first. + */ + if (sat.symbol_rate > 20000000) + timeout = 5000; + else if (sat.symbol_rate > 10000000) + timeout = 10000; + else + timeout = 20000; + return 0; + } + case iDVBFrontend::feCable: + timeout = 5000; + return 0; + case iDVBFrontend::feTerrestrial: + timeout = 5000; return 0; default: return -1; @@ -382,9 +416,11 @@ RESULT eDVBFrontendParameters::getHash(unsigned long &hash) const DEFINE_REF(eDVBFrontend); +int eDVBFrontend::PriorityOrder=0; + eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok) - :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) + :m_enabled(false), m_type(-1), m_dvbid(fe), m_slotid(fe) + ,m_fd(-1), m_need_rotor_workaround(false), m_sn(0), m_timeout(0), m_tuneTimer(0) #if HAVE_DVB_API_VERSION < 3 ,m_secfd(-1) #endif @@ -419,17 +455,6 @@ int eDVBFrontend::openFrontend() m_tuning=0; #if HAVE_DVB_API_VERSION < 3 - if (m_secfd < 0) - { - m_secfd = ::open(m_sec_filename, O_RDWR); - if (m_secfd < 0) - { - eWarning("failed! (%s) %m", m_sec_filename); - return -1; - } - } - else - eWarning("sec %d already opened", m_dvbid); FrontendInfo fe_info; #else dvb_frontend_info fe_info; @@ -441,10 +466,6 @@ int eDVBFrontend::openFrontend() if (m_fd < 0) { eWarning("failed! (%s) %m", m_filename); -#if HAVE_DVB_API_VERSION < 3 - ::close(m_secfd); - m_secfd=-1; -#endif return -1; } } @@ -457,10 +478,6 @@ int eDVBFrontend::openFrontend() eWarning("ioctl FE_GET_INFO failed"); ::close(m_fd); m_fd = -1; -#if HAVE_DVB_API_VERSION < 3 - ::close(m_secfd); - m_secfd=-1; -#endif return -1; } @@ -479,15 +496,30 @@ int eDVBFrontend::openFrontend() eWarning("unknown frontend type."); ::close(m_fd); m_fd = -1; -#if HAVE_DVB_API_VERSION < 3 - ::close(m_secfd); - m_secfd=-1; -#endif return -1; } eDebug("detected %s frontend", "satellite\0cable\0 terrestrial"+fe_info.type*10); } +#if HAVE_DVB_API_VERSION < 3 + if (m_type == iDVBFrontend::feSatellite) + { + if (m_secfd < 0) + { + 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); + } +#endif + setTone(iDVBFrontend::toneOff); setVoltage(iDVBFrontend::voltageOff); @@ -508,7 +540,7 @@ int eDVBFrontend::closeFrontend() 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); + linked_fe->m_frontend->getData(LINKED_NEXT_PTR, (long&)linked_fe); } if (m_fd >= 0) { @@ -619,50 +651,66 @@ int eDVBFrontend::readFrontendData(int type) eDebug("FE_READ_BER failed (%m)"); return ber; } - case signalPower: + case signalQuality: { uint16_t snr=0; if (ioctl(m_fd, FE_READ_SNR, &snr) < 0 && errno != ERANGE) eDebug("FE_READ_SNR failed (%m)"); return snr; } - case signalPowerdB: /* this will move into the driver */ + case signalQualitydB: /* this will move into the driver */ { uint16_t snr=0; if (ioctl(m_fd, FE_READ_SNR, &snr) < 0 && errno != ERANGE) eDebug("FE_READ_SNR failed (%m)"); - unsigned int SDS_SNRE = snr << 16; - - static float SNR_COEFF[6] = { - 100.0 / 4194304.0, - -7136.0 / 4194304.0, - 197418.0 / 4194304.0, - -2602183.0 / 4194304.0, - 20377212.0 / 4194304.0, - -37791203.0 / 4194304.0, - }; + if (!strcmp(m_description, "BCM4501 (internal)")) + { + unsigned int SDS_SNRE = snr << 16; + + static float SNR_COEFF[6] = { + 100.0 / 4194304.0, + -7136.0 / 4194304.0, + 197418.0 / 4194304.0, + -2602183.0 / 4194304.0, + 20377212.0 / 4194304.0, + -37791203.0 / 4194304.0, + }; - float fval1, fval2, snr_in_db; - int i; - fval1 = 12.44714 - (2.0 * log10(SDS_SNRE / 256.0)); - fval2 = pow(10.0, fval1)-1; - fval1 = 10.0 * log10(fval2); + float fval1, fval2, snr_in_db; + int i; + fval1 = 12.44714 - (2.0 * log10(SDS_SNRE / 256.0)); + fval2 = pow(10.0, fval1)-1; + fval1 = 10.0 * log10(fval2); - if (fval1 < 10.0) - { - fval2 = SNR_COEFF[0]; - for (i=0; i<6; ++i) + if (fval1 < 10.0) { - fval2 *= fval1; - fval2 += SNR_COEFF[i]; + fval2 = SNR_COEFF[0]; + for (i=0; i<6; ++i) + { + fval2 *= fval1; + fval2 += SNR_COEFF[i]; + } + fval1 = fval2; } - fval1 = fval2; - } - snr_in_db = fval1; + snr_in_db = fval1; - return (int)(snr_in_db * 100.0); + return (int)(snr_in_db * 100.0); + } + else if (!strcmp(m_description, "Alps BSBE1 702A") || // some frontends with STV0299 + !strcmp(m_description, "Alps -S") || + !strcmp(m_description, "Philips -S") || + !strcmp(m_description, "LG -S") ) + { + float snr_in_db=(snr-39075)/1764.7; + return (int)(snr_in_db * 100.0); + } else if (!strcmp(m_description, "Alps BSBE2")) + { + return (int)((snr >> 7) * 10.0); + } /* else + eDebug("no SNR dB calculation for frontendtype %s yet", m_description); */ + return 0x12345678; } - case signalQuality: + case signalPower: { uint16_t strength=0; if (ioctl(m_fd, FE_READ_SIGNAL_STRENGTH, &strength) < 0 && errno != ERANGE) @@ -710,6 +758,18 @@ void PutToDict(ePyObject &dict, const char*key, long value) eDebug("could not create PyObject for %s", key); } +void PutToDict(ePyObject &dict, const char*key, ePyObject item) +{ + if (item) + { + if (PyDict_SetItemString(dict, key, item)) + eDebug("put %s to dict failed", key); + Py_DECREF(item); + } + else + eDebug("invalid PyObject for %s", key); +} + void PutToDict(ePyObject &dict, const char*key, const char *value) { ePyObject item = PyString_FromString(value); @@ -725,8 +785,8 @@ void PutToDict(ePyObject &dict, const char*key, const char *value) void fillDictWithSatelliteData(ePyObject dict, const FRONTENDPARAMETERS &parm, eDVBFrontend *fe) { - int freq_offset=0; - int csw=0; + long freq_offset=0; + long csw=0; const char *tmp=0; fe->getData(eDVBFrontend::CSW, csw); fe->getData(eDVBFrontend::FREQ_OFFSET, freq_offset); @@ -795,22 +855,61 @@ void fillDictWithSatelliteData(ePyObject dict, const FRONTENDPARAMETERS &parm, e break; #endif } + PutToDict(dict, "fec_inner", tmp); #if HAVE_DVB_API_VERSION >=3 PutToDict(dict, "modulation", parm_u_qpsk_fec_inner > FEC_S2_QPSK_9_10 ? "8PSK": "QPSK" ); + if (parm_u_qpsk_fec_inner > FEC_AUTO) + { + switch(parm_inversion & 0xc) + { + default: // unknown rolloff + case 0: // 0.35 + tmp = "ROLLOFF_0_35"; + break; + case 4: // 0.25 + tmp = "ROLLOFF_0_25"; + break; + case 8: // 0.20 + tmp = "ROLLOFF_0_20"; + break; + } + PutToDict(dict, "rolloff", tmp); + if (parm_u_qpsk_fec_inner > FEC_S2_QPSK_9_10) + { + switch(parm_inversion & 0x30) + { + case 0: // pilot off + tmp = "PILOT_OFF"; + break; + case 0x10: // pilot on + tmp = "PILOT_ON"; + break; + case 0x20: // pilot auto + tmp = "PILOT_AUTO"; + break; + } + PutToDict(dict, "pilot", tmp); + } + tmp = "DVB-S2"; + } + else + tmp = "DVB-S"; #else PutToDict(dict, "modulation", "QPSK" ); + tmp = "DVB-S"; #endif - PutToDict(dict, "fec_inner", tmp); - tmp = parm_u_qpsk_fec_inner > FEC_AUTO ? - "DVB-S2" : "DVB-S"; PutToDict(dict, "system", tmp); } void fillDictWithCableData(ePyObject dict, const FRONTENDPARAMETERS &parm) { const char *tmp=0; +#if HAVE_DVB_API_VERSION < 3 + PutToDict(dict, "frequency", parm_frequency); +#else PutToDict(dict, "frequency", parm_frequency/1000); +#endif PutToDict(dict, "symbol_rate", parm_u_qam_symbol_rate); switch(parm_u_qam_fec_inner) { @@ -1037,9 +1136,17 @@ void eDVBFrontend::getFrontendStatus(ePyObject dest) PutToDict(dest, "tuner_locked", readFrontendData(locked)); PutToDict(dest, "tuner_synced", readFrontendData(synced)); PutToDict(dest, "tuner_bit_error_rate", readFrontendData(bitErrorRate)); - PutToDict(dest, "tuner_signal_power", readFrontendData(signalPower)); - PutToDict(dest, "tuner_signal_power_db", readFrontendData(signalPowerdB)); PutToDict(dest, "tuner_signal_quality", readFrontendData(signalQuality)); + int sigQualitydB = readFrontendData(signalQualitydB); + if (sigQualitydB == 0x12345678) // not support yet + { + ePyObject obj=Py_None; + Py_INCREF(obj); + PutToDict(dest, "tuner_signal_quality_db", obj); + } + else + PutToDict(dest, "tuner_signal_quality_db", sigQualitydB); + PutToDict(dest, "tuner_signal_power", readFrontendData(signalPower)); } } @@ -1125,21 +1232,34 @@ void eDVBFrontend::getFrontendData(ePyObject dest) int eDVBFrontend::readInputpower() { 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); - if (fp < 0) + char proc_name[64]; + sprintf(proc_name, "/proc/stb/fp/lnb_sense%d", m_slotid); + FILE *f=fopen(proc_name, "r"); + if (f) { - eDebug("couldn't open fp"); - return -1; + if (fscanf(f, "%08x", &power) != 1) + eDebug("read %s failed!! (%m)", proc_name); + else + eDebug("%s is %d\n", proc_name, power); + fclose(f); } - static bool old_fp = (::ioctl(fp, FP_IOCTL_GET_ID) < 0); - if ( ioctl( fp, old_fp ? 9 : 0x100, &power ) < 0 ) + else { - eDebug("FP_IOCTL_GET_LNB_CURRENT failed (%m)"); - return -1; + // open front prozessor + int fp=::open("/dev/dbox/fp0", O_RDWR); + if (fp < 0) + { + eDebug("couldn't open fp"); + return -1; + } + static bool old_fp = (::ioctl(fp, FP_IOCTL_GET_ID) < 0); + if ( ioctl( fp, old_fp ? 9 : 0x100, &power ) < 0 ) + { + eDebug("FP_IOCTL_GET_LNB_CURRENT failed (%m)"); + return -1; + } + ::close(fp); } - ::close(fp); return power; } @@ -1164,6 +1284,35 @@ bool eDVBFrontend::setSecSequencePos(int steps) return true; } +void eDVBFrontend::setRotorData(int pos, int cmd) +{ + m_data[ROTOR_CMD] = cmd; + m_data[ROTOR_POS] = pos; + if ( m_data[SATPOS_DEPENDS_PTR] != -1 ) + { + eDVBRegisteredFrontend *satpos_depends_to_fe = (eDVBRegisteredFrontend*) m_data[SATPOS_DEPENDS_PTR]; + satpos_depends_to_fe->m_frontend->m_data[ROTOR_CMD] = cmd; + satpos_depends_to_fe->m_frontend->m_data[ROTOR_POS] = pos; + } + else + { + eDVBRegisteredFrontend *next = (eDVBRegisteredFrontend *)m_data[LINKED_NEXT_PTR]; + while ( (long)next != -1 ) + { + next->m_frontend->m_data[ROTOR_CMD] = cmd; + next->m_frontend->m_data[ROTOR_POS] = pos; + next = (eDVBRegisteredFrontend *)next->m_frontend->m_data[LINKED_NEXT_PTR]; + } + eDVBRegisteredFrontend *prev = (eDVBRegisteredFrontend *)m_data[LINKED_PREV_PTR]; + while ( (long)prev != -1 ) + { + prev->m_frontend->m_data[ROTOR_CMD] = cmd; + prev->m_frontend->m_data[ROTOR_POS] = pos; + prev = (eDVBRegisteredFrontend *)prev->m_frontend->m_data[LINKED_PREV_PTR]; + } + } +} + void eDVBFrontend::tuneLoop() // called by m_tuneTimer { int delay=0; @@ -1241,9 +1390,11 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer ++m_sec_sequence.current(); break; case eSecCommand::START_TUNE_TIMEOUT: - m_timeout->start(5000, 1); // 5 sec timeout. TODO: symbolrate dependent + { + m_timeout->start(m_sec_sequence.current()->timeout, 1); ++m_sec_sequence.current(); break; + } case eSecCommand::SET_TIMEOUT: m_timeoutCount = m_sec_sequence.current()++->val; eDebug("[SEC] set timeout %d", m_timeoutCount); @@ -1359,14 +1510,13 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer ++m_sec_sequence.current(); break; case eSecCommand::INVALIDATE_CURRENT_ROTORPARMS: - m_data[ROTOR_CMD] = m_data[ROTOR_POS] = -1; eDebug("[SEC] invalidate current rotorparams"); + setRotorData(-1,-1); ++m_sec_sequence.current(); break; case eSecCommand::UPDATE_CURRENT_ROTORPARAMS: - m_data[ROTOR_CMD] = m_data[NEW_ROTOR_CMD]; - m_data[ROTOR_POS] = m_data[NEW_ROTOR_POS]; - eDebug("[SEC] update current rotorparams %d %04x %d", m_timeoutCount, m_data[5], m_data[6]); + setRotorData(m_data[NEW_ROTOR_POS], m_data[NEW_ROTOR_CMD]); + eDebug("[SEC] update current rotorparams %d %04lx %ld", m_timeoutCount, m_data[ROTOR_CMD], m_data[ROTOR_POS]); ++m_sec_sequence.current(); break; case eSecCommand::SET_ROTOR_DISEQC_RETRYS: @@ -1384,37 +1534,37 @@ void eDVBFrontend::tuneLoop() // called by m_tuneTimer break; case eSecCommand::SET_POWER_LIMITING_MODE: { - 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); - if(::read(fd, data, 1) != 1) - eDebug("[SEC] error read lnbp (%m)"); - if ( m_sec_sequence.current()->mode == eSecCommand::modeStatic ) + if (m_need_rotor_workaround) { - data[0] |= 0x80; // enable static current limiting - eDebug("[SEC] set static current limiting"); - } - else - { - data[0] &= ~0x80; // enable dynamic current limiting - eDebug("[SEC] set dynamic current limiting"); + 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); + if(::read(fd, data, 1) != 1) + eDebug("[SEC] error read lnbp (%m)"); + if ( m_sec_sequence.current()->mode == eSecCommand::modeStatic ) + { + data[0] |= 0x80; // enable static current limiting + eDebug("[SEC] set static current limiting"); + } + else + { + data[0] &= ~0x80; // enable dynamic current limiting + eDebug("[SEC] set dynamic current limiting"); + } + if(::write(fd, data, 1) != 1) + eDebug("[SEC] error write lnbp (%m)"); + ::close(fd); } - if(::write(fd, data, 1) != 1) - eDebug("[SEC] error write lnbp (%m)"); - ::close(fd); ++m_sec_sequence.current(); break; } @@ -1447,7 +1597,7 @@ RESULT eDVBFrontend::getFrontendType(int &t) return 0; } -RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm) +RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm, unsigned int tunetimeout) { int res; if (!m_sec) @@ -1455,7 +1605,7 @@ RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm) eWarning("no SEC module active!"); return -ENOENT; } - res = m_sec->prepare(*this, parm, feparm, 1 << m_slotid); + res = m_sec->prepare(*this, parm, feparm, 1 << m_slotid, tunetimeout); if (!res) { eDebug("prepare_sat System %d Freq %d Pol %d SR %d INV %d FEC %d orbpos %d", @@ -1543,9 +1693,12 @@ RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm) eDebug("no valid fec for DVB-S2 set.. abort !!"); return -EINVAL; } - if (feparm.modulation == eDVBFrontendParametersSatellite::Modulation::M8PSK) + parm_inversion |= (feparm.rolloff << 2); // Hack.. we use bit 2..3 of inversion param for rolloff + if (feparm.modulation == eDVBFrontendParametersSatellite::Modulation::M8PSK) { parm_u_qpsk_fec_inner = (fe_code_rate_t)((int)parm_u_qpsk_fec_inner+9); // 8PSK fec driver values are decimal 9 bigger + parm_inversion |= (feparm.pilot << 4); // Hack.. we use bit 4..5 of inversion param for pilot + } } #endif // FIXME !!! get frequency range from tuner @@ -1561,7 +1714,11 @@ RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm) RESULT eDVBFrontend::prepare_cable(const eDVBFrontendParametersCable &feparm) { +#if HAVE_DVB_API_VERSION < 3 + parm_frequency = feparm.frequency; +#else parm_frequency = feparm.frequency * 1000; +#endif parm_u_qam_symbol_rate = feparm.symbol_rate; switch (feparm.modulation) { @@ -1786,6 +1943,7 @@ RESULT eDVBFrontend::prepare_terrestrial(const eDVBFrontendParametersTerrestrial RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) { + unsigned int timeout = 5000; eDebug("(%d)tune", m_dvbid); m_timeout->stop(); @@ -1808,6 +1966,8 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) m_sn->stop(); m_sec_sequence.clear(); + where.calcLockTimeout(timeout); + switch (m_type) { case feSatellite: @@ -1820,7 +1980,7 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) goto tune_error; } m_sec->setRotorMoving(false); - res=prepare_sat(feparm); + res=prepare_sat(feparm, timeout); if (res) goto tune_error; @@ -1838,7 +1998,7 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) if (res) goto tune_error; - m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) ); + m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT, timeout) ); m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); break; } @@ -1858,7 +2018,7 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) std::string enable_5V; char configStr[255]; snprintf(configStr, 255, "config.Nims.%d.terrestrial_5V", m_slotid); - m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) ); + m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT, timeout) ); ePythonConfigQuery::getConfigValue(configStr, enable_5V); if (enable_5V == "True") m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) ); @@ -2038,7 +2198,7 @@ RESULT eDVBFrontend::setSecSequence(const eSecCommandList &list) return 0; } -RESULT eDVBFrontend::getData(int num, int &data) +RESULT eDVBFrontend::getData(int num, long &data) { if ( num < NUM_DATA_ENTRIES ) { @@ -2048,7 +2208,7 @@ RESULT eDVBFrontend::getData(int num, int &data) return -EINVAL; } -RESULT eDVBFrontend::setData(int num, int val) +RESULT eDVBFrontend::setData(int num, long val) { if ( num < NUM_DATA_ENTRIES ) { @@ -2061,7 +2221,7 @@ RESULT eDVBFrontend::setData(int num, int val) int eDVBFrontend::isCompatibleWith(ePtr &feparm) { int type; - if (feparm->getSystem(type) || type != m_type) + if (feparm->getSystem(type) || type != m_type || !m_enabled) return 0; if (m_type == eDVBFrontend::feSatellite) @@ -2077,25 +2237,28 @@ int eDVBFrontend::isCompatibleWith(ePtr &feparm) return 1; } -void eDVBFrontend::setSlotInfo(ePyObject obj) +bool eDVBFrontend::setSlotInfo(ePyObject obj) { - ePyObject Id, Descr; - if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 2) + ePyObject Id, Descr, Enabled; + if (!PyTuple_Check(obj) || PyTuple_Size(obj) != 3) goto arg_error; Id = PyTuple_GET_ITEM(obj, 0); Descr = PyTuple_GET_ITEM(obj, 1); - if (!PyInt_Check(Id) || !PyString_Check(Descr)) + Enabled = PyTuple_GET_ITEM(obj, 2); + if (!PyInt_Check(Id) || !PyString_Check(Descr) || !PyBool_Check(Enabled)) goto arg_error; strcpy(m_description, PyString_AS_STRING(Descr)); m_slotid = PyInt_AsLong(Id); - + 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") || !!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; + m_need_rotor_workaround = !!strstr(m_description, "Alps BSBE1") || + !!strstr(m_description, "Alps BSBE2") || + !!strstr(m_description, "Alps -S"); + eDebug("setSlotInfo for dvb frontend %d to slotid %d, descr %s, need rotorworkaround %s, enabled %s", + m_dvbid, m_slotid, m_description, m_need_rotor_workaround ? "Yes" : "No", m_enabled ? "Yes" : "No" ); + return true; arg_error: PyErr_SetString(PyExc_StandardError, - "eDVBFrontend::setSlotInfo must get a tuple with first param slotid and second param slot description"); + "eDVBFrontend::setSlotInfo must get a tuple with first param slotid, second param slot description and third param enabled boolean"); + return false; }