X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/e0869a9a7cea4a578686be886d8c73ee3052e6c1..40d11af2de7aed77c90970ba2b61dd754a225117:/lib/dvb/frontend.cpp diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 237bee20..5d991a47 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -17,8 +17,8 @@ #define BANDWIDTH_AUTO (BandWidth)3 #define GUARD_INTERVAL_AUTO (GuardInterval)4 #define HIERARCHY_AUTO (Hierarchy)4 -#define parm_frequency parm_Frequency -#define parm_inversion parm_Inversion +#define parm_frequency parm.Frequency +#define parm_inversion parm.Inversion #define parm_u_qpsk_symbol_rate parm.u.qpsk.SymbolRate #define parm_u_qpsk_fec_inner parm.u.qpsk.FEC_inner #define parm_u_qam_symbol_rate parm.u.qam.SymbolRate @@ -53,6 +53,16 @@ #include #include +void eDVBDiseqcCommand::setCommandString(const char *str) +{ + if (!str) + return; + len = strlen(str); + if (len > MAX_DISEQC_LENGTH) + len = MAX_DISEQC_LENGTH; + memcpy(data, str, len); +} + void eDVBFrontendParametersSatellite::set(const SatelliteDeliverySystemDescriptor &descriptor) { frequency = descriptor.getFrequency() * 10; @@ -559,25 +569,25 @@ void fillDictWithSatelliteData(PyObject *dict, const FRONTENDPARAMETERS &parm, e switch(parm_u_qpsk_fec_inner) { - case FEC_1_2: - fec = "FEC_1_2"; - break; - case FEC_2_3: - fec = "FEC_2_3"; - break; - case FEC_3_4: - fec = "FEC_3_4"; - break; - case FEC_5_6: - fec = "FEC_5_6"; - break; - case FEC_7_8: - fec = "FEC_7_8"; - break; - default: - case FEC_AUTO: - fec = "FEC_AUTO"; - break; + case FEC_1_2: + fec = "FEC_1_2"; + break; + case FEC_2_3: + fec = "FEC_2_3"; + break; + case FEC_3_4: + fec = "FEC_3_4"; + break; + case FEC_5_6: + fec = "FEC_5_6"; + break; + case FEC_7_8: + fec = "FEC_7_8"; + break; + default: + case FEC_AUTO: + fec = "FEC_AUTO"; + break; } PutToDict(dict, "fec_inner", fec); } @@ -607,9 +617,11 @@ void fillDictWithCableData(PyObject *dict, const FRONTENDPARAMETERS &parm) case FEC_7_8: tmp = "FEC_7_8"; break; +#if HAVE_DVB_API_VERSION >= 3 case FEC_8_9: tmp = "FEC_8_9"; break; +#endif default: case FEC_AUTO: tmp = "FEC_AUTO"; @@ -645,15 +657,134 @@ void fillDictWithTerrestrialData(PyObject *dict, const FRONTENDPARAMETERS &parm) { const char *tmp=0; PutToDict(dict, "frequency", parm_frequency); -/* -#define parm_u_ofdm_bandwidth parm_u_ofdm_bandWidth -#define parm_u_ofdm_code_rate_LP parm_u_ofdm_LP_CodeRate -#define parm_u_ofdm_code_rate_HP parm_u_ofdm_HP_CodeRate -#define parm_u_ofdm_constellation parm_u_ofdm_Constellation -#define parm_u_ofdm_transmission_mode parm_u_ofdm_TransmissionMode -#define parm_u_ofdm_guard_interval parm_u_ofdm_guardInterval -#define parm_u_ofdm_hierarchy_information parm_u_ofdm_HierarchyInformation -*/ + switch (parm_u_ofdm_bandwidth) + { + case BANDWIDTH_8_MHZ: + tmp = "BANDWIDTH_8_MHZ"; + break; + case BANDWIDTH_7_MHZ: + tmp = "BANDWIDTH_7_MHZ"; + break; + case BANDWIDTH_6_MHZ: + tmp = "BANDWIDTH_6_MHZ"; + break; + default: + case BANDWIDTH_AUTO: + tmp = "BANDWIDTH_AUTO"; + break; + } + PutToDict(dict, "bandwidth", tmp); + switch (parm_u_ofdm_code_rate_LP) + { + case FEC_1_2: + tmp = "FEC_1_2"; + break; + case FEC_2_3: + tmp = "FEC_2_3"; + break; + case FEC_3_4: + tmp = "FEC_3_4"; + break; + case FEC_5_6: + tmp = "FEC_5_6"; + break; + case FEC_7_8: + tmp = "FEC_7_8"; + break; + default: + case FEC_AUTO: + tmp = "FEC_AUTO"; + break; + } + PutToDict(dict, "code_rate_lp", tmp); + switch (parm_u_ofdm_code_rate_HP) + { + case FEC_1_2: + tmp = "FEC_1_2"; + break; + case FEC_2_3: + tmp = "FEC_2_3"; + break; + case FEC_3_4: + tmp = "FEC_3_4"; + break; + case FEC_5_6: + tmp = "FEC_5_6"; + break; + case FEC_7_8: + tmp = "FEC_7_8"; + break; + default: + case FEC_AUTO: + tmp = "FEC_AUTO"; + break; + } + PutToDict(dict, "code_rate_hp", tmp); + switch (parm_u_ofdm_constellation) + { + case QPSK: + tmp = "QPSK"; + break; + case QAM_16: + tmp = "QAM_16"; + break; + default: + case QAM_AUTO: + tmp = "QAM_AUTO"; + break; + } + PutToDict(dict, "constellation", tmp); + switch (parm_u_ofdm_transmission_mode) + { + case TRANSMISSION_MODE_2K: + tmp = "TRANSMISSION_MODE_2K"; + break; + case TRANSMISSION_MODE_8K: + tmp = "TRANSMISSION_MODE_8K"; + break; + default: + case TRANSMISSION_MODE_AUTO: + tmp = "TRANSMISSION_MODE_AUTO"; + break; + } + PutToDict(dict, "transmission_mode", tmp); + switch (parm_u_ofdm_guard_interval) + { + case GUARD_INTERVAL_1_32: + tmp = "GUARD_INTERVAL_1_32"; + break; + case GUARD_INTERVAL_1_16: + tmp = "GUARD_INTERVAL_1_16"; + break; + case GUARD_INTERVAL_1_8: + tmp = "GUARD_INTERVAL_1_8"; + break; + case GUARD_INTERVAL_1_4: + tmp = "GUARD_INTERVAL_1_4"; + break; + default: + case GUARD_INTERVAL_AUTO: + tmp = "GUARD_INTERVAL_AUTO"; + break; + } + PutToDict(dict, "guard_interval", tmp); + switch (parm_u_ofdm_hierarchy_information) + { + case HIERARCHY_1: + tmp = "HIERARCHY_1"; + break; + case HIERARCHY_2: + tmp = "HIERARCHY_2"; + break; + case HIERARCHY_4: + tmp = "HIERARCHY_4"; + break; + default: + case HIERARCHY_AUTO: + tmp = "HIERARCHY_AUTO"; + break; + } + PutToDict(dict, "hierarchy_information", tmp); } PyObject *eDVBFrontend::readTransponderData(bool original) @@ -1108,6 +1239,12 @@ RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm) parm_u_qpsk_fec_inner = FEC_7_8; break; } + // FIXME !!! get frequency range from tuner + if ( parm_frequency < 900000 || parm_frequency > 2200000 ) + { + eDebug("%d mhz out of tuner range.. dont tune", parm_frequency/1000); + return -EINVAL; + } eDebug("tuning to %d mhz", parm_frequency/1000); } return res; @@ -1172,9 +1309,11 @@ RESULT eDVBFrontend::prepare_cable(const eDVBFrontendParametersCable &feparm) case eDVBFrontendParametersCable::FEC::f7_8: parm_u_qam_fec_inner = FEC_7_8; break; +#if HAVE_DVB_API_VERSION >= 3 case eDVBFrontendParametersCable::FEC::f8_9: parm_u_qam_fec_inner = FEC_8_9; break; +#endif default: case eDVBFrontendParametersCable::FEC::fAuto: parm_u_qam_fec_inner = FEC_AUTO; @@ -1205,47 +1344,45 @@ RESULT eDVBFrontend::prepare_terrestrial(const eDVBFrontendParametersTerrestrial } switch (feparm.code_rate_LP) { - case eDVBFrontendParametersCable::FEC::f1_2: + case eDVBFrontendParametersTerrestrial::FEC::f1_2: parm_u_ofdm_code_rate_LP = FEC_1_2; break; - case eDVBFrontendParametersCable::FEC::f2_3: + case eDVBFrontendParametersTerrestrial::FEC::f2_3: parm_u_ofdm_code_rate_LP = FEC_2_3; break; - case eDVBFrontendParametersCable::FEC::f3_4: + case eDVBFrontendParametersTerrestrial::FEC::f3_4: parm_u_ofdm_code_rate_LP = FEC_3_4; break; - case eDVBFrontendParametersCable::FEC::f5_6: + case eDVBFrontendParametersTerrestrial::FEC::f5_6: parm_u_ofdm_code_rate_LP = FEC_5_6; break; - case eDVBFrontendParametersCable::FEC::f7_8: + case eDVBFrontendParametersTerrestrial::FEC::f7_8: parm_u_ofdm_code_rate_LP = FEC_7_8; break; default: - case eDVBFrontendParametersCable::FEC::fAuto: - case eDVBFrontendParametersCable::FEC::fNone: + case eDVBFrontendParametersTerrestrial::FEC::fAuto: parm_u_ofdm_code_rate_LP = FEC_AUTO; break; } switch (feparm.code_rate_HP) { - case eDVBFrontendParametersCable::FEC::f1_2: + case eDVBFrontendParametersTerrestrial::FEC::f1_2: parm_u_ofdm_code_rate_HP = FEC_1_2; break; - case eDVBFrontendParametersCable::FEC::f2_3: + case eDVBFrontendParametersTerrestrial::FEC::f2_3: parm_u_ofdm_code_rate_HP = FEC_2_3; break; - case eDVBFrontendParametersCable::FEC::f3_4: + case eDVBFrontendParametersTerrestrial::FEC::f3_4: parm_u_ofdm_code_rate_HP = FEC_3_4; break; - case eDVBFrontendParametersCable::FEC::f5_6: + case eDVBFrontendParametersTerrestrial::FEC::f5_6: parm_u_ofdm_code_rate_HP = FEC_5_6; break; - case eDVBFrontendParametersCable::FEC::f7_8: + case eDVBFrontendParametersTerrestrial::FEC::f7_8: parm_u_ofdm_code_rate_HP = FEC_7_8; break; default: - case eDVBFrontendParametersCable::FEC::fAuto: - case eDVBFrontendParametersCable::FEC::fNone: + case eDVBFrontendParametersTerrestrial::FEC::fAuto: parm_u_ofdm_code_rate_HP = FEC_AUTO; break; } @@ -1317,6 +1454,8 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) { eDebug("(%d)tune", m_fe); + m_timeout->stop(); + int res=0; if (m_type == -1) @@ -1346,7 +1485,10 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) return -EINVAL; res=prepare_cable(feparm); if (!res) + { + m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) ); m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); + } break; } case feTerrestrial: @@ -1359,7 +1501,10 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) } res=prepare_terrestrial(feparm); if (!res) + { + m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) ); m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); + } break; } } @@ -1367,7 +1512,6 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where) if (!res) // prepare ok { m_tuneTimer->start(0,true); - m_timeout->stop(); m_sec_sequence.current() = m_sec_sequence.begin(); if (m_state != stateTuning)