1 #include <lib/dvb/dvb.h>
2 #include <lib/base/eerror.h>
8 #ifndef I2C_SLAVE_FORCE
9 #define I2C_SLAVE_FORCE 0x0706
12 #if HAVE_DVB_API_VERSION < 3
13 #include <ost/frontend.h>
15 #define QAM_AUTO (Modulation)6
16 #define TRANSMISSION_MODE_AUTO (TransmitMode)2
17 #define BANDWIDTH_AUTO (BandWidth)3
18 #define GUARD_INTERVAL_AUTO (GuardInterval)4
19 #define HIERARCHY_AUTO (Hierarchy)4
20 #define parm_frequency parm.Frequency
21 #define parm_inversion parm.Inversion
22 #define parm_u_qpsk_symbol_rate parm.u.qpsk.SymbolRate
23 #define parm_u_qpsk_fec_inner parm.u.qpsk.FEC_inner
24 #define parm_u_qam_symbol_rate parm.u.qam.SymbolRate
25 #define parm_u_qam_fec_inner parm.u.qam.FEC_inner
26 #define parm_u_qam_modulation parm.u.qam.QAM
27 #define parm_u_ofdm_bandwidth parm.u.ofdm.bandWidth
28 #define parm_u_ofdm_code_rate_LP parm.u.ofdm.LP_CodeRate
29 #define parm_u_ofdm_code_rate_HP parm.u.ofdm.HP_CodeRate
30 #define parm_u_ofdm_constellation parm.u.ofdm.Constellation
31 #define parm_u_ofdm_transmission_mode parm.u.ofdm.TransmissionMode
32 #define parm_u_ofdm_guard_interval parm.u.ofdm.guardInterval
33 #define parm_u_ofdm_hierarchy_information parm.u.ofdm.HierarchyInformation
35 #include <linux/dvb/frontend.h>
36 #define parm_frequency parm.frequency
37 #define parm_inversion parm.inversion
38 #define parm_u_qpsk_symbol_rate parm.u.qpsk.symbol_rate
39 #define parm_u_qpsk_fec_inner parm.u.qpsk.fec_inner
40 #define parm_u_qam_symbol_rate parm.u.qam.symbol_rate
41 #define parm_u_qam_fec_inner parm.u.qam.fec_inner
42 #define parm_u_qam_modulation parm.u.qam.modulation
43 #define parm_u_ofdm_bandwidth parm.u.ofdm.bandwidth
44 #define parm_u_ofdm_code_rate_LP parm.u.ofdm.code_rate_LP
45 #define parm_u_ofdm_code_rate_HP parm.u.ofdm.code_rate_HP
46 #define parm_u_ofdm_constellation parm.u.ofdm.constellation
47 #define parm_u_ofdm_transmission_mode parm.u.ofdm.transmission_mode
48 #define parm_u_ofdm_guard_interval parm.u.ofdm.guard_interval
49 #define parm_u_ofdm_hierarchy_information parm.u.ofdm.hierarchy_information
51 #warning "FEC_9_10 already exist in dvb api ... it seems it is now ready for DVB-S2"
53 #define FEC_S2_1_2 (fe_code_rate_t)(FEC_AUTO+1)
54 #define FEC_S2_2_3 (fe_code_rate_t)(FEC_S2_1_2+1)
55 #define FEC_S2_3_4 (fe_code_rate_t)(FEC_S2_2_3+1)
56 #define FEC_S2_5_6 (fe_code_rate_t)(FEC_S2_3_4+1)
57 #define FEC_S2_7_8 (fe_code_rate_t)(FEC_S2_5_6+1)
58 #define FEC_S2_8_9 (fe_code_rate_t)(FEC_S2_7_8+1)
59 #define FEC_S2_3_5 (fe_code_rate_t)(FEC_S2_8_9+1)
60 #define FEC_S2_4_5 (fe_code_rate_t)(FEC_S2_3_5+1)
61 #define FEC_S2_9_10 (fe_code_rate_t)(FEC_S2_4_5+1)
65 #include <dvbsi++/satellite_delivery_system_descriptor.h>
66 #include <dvbsi++/cable_delivery_system_descriptor.h>
67 #include <dvbsi++/terrestrial_delivery_system_descriptor.h>
69 void eDVBDiseqcCommand::setCommandString(const char *str)
74 int slen = strlen(str);
77 eDebug("invalid diseqc command string length (not 2 byte aligned)");
80 if (slen > MAX_DISEQC_LENGTH*2)
82 eDebug("invalid diseqc command string length (string is to long)");
86 for (int i=0; i < slen; ++i)
88 unsigned char c = str[i];
91 case '0' ... '9': c-=48; break;
92 case 'a' ... 'f': c-=87; break;
93 case 'A' ... 'F': c-=55; break;
95 eDebug("invalid character in hex string..ignore complete diseqc command !");
109 void eDVBFrontendParametersSatellite::set(const SatelliteDeliverySystemDescriptor &descriptor)
111 frequency = descriptor.getFrequency() * 10;
112 symbol_rate = descriptor.getSymbolRate() * 100;
113 polarisation = descriptor.getPolarization();
114 fec = descriptor.getFecInner();
115 if ( fec != FEC::fNone && fec > FEC::f9_10 )
117 inversion = Inversion::Unknown;
118 orbital_position = ((descriptor.getOrbitalPosition() >> 12) & 0xF) * 1000;
119 orbital_position += ((descriptor.getOrbitalPosition() >> 8) & 0xF) * 100;
120 orbital_position += ((descriptor.getOrbitalPosition() >> 4) & 0xF) * 10;
121 orbital_position += ((descriptor.getOrbitalPosition()) & 0xF);
122 if (orbital_position && (!descriptor.getWestEastFlag()))
123 orbital_position = 3600 - orbital_position;
124 system = descriptor.getModulationSystem();
125 modulation = descriptor.getModulation();
126 if (system == System::DVB_S && modulation == Modulation::M8PSK)
128 eDebug("satellite_delivery_descriptor non valid modulation type.. force QPSK");
131 roll_off = descriptor.getRollOff();
132 if (system == System::DVB_S2)
134 eDebug("SAT DVB-S2 freq %d, %s, pos %d, sr %d, fec %d, modulation %d, roll_off %d",
136 polarisation ? "hor" : "vert",
144 eDebug("SAT DVB-S freq %d, %s, pos %d, sr %d, fec %d",
146 polarisation ? "hor" : "vert",
152 void eDVBFrontendParametersCable::set(const CableDeliverySystemDescriptor &descriptor)
154 frequency = descriptor.getFrequency() / 10;
155 symbol_rate = descriptor.getSymbolRate() * 100;
156 fec_inner = descriptor.getFecInner();
157 if ( fec_inner == 0xF )
158 fec_inner = FEC::fNone;
159 modulation = descriptor.getModulation();
160 if ( modulation > 0x5 )
161 modulation = Modulation::Auto;
162 inversion = Inversion::Unknown;
163 eDebug("Cable freq %d, mod %d, sr %d, fec %d",
165 modulation, symbol_rate, fec_inner);
168 void eDVBFrontendParametersTerrestrial::set(const TerrestrialDeliverySystemDescriptor &descriptor)
170 frequency = descriptor.getCentreFrequency() * 10;
171 bandwidth = descriptor.getBandwidth();
172 if ( bandwidth > 2 ) // 5Mhz forced to auto
173 bandwidth = Bandwidth::BwAuto;
174 code_rate_HP = descriptor.getCodeRateHpStream();
175 if (code_rate_HP > 4)
176 code_rate_HP = FEC::fAuto;
177 code_rate_LP = descriptor.getCodeRateLpStream();
178 if (code_rate_LP > 4)
179 code_rate_LP = FEC::fAuto;
180 transmission_mode = descriptor.getTransmissionMode();
181 if (transmission_mode > 1) // TM4k forced to auto
182 transmission_mode = TransmissionMode::TMAuto;
183 guard_interval = descriptor.getGuardInterval();
184 if (guard_interval > 3)
185 guard_interval = GuardInterval::GI_Auto;
186 hierarchy = descriptor.getHierarchyInformation()&3;
187 modulation = descriptor.getConstellation();
189 modulation = Modulation::Auto;
190 inversion = Inversion::Unknown;
191 eDebug("Terr freq %d, bw %d, cr_hp %d, cr_lp %d, tm_mode %d, guard %d, hierarchy %d, const %d",
192 frequency, bandwidth, code_rate_HP, code_rate_LP, transmission_mode,
193 guard_interval, hierarchy, modulation);
196 eDVBFrontendParameters::eDVBFrontendParameters(): m_type(-1)
200 DEFINE_REF(eDVBFrontendParameters);
202 RESULT eDVBFrontendParameters::getSystem(int &t) const
210 RESULT eDVBFrontendParameters::getDVBS(eDVBFrontendParametersSatellite &p) const
212 if (m_type != iDVBFrontend::feSatellite)
218 RESULT eDVBFrontendParameters::getDVBC(eDVBFrontendParametersCable &p) const
220 if (m_type != iDVBFrontend::feCable)
226 RESULT eDVBFrontendParameters::getDVBT(eDVBFrontendParametersTerrestrial &p) const
228 if (m_type != iDVBFrontend::feTerrestrial)
234 RESULT eDVBFrontendParameters::setDVBS(const eDVBFrontendParametersSatellite &p, bool no_rotor_command_on_tune)
237 sat.no_rotor_command_on_tune = no_rotor_command_on_tune;
238 m_type = iDVBFrontend::feSatellite;
242 RESULT eDVBFrontendParameters::setDVBC(const eDVBFrontendParametersCable &p)
245 m_type = iDVBFrontend::feCable;
249 RESULT eDVBFrontendParameters::setDVBT(const eDVBFrontendParametersTerrestrial &p)
252 m_type = iDVBFrontend::feTerrestrial;
256 RESULT eDVBFrontendParameters::calculateDifference(const iDVBFrontendParameters *parm, int &diff) const
261 if (parm->getSystem(type))
265 diff = 1<<30; // big difference
271 case iDVBFrontend::feSatellite:
273 eDVBFrontendParametersSatellite osat;
274 if (parm->getDVBS(osat))
277 if (sat.orbital_position != osat.orbital_position)
279 else if (sat.polarisation != osat.polarisation)
283 diff = abs(sat.frequency - osat.frequency);
284 diff += abs(sat.symbol_rate - osat.symbol_rate);
288 case iDVBFrontend::feCable:
289 eDVBFrontendParametersCable ocable;
290 if (parm->getDVBC(ocable))
293 if (cable.modulation != ocable.modulation && cable.modulation != eDVBFrontendParametersCable::Modulation::Auto && ocable.modulation != eDVBFrontendParametersCable::Modulation::Auto)
295 else if (cable.inversion != ocable.inversion && cable.inversion != eDVBFrontendParametersCable::Inversion::Unknown && ocable.inversion != eDVBFrontendParametersCable::Inversion::Unknown)
299 diff = abs(cable.frequency - ocable.frequency);
300 diff += abs(cable.symbol_rate - ocable.symbol_rate);
304 case iDVBFrontend::feTerrestrial:
305 eDVBFrontendParametersTerrestrial oterrestrial;
306 if (parm->getDVBT(oterrestrial))
309 diff = abs(terrestrial.frequency - oterrestrial.frequency);
318 RESULT eDVBFrontendParameters::getHash(unsigned long &hash) const
322 case iDVBFrontend::feSatellite:
324 hash = (sat.orbital_position << 16);
325 hash |= ((sat.frequency/1000)&0xFFFF)|((sat.polarisation&1) << 15);
328 case iDVBFrontend::feCable:
331 case iDVBFrontend::feTerrestrial:
339 DEFINE_REF(eDVBFrontend);
341 eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok)
342 :m_type(-1), m_fe(fe), m_fd(-1), m_sn(0), m_timeout(0), m_tuneTimer(0)
343 #if HAVE_DVB_API_VERSION < 3
347 #if HAVE_DVB_API_VERSION < 3
348 sprintf(m_filename, "/dev/dvb/card%d/frontend%d", adap, fe);
349 sprintf(m_sec_filename, "/dev/dvb/card%d/sec%d", adap, fe);
351 sprintf(m_filename, "/dev/dvb/adapter%d/frontend%d", adap, fe);
353 m_timeout = new eTimer(eApp);
354 CONNECT(m_timeout->timeout, eDVBFrontend::timeout);
356 m_tuneTimer = new eTimer(eApp);
357 CONNECT(m_tuneTimer->timeout, eDVBFrontend::tuneLoop);
359 int entries = sizeof(m_data) / sizeof(int);
360 for (int i=0; i<entries; ++i)
363 m_idleInputpower[0]=m_idleInputpower[1]=0;
365 ok = !openFrontend();
369 int eDVBFrontend::openFrontend()
372 return -1; // already opened
377 #if HAVE_DVB_API_VERSION < 3
380 m_secfd = ::open(m_sec_filename, O_RDWR);
383 eWarning("failed! (%s) %m", m_sec_filename);
388 eWarning("sec %d already opened", m_fe);
389 FrontendInfo fe_info;
391 dvb_frontend_info fe_info;
393 eDebug("opening frontend %d", m_fe);
396 m_fd = ::open(m_filename, O_RDWR|O_NONBLOCK);
399 eWarning("failed! (%s) %m", m_filename);
400 #if HAVE_DVB_API_VERSION < 3
408 eWarning("frontend %d already opened", m_fe);
411 if (::ioctl(m_fd, FE_GET_INFO, &fe_info) < 0)
413 eWarning("ioctl FE_GET_INFO failed");
416 #if HAVE_DVB_API_VERSION < 3
423 switch (fe_info.type)
426 m_type = iDVBFrontend::feSatellite;
429 m_type = iDVBFrontend::feCable;
432 m_type = iDVBFrontend::feTerrestrial;
435 eWarning("unknown frontend type.");
438 #if HAVE_DVB_API_VERSION < 3
444 eDebug("detected %s frontend", "satellite\0cable\0 terrestrial"+fe_info.type*10);
447 setTone(iDVBFrontend::toneOff);
448 setVoltage(iDVBFrontend::voltageOff);
450 m_sn = new eSocketNotifier(eApp, m_fd, eSocketNotifier::Read);
451 CONNECT(m_sn->activated, eDVBFrontend::feEvent);
456 int eDVBFrontend::closeFrontend()
458 if (!m_fe && m_data[7] != -1)
460 // try to close the first frontend.. but the second is linked to the first
461 eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*)m_data[7];
462 if (linked_fe->m_inuse)
464 eDebug("dont close frontend %d until the linked frontend %d is still in use",
465 m_fe, linked_fe->m_frontend->getID());
471 eDebug("close frontend %d", m_fe);
473 setTone(iDVBFrontend::toneOff);
474 setVoltage(iDVBFrontend::voltageOff);
476 m_sec->setRotorMoving(false);
480 eWarning("couldnt close frontend %d", m_fe);
481 m_data[0] = m_data[1] = m_data[2] = -1;
483 #if HAVE_DVB_API_VERSION < 3
486 if (!::close(m_secfd))
489 eWarning("couldnt close sec %d", m_fe);
498 eDVBFrontend::~eDVBFrontend()
505 void eDVBFrontend::feEvent(int w)
509 #if HAVE_DVB_API_VERSION < 3
512 dvb_frontend_event event;
516 res = ::ioctl(m_fd, FE_GET_EVENT, &event);
518 if (res && (errno == EAGAIN))
523 eWarning("FE_GET_EVENT failed! %m");
530 #if HAVE_DVB_API_VERSION < 3
531 if (event.type == FE_COMPLETION_EV)
533 eDebug("(%d)fe event: status %x, inversion %s", m_fe, event.status, (event.parameters.inversion == INVERSION_ON) ? "on" : "off");
534 if (event.status & FE_HAS_LOCK)
544 state = stateLostLock;
545 m_data[0] = m_data[1] = m_data[2] = -1; // reset diseqc
548 if (m_state != state)
551 m_stateChanged(this);
556 void eDVBFrontend::timeout()
559 if (m_state == stateTuning)
561 m_state = stateFailed;
562 m_stateChanged(this);
566 int eDVBFrontend::readFrontendData(int type)
573 if (ioctl(m_fd, FE_READ_BER, &ber) < 0 && errno != ERANGE)
574 eDebug("FE_READ_BER failed (%m)");
580 if (ioctl(m_fd, FE_READ_SNR, &snr) < 0 && errno != ERANGE)
581 eDebug("FE_READ_SNR failed (%m)");
587 if (ioctl(m_fd, FE_READ_SIGNAL_STRENGTH, &strength) < 0 && errno != ERANGE)
588 eDebug("FE_READ_SIGNAL_STRENGTH failed (%m)");
593 #if HAVE_DVB_API_VERSION < 3
594 FrontendStatus status=0;
598 if ( ioctl(m_fd, FE_READ_STATUS, &status) < 0 && errno != ERANGE )
599 eDebug("FE_READ_STATUS failed (%m)");
600 return !!(status&FE_HAS_LOCK);
604 #if HAVE_DVB_API_VERSION < 3
605 FrontendStatus status=0;
609 if ( ioctl(m_fd, FE_READ_STATUS, &status) < 0 && errno != ERANGE )
610 eDebug("FE_READ_STATUS failed (%m)");
611 return !!(status&FE_HAS_SYNC);
619 void PutToDict(PyObject *dict, const char*key, long value)
621 PyObject *item = PyInt_FromLong(value);
624 if (PyDict_SetItemString(dict, key, item))
625 eDebug("put %s to dict failed", key);
629 eDebug("could not create PyObject for %s", key);
632 void PutToDict(PyObject *dict, const char*key, const char *value)
634 PyObject *item = PyString_FromString(value);
637 if (PyDict_SetItemString(dict, key, item))
638 eDebug("put %s to dict failed", key);
642 eDebug("could not create PyObject for %s", key);
645 void fillDictWithSatelliteData(PyObject *dict, const FRONTENDPARAMETERS &parm, eDVBFrontend *fe)
651 fe->getData(9, freq_offset);
652 int frequency = parm_frequency + freq_offset;
653 PutToDict(dict, "frequency", frequency);
654 PutToDict(dict, "symbol_rate", parm_u_qpsk_symbol_rate);
655 switch(parm_u_qpsk_fec_inner)
678 #if HAVE_DVB_API_VERSION >=3
708 PutToDict(dict, "fec_inner", tmp);
709 tmp = parm_u_qpsk_fec_inner > FEC_AUTO ?
711 PutToDict(dict, "system", tmp);
714 void fillDictWithCableData(PyObject *dict, const FRONTENDPARAMETERS &parm)
717 PutToDict(dict, "frequency", parm_frequency/1000);
718 PutToDict(dict, "symbol_rate", parm_u_qam_symbol_rate);
719 switch(parm_u_qam_fec_inner)
739 #if HAVE_DVB_API_VERSION >= 3
749 PutToDict(dict, "fec_inner", tmp);
750 switch(parm_u_qam_modulation)
772 PutToDict(dict, "modulation", tmp);
775 void fillDictWithTerrestrialData(PyObject *dict, const FRONTENDPARAMETERS &parm)
778 PutToDict(dict, "frequency", parm_frequency);
779 switch (parm_u_ofdm_bandwidth)
781 case BANDWIDTH_8_MHZ:
782 tmp = "BANDWIDTH_8_MHZ";
784 case BANDWIDTH_7_MHZ:
785 tmp = "BANDWIDTH_7_MHZ";
787 case BANDWIDTH_6_MHZ:
788 tmp = "BANDWIDTH_6_MHZ";
792 tmp = "BANDWIDTH_AUTO";
795 PutToDict(dict, "bandwidth", tmp);
796 switch (parm_u_ofdm_code_rate_LP)
818 PutToDict(dict, "code_rate_lp", tmp);
819 switch (parm_u_ofdm_code_rate_HP)
841 PutToDict(dict, "code_rate_hp", tmp);
842 switch (parm_u_ofdm_constellation)
858 PutToDict(dict, "constellation", tmp);
859 switch (parm_u_ofdm_transmission_mode)
861 case TRANSMISSION_MODE_2K:
862 tmp = "TRANSMISSION_MODE_2K";
864 case TRANSMISSION_MODE_8K:
865 tmp = "TRANSMISSION_MODE_8K";
868 case TRANSMISSION_MODE_AUTO:
869 tmp = "TRANSMISSION_MODE_AUTO";
872 PutToDict(dict, "transmission_mode", tmp);
873 switch (parm_u_ofdm_guard_interval)
875 case GUARD_INTERVAL_1_32:
876 tmp = "GUARD_INTERVAL_1_32";
878 case GUARD_INTERVAL_1_16:
879 tmp = "GUARD_INTERVAL_1_16";
881 case GUARD_INTERVAL_1_8:
882 tmp = "GUARD_INTERVAL_1_8";
884 case GUARD_INTERVAL_1_4:
885 tmp = "GUARD_INTERVAL_1_4";
888 case GUARD_INTERVAL_AUTO:
889 tmp = "GUARD_INTERVAL_AUTO";
892 PutToDict(dict, "guard_interval", tmp);
893 switch (parm_u_ofdm_hierarchy_information)
896 tmp = "HIERARCHY_NONE";
909 tmp = "HIERARCHY_AUTO";
912 PutToDict(dict, "hierarchy_information", tmp);
915 PyObject *eDVBFrontend::readTransponderData(bool original)
917 PyObject *ret=PyDict_New();
921 bool read=m_fd != -1;
924 PutToDict(ret, "tuner_number", m_fe);
942 PutToDict(ret, "tuner_type", tmp);
946 FRONTENDPARAMETERS front;
969 PutToDict(ret, "tuner_state", tmp);
971 PutToDict(ret, "tuner_locked", readFrontendData(locked));
972 PutToDict(ret, "tuner_synced", readFrontendData(synced));
973 PutToDict(ret, "tuner_bit_error_rate", readFrontendData(bitErrorRate));
974 PutToDict(ret, "tuner_signal_power", readFrontendData(signalPower));
975 PutToDict(ret, "tuner_signal_quality", readFrontendData(signalQuality));
977 if (!original && ioctl(m_fd, FE_GET_FRONTEND, &front)<0)
978 eDebug("FE_GET_FRONTEND (%m)");
981 tmp = "INVERSION_AUTO";
982 switch(parm_inversion)
985 tmp = "INVERSION_ON";
988 tmp = "INVERSION_OFF";
994 PutToDict(ret, "inversion", tmp);
999 fillDictWithSatelliteData(ret, original?parm:front, this);
1002 fillDictWithCableData(ret, original?parm:front);
1005 fillDictWithTerrestrialData(ret, original?parm:front);
1019 #ifndef FP_IOCTL_GET_ID
1020 #define FP_IOCTL_GET_ID 0
1022 int eDVBFrontend::readInputpower()
1024 int power=m_fe; // this is needed for read inputpower from the correct tuner !
1026 // open front prozessor
1027 int fp=::open("/dev/dbox/fp0", O_RDWR);
1030 eDebug("couldn't open fp");
1033 static bool old_fp = (::ioctl(fp, FP_IOCTL_GET_ID) < 0);
1034 if ( ioctl( fp, old_fp ? 9 : 0x100, &power ) < 0 )
1036 eDebug("FP_IOCTL_GET_LNB_CURRENT failed (%m)");
1044 bool eDVBFrontend::setSecSequencePos(int steps)
1046 eDebug("set sequence pos %d", steps);
1051 if (m_sec_sequence.current() != m_sec_sequence.end())
1052 ++m_sec_sequence.current();
1057 if (m_sec_sequence.current() != m_sec_sequence.begin() && m_sec_sequence.current() != m_sec_sequence.end())
1058 --m_sec_sequence.current();
1064 void eDVBFrontend::tuneLoop() // called by m_tuneTimer
1067 if ( m_sec_sequence && m_sec_sequence.current() != m_sec_sequence.end() )
1069 // eDebug("tuneLoop %d\n", m_sec_sequence.current()->cmd);
1070 switch (m_sec_sequence.current()->cmd)
1072 case eSecCommand::SLEEP:
1073 delay = m_sec_sequence.current()++->msec;
1074 eDebug("[SEC] sleep %dms", delay);
1076 case eSecCommand::GOTO:
1077 if ( !setSecSequencePos(m_sec_sequence.current()->steps) )
1078 ++m_sec_sequence.current();
1080 case eSecCommand::SET_VOLTAGE:
1082 int voltage = m_sec_sequence.current()++->voltage;
1083 eDebug("[SEC] setVoltage %d", voltage);
1084 setVoltage(voltage);
1087 case eSecCommand::IF_VOLTAGE_GOTO:
1089 eSecCommand::pair &compare = m_sec_sequence.current()->compare;
1090 if ( compare.voltage == m_curVoltage && setSecSequencePos(compare.steps) )
1092 ++m_sec_sequence.current();
1095 case eSecCommand::IF_NOT_VOLTAGE_GOTO:
1097 eSecCommand::pair &compare = m_sec_sequence.current()->compare;
1098 if ( compare.voltage != m_curVoltage && setSecSequencePos(compare.steps) )
1100 ++m_sec_sequence.current();
1103 case eSecCommand::SET_TONE:
1104 eDebug("[SEC] setTone %d", m_sec_sequence.current()->tone);
1105 setTone(m_sec_sequence.current()++->tone);
1107 case eSecCommand::SEND_DISEQC:
1108 sendDiseqc(m_sec_sequence.current()->diseqc);
1109 eDebugNoNewLine("[SEC] sendDiseqc: ");
1110 for (int i=0; i < m_sec_sequence.current()->diseqc.len; ++i)
1111 eDebugNoNewLine("%02x", m_sec_sequence.current()->diseqc.data[i]);
1113 ++m_sec_sequence.current();
1115 case eSecCommand::SEND_TONEBURST:
1116 eDebug("[SEC] sendToneburst: %d", m_sec_sequence.current()->toneburst);
1117 sendToneburst(m_sec_sequence.current()++->toneburst);
1119 case eSecCommand::SET_FRONTEND:
1120 eDebug("[SEC] setFrontend");
1122 ++m_sec_sequence.current();
1124 case eSecCommand::START_TUNE_TIMEOUT:
1125 m_timeout->start(5000, 1); // 5 sec timeout. TODO: symbolrate dependent
1126 ++m_sec_sequence.current();
1128 case eSecCommand::SET_TIMEOUT:
1129 m_timeoutCount = m_sec_sequence.current()++->val;
1130 eDebug("[SEC] set timeout %d", m_timeoutCount);
1132 case eSecCommand::IF_TIMEOUT_GOTO:
1133 if (!m_timeoutCount)
1135 eDebug("[SEC] rotor timout");
1136 m_sec->setRotorMoving(false);
1137 setSecSequencePos(m_sec_sequence.current()->steps);
1140 ++m_sec_sequence.current();
1142 case eSecCommand::MEASURE_IDLE_INPUTPOWER:
1144 int idx = m_sec_sequence.current()++->val;
1145 if ( idx == 0 || idx == 1 )
1147 m_idleInputpower[idx] = readInputpower();
1148 eDebug("[SEC] idleInputpower[%d] is %d", idx, m_idleInputpower[idx]);
1151 eDebug("[SEC] idleInputpower measure index(%d) out of bound !!!", idx);
1154 case eSecCommand::IF_MEASURE_IDLE_WAS_NOT_OK_GOTO:
1156 eSecCommand::pair &compare = m_sec_sequence.current()->compare;
1157 int idx = compare.voltage;
1158 if ( idx == 0 || idx == 1 )
1160 int idle = readInputpower();
1161 int diff = abs(idle-m_idleInputpower[idx]);
1164 eDebug("measure idle(%d) was not okay.. (%d - %d = %d) retry", idx, m_idleInputpower[idx], idle, diff);
1165 setSecSequencePos(compare.steps);
1169 ++m_sec_sequence.current();
1172 case eSecCommand::IF_TUNER_LOCKED_GOTO:
1174 eSecCommand::rotor &cmd = m_sec_sequence.current()->measure;
1175 if (readFrontendData(locked))
1177 eDebug("[SEC] locked step %d ok", cmd.okcount);
1179 if (cmd.okcount > 12)
1181 eDebug("ok > 12 .. goto %d\n",m_sec_sequence.current()->steps);
1182 setSecSequencePos(cmd.steps);
1188 eDebug("[SEC] rotor locked step %d failed", cmd.okcount);
1190 if (!m_timeoutCount && m_retryCount > 0)
1194 ++m_sec_sequence.current();
1197 case eSecCommand::MEASURE_RUNNING_INPUTPOWER:
1198 m_runningInputpower = readInputpower();
1199 eDebug("[SEC] runningInputpower is %d", m_runningInputpower);
1200 ++m_sec_sequence.current();
1202 case eSecCommand::IF_INPUTPOWER_DELTA_GOTO:
1204 int idleInputpower = m_idleInputpower[ (m_curVoltage&1) ? 0 : 1];
1205 eSecCommand::rotor &cmd = m_sec_sequence.current()->measure;
1206 const char *txt = cmd.direction ? "running" : "stopped";
1207 eDebug("[SEC] waiting for rotor %s %d, idle %d, delta %d",
1209 m_runningInputpower,
1212 if ( (cmd.direction && abs(m_runningInputpower - idleInputpower) >= cmd.deltaA)
1213 || (!cmd.direction && abs(m_runningInputpower - idleInputpower) <= cmd.deltaA) )
1216 eDebug("[SEC] rotor %s step %d ok", txt, cmd.okcount);
1217 if ( cmd.okcount > 6 )
1219 m_sec->setRotorMoving(cmd.direction);
1220 eDebug("[SEC] rotor is %s", txt);
1221 if (setSecSequencePos(cmd.steps))
1227 eDebug("[SEC] rotor not %s... reset counter.. increase timeout", txt);
1229 if (!m_timeoutCount && m_retryCount > 0)
1233 ++m_sec_sequence.current();
1236 case eSecCommand::IF_ROTORPOS_VALID_GOTO:
1237 if (m_data[5] != -1 && m_data[6] != -1)
1238 setSecSequencePos(m_sec_sequence.current()->steps);
1240 ++m_sec_sequence.current();
1242 case eSecCommand::INVALIDATE_CURRENT_ROTORPARMS:
1243 m_data[5] = m_data[6] = -1;
1244 eDebug("[SEC] invalidate current rotorparams");
1245 ++m_sec_sequence.current();
1247 case eSecCommand::UPDATE_CURRENT_ROTORPARAMS:
1248 m_data[5] = m_data[3];
1249 m_data[6] = m_data[4];
1250 eDebug("[SEC] update current rotorparams %d %04x %d", m_timeoutCount, m_data[5], m_data[6]);
1251 ++m_sec_sequence.current();
1253 case eSecCommand::SET_ROTOR_DISEQC_RETRYS:
1254 m_retryCount = m_sec_sequence.current()++->val;
1255 eDebug("[SEC] set rotor retries %d", m_retryCount);
1257 case eSecCommand::IF_NO_MORE_ROTOR_DISEQC_RETRYS_GOTO:
1260 eDebug("[SEC] no more rotor retrys");
1261 setSecSequencePos(m_sec_sequence.current()->steps);
1264 ++m_sec_sequence.current();
1266 case eSecCommand::SET_POWER_LIMITING_MODE:
1269 ::open("/dev/i2c/1", O_RDWR) :
1270 ::open("/dev/i2c/0", O_RDWR);
1272 unsigned char data[2];
1273 ::ioctl(fd, I2C_SLAVE_FORCE, 0x10 >> 1);
1274 if(::read(fd, data, 1) != 1)
1275 eDebug("[SEC] error read lnbp (%m)");
1276 if ( m_sec_sequence.current()->mode == eSecCommand::modeStatic )
1278 data[0] |= 0x80; // enable static current limiting
1279 eDebug("[SEC] set static current limiting");
1283 data[0] &= ~0x80; // enable dynamic current limiting
1284 eDebug("[SEC] set dynamic current limiting");
1286 if(::write(fd, data, 1) != 1)
1287 eDebug("[SEC] error write lnbp (%m)");
1289 ++m_sec_sequence.current();
1293 ++m_sec_sequence.current();
1294 eDebug("[SEC] unhandled sec command");
1296 m_tuneTimer->start(delay,true);
1300 void eDVBFrontend::setFrontend()
1302 eDebug("setting frontend %d", m_fe);
1305 if (ioctl(m_fd, FE_SET_FRONTEND, &parm) == -1)
1307 perror("FE_SET_FRONTEND failed");
1312 RESULT eDVBFrontend::getFrontendType(int &t)
1320 RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm)
1325 eWarning("no SEC module active!");
1328 res = m_sec->prepare(*this, parm, feparm, 1 << m_fe);
1331 parm_u_qpsk_symbol_rate = feparm.symbol_rate;
1332 switch (feparm.inversion)
1334 case eDVBFrontendParametersSatellite::Inversion::On:
1335 parm_inversion = INVERSION_ON;
1337 case eDVBFrontendParametersSatellite::Inversion::Off:
1338 parm_inversion = INVERSION_OFF;
1341 case eDVBFrontendParametersSatellite::Inversion::Unknown:
1342 parm_inversion = INVERSION_AUTO;
1345 if (feparm.system == eDVBFrontendParametersSatellite::System::DVB_S)
1348 case eDVBFrontendParametersSatellite::FEC::fNone:
1349 parm_u_qpsk_fec_inner = FEC_NONE;
1351 case eDVBFrontendParametersSatellite::FEC::f1_2:
1352 parm_u_qpsk_fec_inner = FEC_1_2;
1354 case eDVBFrontendParametersSatellite::FEC::f2_3:
1355 parm_u_qpsk_fec_inner = FEC_2_3;
1357 case eDVBFrontendParametersSatellite::FEC::f3_4:
1358 parm_u_qpsk_fec_inner = FEC_3_4;
1360 case eDVBFrontendParametersSatellite::FEC::f5_6:
1361 parm_u_qpsk_fec_inner = FEC_5_6;
1363 case eDVBFrontendParametersSatellite::FEC::f7_8:
1364 parm_u_qpsk_fec_inner = FEC_7_8;
1367 eDebug("no valid fec for DVB-S set.. assume auto");
1368 case eDVBFrontendParametersSatellite::FEC::fAuto:
1369 parm_u_qpsk_fec_inner = FEC_AUTO;
1372 #if HAVE_DVB_API_VERSION >= 3
1376 case eDVBFrontendParametersSatellite::FEC::f1_2:
1377 parm_u_qpsk_fec_inner = FEC_S2_1_2;
1379 case eDVBFrontendParametersSatellite::FEC::f2_3:
1380 parm_u_qpsk_fec_inner = FEC_S2_2_3;
1382 case eDVBFrontendParametersSatellite::FEC::f3_4:
1383 parm_u_qpsk_fec_inner = FEC_S2_3_4;
1385 case eDVBFrontendParametersSatellite::FEC::f3_5:
1386 parm_u_qpsk_fec_inner = FEC_S2_3_5;
1388 case eDVBFrontendParametersSatellite::FEC::f4_5:
1389 parm_u_qpsk_fec_inner = FEC_S2_4_5;
1391 case eDVBFrontendParametersSatellite::FEC::f5_6:
1392 parm_u_qpsk_fec_inner = FEC_S2_5_6;
1394 case eDVBFrontendParametersSatellite::FEC::f7_8:
1395 parm_u_qpsk_fec_inner = FEC_S2_7_8;
1397 case eDVBFrontendParametersSatellite::FEC::f8_9:
1398 parm_u_qpsk_fec_inner = FEC_S2_8_9;
1400 case eDVBFrontendParametersSatellite::FEC::f9_10:
1401 parm_u_qpsk_fec_inner = FEC_S2_9_10;
1404 eDebug("no valid fec for DVB-S2 set.. abort !!");
1408 // FIXME !!! get frequency range from tuner
1409 if ( parm_frequency < 900000 || parm_frequency > 2200000 )
1411 eDebug("%d mhz out of tuner range.. dont tune", parm_frequency/1000);
1414 eDebug("tuning to %d mhz", parm_frequency/1000);
1419 RESULT eDVBFrontend::prepare_cable(const eDVBFrontendParametersCable &feparm)
1421 parm_frequency = feparm.frequency * 1000;
1422 parm_u_qam_symbol_rate = feparm.symbol_rate;
1423 switch (feparm.modulation)
1425 case eDVBFrontendParametersCable::Modulation::QAM16:
1426 parm_u_qam_modulation = QAM_16;
1428 case eDVBFrontendParametersCable::Modulation::QAM32:
1429 parm_u_qam_modulation = QAM_32;
1431 case eDVBFrontendParametersCable::Modulation::QAM64:
1432 parm_u_qam_modulation = QAM_64;
1434 case eDVBFrontendParametersCable::Modulation::QAM128:
1435 parm_u_qam_modulation = QAM_128;
1437 case eDVBFrontendParametersCable::Modulation::QAM256:
1438 parm_u_qam_modulation = QAM_256;
1441 case eDVBFrontendParametersCable::Modulation::Auto:
1442 parm_u_qam_modulation = QAM_AUTO;
1445 switch (feparm.inversion)
1447 case eDVBFrontendParametersCable::Inversion::On:
1448 parm_inversion = INVERSION_ON;
1450 case eDVBFrontendParametersCable::Inversion::Off:
1451 parm_inversion = INVERSION_OFF;
1454 case eDVBFrontendParametersCable::Inversion::Unknown:
1455 parm_inversion = INVERSION_AUTO;
1458 switch (feparm.fec_inner)
1460 case eDVBFrontendParametersCable::FEC::fNone:
1461 parm_u_qam_fec_inner = FEC_NONE;
1463 case eDVBFrontendParametersCable::FEC::f1_2:
1464 parm_u_qam_fec_inner = FEC_1_2;
1466 case eDVBFrontendParametersCable::FEC::f2_3:
1467 parm_u_qam_fec_inner = FEC_2_3;
1469 case eDVBFrontendParametersCable::FEC::f3_4:
1470 parm_u_qam_fec_inner = FEC_3_4;
1472 case eDVBFrontendParametersCable::FEC::f5_6:
1473 parm_u_qam_fec_inner = FEC_5_6;
1475 case eDVBFrontendParametersCable::FEC::f7_8:
1476 parm_u_qam_fec_inner = FEC_7_8;
1478 #if HAVE_DVB_API_VERSION >= 3
1479 case eDVBFrontendParametersCable::FEC::f8_9:
1480 parm_u_qam_fec_inner = FEC_8_9;
1484 case eDVBFrontendParametersCable::FEC::fAuto:
1485 parm_u_qam_fec_inner = FEC_AUTO;
1491 RESULT eDVBFrontend::prepare_terrestrial(const eDVBFrontendParametersTerrestrial &feparm)
1493 parm_frequency = feparm.frequency;
1495 switch (feparm.bandwidth)
1497 case eDVBFrontendParametersTerrestrial::Bandwidth::Bw8MHz:
1498 parm_u_ofdm_bandwidth = BANDWIDTH_8_MHZ;
1500 case eDVBFrontendParametersTerrestrial::Bandwidth::Bw7MHz:
1501 parm_u_ofdm_bandwidth = BANDWIDTH_7_MHZ;
1503 case eDVBFrontendParametersTerrestrial::Bandwidth::Bw6MHz:
1504 parm_u_ofdm_bandwidth = BANDWIDTH_6_MHZ;
1507 case eDVBFrontendParametersTerrestrial::Bandwidth::BwAuto:
1508 parm_u_ofdm_bandwidth = BANDWIDTH_AUTO;
1511 switch (feparm.code_rate_LP)
1513 case eDVBFrontendParametersTerrestrial::FEC::f1_2:
1514 parm_u_ofdm_code_rate_LP = FEC_1_2;
1516 case eDVBFrontendParametersTerrestrial::FEC::f2_3:
1517 parm_u_ofdm_code_rate_LP = FEC_2_3;
1519 case eDVBFrontendParametersTerrestrial::FEC::f3_4:
1520 parm_u_ofdm_code_rate_LP = FEC_3_4;
1522 case eDVBFrontendParametersTerrestrial::FEC::f5_6:
1523 parm_u_ofdm_code_rate_LP = FEC_5_6;
1525 case eDVBFrontendParametersTerrestrial::FEC::f7_8:
1526 parm_u_ofdm_code_rate_LP = FEC_7_8;
1529 case eDVBFrontendParametersTerrestrial::FEC::fAuto:
1530 parm_u_ofdm_code_rate_LP = FEC_AUTO;
1533 switch (feparm.code_rate_HP)
1535 case eDVBFrontendParametersTerrestrial::FEC::f1_2:
1536 parm_u_ofdm_code_rate_HP = FEC_1_2;
1538 case eDVBFrontendParametersTerrestrial::FEC::f2_3:
1539 parm_u_ofdm_code_rate_HP = FEC_2_3;
1541 case eDVBFrontendParametersTerrestrial::FEC::f3_4:
1542 parm_u_ofdm_code_rate_HP = FEC_3_4;
1544 case eDVBFrontendParametersTerrestrial::FEC::f5_6:
1545 parm_u_ofdm_code_rate_HP = FEC_5_6;
1547 case eDVBFrontendParametersTerrestrial::FEC::f7_8:
1548 parm_u_ofdm_code_rate_HP = FEC_7_8;
1551 case eDVBFrontendParametersTerrestrial::FEC::fAuto:
1552 parm_u_ofdm_code_rate_HP = FEC_AUTO;
1555 switch (feparm.modulation)
1557 case eDVBFrontendParametersTerrestrial::Modulation::QPSK:
1558 parm_u_ofdm_constellation = QPSK;
1560 case eDVBFrontendParametersTerrestrial::Modulation::QAM16:
1561 parm_u_ofdm_constellation = QAM_16;
1563 case eDVBFrontendParametersTerrestrial::Modulation::QAM64:
1564 parm_u_ofdm_constellation = QAM_64;
1567 case eDVBFrontendParametersTerrestrial::Modulation::Auto:
1568 parm_u_ofdm_constellation = QAM_AUTO;
1571 switch (feparm.transmission_mode)
1573 case eDVBFrontendParametersTerrestrial::TransmissionMode::TM2k:
1574 parm_u_ofdm_transmission_mode = TRANSMISSION_MODE_2K;
1576 case eDVBFrontendParametersTerrestrial::TransmissionMode::TM8k:
1577 parm_u_ofdm_transmission_mode = TRANSMISSION_MODE_8K;
1580 case eDVBFrontendParametersTerrestrial::TransmissionMode::TMAuto:
1581 parm_u_ofdm_transmission_mode = TRANSMISSION_MODE_AUTO;
1584 switch (feparm.guard_interval)
1586 case eDVBFrontendParametersTerrestrial::GuardInterval::GI_1_32:
1587 parm_u_ofdm_guard_interval = GUARD_INTERVAL_1_32;
1589 case eDVBFrontendParametersTerrestrial::GuardInterval::GI_1_16:
1590 parm_u_ofdm_guard_interval = GUARD_INTERVAL_1_16;
1592 case eDVBFrontendParametersTerrestrial::GuardInterval::GI_1_8:
1593 parm_u_ofdm_guard_interval = GUARD_INTERVAL_1_8;
1595 case eDVBFrontendParametersTerrestrial::GuardInterval::GI_1_4:
1596 parm_u_ofdm_guard_interval = GUARD_INTERVAL_1_4;
1599 case eDVBFrontendParametersTerrestrial::GuardInterval::GI_Auto:
1600 parm_u_ofdm_guard_interval = GUARD_INTERVAL_AUTO;
1603 switch (feparm.hierarchy)
1605 case eDVBFrontendParametersTerrestrial::Hierarchy::HNone:
1606 parm_u_ofdm_hierarchy_information = HIERARCHY_NONE;
1608 case eDVBFrontendParametersTerrestrial::Hierarchy::H1:
1609 parm_u_ofdm_hierarchy_information = HIERARCHY_1;
1611 case eDVBFrontendParametersTerrestrial::Hierarchy::H2:
1612 parm_u_ofdm_hierarchy_information = HIERARCHY_2;
1614 case eDVBFrontendParametersTerrestrial::Hierarchy::H4:
1615 parm_u_ofdm_hierarchy_information = HIERARCHY_4;
1618 case eDVBFrontendParametersTerrestrial::Hierarchy::HAuto:
1619 parm_u_ofdm_hierarchy_information = HIERARCHY_AUTO;
1622 switch (feparm.inversion)
1624 case eDVBFrontendParametersTerrestrial::Inversion::On:
1625 parm_inversion = INVERSION_ON;
1627 case eDVBFrontendParametersTerrestrial::Inversion::Off:
1628 parm_inversion = INVERSION_OFF;
1631 case eDVBFrontendParametersTerrestrial::Inversion::Unknown:
1632 parm_inversion = INVERSION_AUTO;
1638 RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
1640 eDebug("(%d)tune", m_fe);
1650 m_sec_sequence.clear();
1656 eDVBFrontendParametersSatellite feparm;
1657 if (where.getDVBS(feparm))
1659 eDebug("no dvbs data!");
1662 res=prepare_sat(feparm);
1663 m_sec->setRotorMoving(false);
1668 eDVBFrontendParametersCable feparm;
1669 if (where.getDVBC(feparm))
1671 res=prepare_cable(feparm);
1674 m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) );
1675 m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
1681 eDVBFrontendParametersTerrestrial feparm;
1682 if (where.getDVBT(feparm))
1684 eDebug("no -T data");
1687 res=prepare_terrestrial(feparm);
1690 m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) );
1691 m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
1697 if (!res) // prepare ok
1699 m_tuneTimer->start(0,true);
1700 m_sec_sequence.current() = m_sec_sequence.begin();
1702 if (m_state != stateTuning)
1705 m_state = stateTuning;
1706 m_stateChanged(this);
1713 RESULT eDVBFrontend::connectStateChange(const Slot1<void,iDVBFrontend*> &stateChange, ePtr<eConnection> &connection)
1715 connection = new eConnection(this, m_stateChanged.connect(stateChange));
1719 RESULT eDVBFrontend::setVoltage(int voltage)
1721 if (m_type != feSatellite)
1723 #if HAVE_DVB_API_VERSION < 3
1726 bool increased=false;
1727 fe_sec_voltage_t vlt;
1729 m_curVoltage=voltage;
1733 for (int i=0; i < 3; ++i) // reset diseqc
1735 vlt = SEC_VOLTAGE_OFF;
1738 #if HAVE_DVB_API_VERSION < 3
1739 vlt = SEC_VOLTAGE_13_5;
1745 vlt = SEC_VOLTAGE_13;
1748 #if HAVE_DVB_API_VERSION < 3
1749 vlt = SEC_VOLTAGE_18_5;
1755 vlt = SEC_VOLTAGE_18;
1760 #if HAVE_DVB_API_VERSION < 3
1761 return ::ioctl(m_secfd, SEC_SET_VOLTAGE, vlt);
1763 if (::ioctl(m_fd, FE_ENABLE_HIGH_LNB_VOLTAGE, increased) < 0)
1764 perror("FE_ENABLE_HIGH_LNB_VOLTAGE");
1765 return ::ioctl(m_fd, FE_SET_VOLTAGE, vlt);
1769 RESULT eDVBFrontend::getState(int &state)
1775 RESULT eDVBFrontend::setTone(int t)
1777 if (m_type != feSatellite)
1779 #if HAVE_DVB_API_VERSION < 3
1782 fe_sec_tone_mode_t tone;
1791 tone = SEC_TONE_OFF;
1796 #if HAVE_DVB_API_VERSION < 3
1797 return ::ioctl(m_secfd, SEC_SET_TONE, tone);
1799 return ::ioctl(m_fd, FE_SET_TONE, tone);
1803 #if HAVE_DVB_API_VERSION < 3 && !defined(SEC_DISEQC_SEND_MASTER_CMD)
1804 #define SEC_DISEQC_SEND_MASTER_CMD _IOW('o', 97, struct secCommand *)
1807 RESULT eDVBFrontend::sendDiseqc(const eDVBDiseqcCommand &diseqc)
1809 #if HAVE_DVB_API_VERSION < 3
1810 struct secCommand cmd;
1811 cmd.type = SEC_CMDTYPE_DISEQC_RAW;
1812 cmd.u.diseqc.cmdtype = diseqc.data[0];
1813 cmd.u.diseqc.addr = diseqc.data[1];
1814 cmd.u.diseqc.cmd = diseqc.data[2];
1815 cmd.u.diseqc.numParams = diseqc.len-3;
1816 memcpy(cmd.u.diseqc.params, diseqc.data+3, diseqc.len-3);
1817 if (::ioctl(m_secfd, SEC_DISEQC_SEND_MASTER_CMD, &cmd))
1819 struct dvb_diseqc_master_cmd cmd;
1820 memcpy(cmd.msg, diseqc.data, diseqc.len);
1821 cmd.msg_len = diseqc.len;
1822 if (::ioctl(m_fd, FE_DISEQC_SEND_MASTER_CMD, &cmd))
1828 #if HAVE_DVB_API_VERSION < 3 && !defined(SEC_DISEQC_SEND_BURST)
1829 #define SEC_DISEQC_SEND_BURST _IO('o', 96)
1831 RESULT eDVBFrontend::sendToneburst(int burst)
1833 #if HAVE_DVB_API_VERSION < 3
1834 secMiniCmd cmd = SEC_MINI_NONE;
1836 fe_sec_mini_cmd_t cmd = SEC_MINI_A;
1838 if ( burst == eDVBSatelliteDiseqcParameters::A )
1840 else if ( burst == eDVBSatelliteDiseqcParameters::B )
1842 #if HAVE_DVB_API_VERSION < 3
1843 if (::ioctl(m_secfd, SEC_DISEQC_SEND_BURST, cmd))
1846 if (::ioctl(m_fd, FE_DISEQC_SEND_BURST, cmd))
1852 RESULT eDVBFrontend::setSEC(iDVBSatelliteEquipmentControl *sec)
1858 RESULT eDVBFrontend::setSecSequence(const eSecCommandList &list)
1860 m_sec_sequence = list;
1864 RESULT eDVBFrontend::getData(int num, int &data)
1866 if ( num < (int)(sizeof(m_data)/sizeof(int)) )
1874 RESULT eDVBFrontend::setData(int num, int val)
1876 if ( num < (int)(sizeof(m_data)/sizeof(int)) )
1884 int eDVBFrontend::isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm)
1887 if (feparm->getSystem(type) || type != m_type)
1890 if (m_type == eDVBFrontend::feSatellite)
1893 eDVBFrontendParametersSatellite sat_parm;
1894 ASSERT(!feparm->getDVBS(sat_parm));
1895 return m_sec->canTune(sat_parm, this, 1 << m_fe);