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 constellation Constellation
21 #define guard_interval guardInterval
22 #define hierarchy_information HierarchyInformation
23 #define code_rate_HP HP_CodeRate
24 #define code_rate_LP LP_CodeRate
26 #include <linux/dvb/frontend.h>
29 #include <dvbsi++/satellite_delivery_system_descriptor.h>
30 #include <dvbsi++/cable_delivery_system_descriptor.h>
31 #include <dvbsi++/terrestrial_delivery_system_descriptor.h>
33 void eDVBFrontendParametersSatellite::set(const SatelliteDeliverySystemDescriptor &descriptor)
35 frequency = descriptor.getFrequency() * 10;
36 symbol_rate = descriptor.getSymbolRate() * 100;
37 switch (descriptor.getPolarization())
40 polarisation = Polarisation::Horizontal;
43 polarisation = Polarisation::Vertical;
46 polarisation = Polarisation::CircularLeft;
49 polarisation = Polarisation::CircularRight;
52 switch (descriptor.getFecInner())
76 inversion = Inversion::Unknown;
77 orbital_position = ((descriptor.getOrbitalPosition() >> 12) & 0xF) * 1000;
78 orbital_position += ((descriptor.getOrbitalPosition() >> 8) & 0xF) * 100;
79 orbital_position += ((descriptor.getOrbitalPosition() >> 4) & 0xF) * 10;
80 orbital_position += ((descriptor.getOrbitalPosition()) & 0xF);
81 if (orbital_position && (!descriptor.getWestEastFlag()))
82 orbital_position = 3600 - orbital_position;
85 void eDVBFrontendParametersCable::set(const CableDeliverySystemDescriptor &descriptor)
90 void eDVBFrontendParametersTerrestrial::set(const TerrestrialDeliverySystemDescriptor &)
95 eDVBFrontendParameters::eDVBFrontendParameters(): m_type(-1)
99 DEFINE_REF(eDVBFrontendParameters);
101 RESULT eDVBFrontendParameters::getSystem(int &t) const
109 RESULT eDVBFrontendParameters::getDVBS(eDVBFrontendParametersSatellite &p) const
111 if (m_type != iDVBFrontend::feSatellite)
117 RESULT eDVBFrontendParameters::getDVBC(eDVBFrontendParametersCable &p) const
119 if (m_type != iDVBFrontend::feCable)
125 RESULT eDVBFrontendParameters::getDVBT(eDVBFrontendParametersTerrestrial &p) const
127 if (m_type != iDVBFrontend::feTerrestrial)
133 RESULT eDVBFrontendParameters::setDVBS(const eDVBFrontendParametersSatellite &p)
136 m_type = iDVBFrontend::feSatellite;
140 RESULT eDVBFrontendParameters::setDVBC(const eDVBFrontendParametersCable &p)
143 m_type = iDVBFrontend::feCable;
147 RESULT eDVBFrontendParameters::setDVBT(const eDVBFrontendParametersTerrestrial &p)
150 m_type = iDVBFrontend::feTerrestrial;
154 RESULT eDVBFrontendParameters::calculateDifference(const iDVBFrontendParameters *parm, int &diff) const
159 if (parm->getSystem(type))
163 diff = 1<<30; // big difference
169 case iDVBFrontend::feSatellite:
171 eDVBFrontendParametersSatellite osat;
172 if (parm->getDVBS(osat))
175 if (sat.orbital_position != osat.orbital_position)
177 else if (sat.polarisation != osat.polarisation)
181 diff = abs(sat.frequency - osat.frequency);
182 diff += abs(sat.symbol_rate - osat.symbol_rate);
186 case iDVBFrontend::feCable:
187 case iDVBFrontend::feTerrestrial:
194 RESULT eDVBFrontendParameters::getHash(unsigned long &hash) const
198 case iDVBFrontend::feSatellite:
200 hash = (sat.orbital_position << 16);
201 hash |= ((sat.frequency/1000)&0xFFFF)|((sat.polarisation&1) << 15);
204 case iDVBFrontend::feCable:
205 case iDVBFrontend::feTerrestrial:
211 DEFINE_REF(eDVBFrontend);
213 eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok)
214 :m_type(-1), m_fe(fe), m_fd(-1), m_timeout(0), m_tuneTimer(0)
215 #if HAVE_DVB_API_VERSION < 3
219 #if HAVE_DVB_API_VERSION < 3
220 sprintf(m_filename, "/dev/dvb/card%d/frontend%d", adap, fe);
221 sprintf(m_sec_filename, "/dev/dvb/card%d/sec%d", adap, fe);
223 sprintf(m_filename, "/dev/dvb/adapter%d/frontend%d", adap, fe);
225 m_timeout = new eTimer(eApp);
226 CONNECT(m_timeout->timeout, eDVBFrontend::timeout);
228 m_tuneTimer = new eTimer(eApp);
229 CONNECT(m_tuneTimer->timeout, eDVBFrontend::tuneLoop);
231 int entries = sizeof(m_data) / sizeof(int);
232 for (int i=0; i<entries; ++i)
235 m_idleInputpower[0]=m_idleInputpower[1]=0;
237 ok = !openFrontend();
241 int eDVBFrontend::openFrontend()
244 return -1; // already opened
247 m_curVoltage=voltageOff;
250 #if HAVE_DVB_API_VERSION < 3
251 m_secfd = ::open(m_sec_filename, O_RDWR);
254 eWarning("failed! (%s) %m", m_sec_filename);
257 FrontendInfo fe_info;
259 dvb_frontend_info fe_info;
261 eDebug("opening frontend %d", m_fe);
262 m_fd = ::open(m_filename, O_RDWR|O_NONBLOCK);
265 eWarning("failed! (%s) %m", m_filename);
266 #if HAVE_DVB_API_VERSION < 3
275 if (::ioctl(m_fd, FE_GET_INFO, &fe_info) < 0)
277 eWarning("ioctl FE_GET_INFO failed");
280 #if HAVE_DVB_API_VERSION < 3
287 switch (fe_info.type)
290 m_type = iDVBFrontend::feSatellite;
293 m_type = iDVBFrontend::feCable;
296 m_type = iDVBFrontend::feTerrestrial;
299 eWarning("unknown frontend type.");
302 #if HAVE_DVB_API_VERSION < 3
308 eDebug("detected %s frontend", "satellite\0cable\0 terrestrial"+fe_info.type*10);
311 setTone(iDVBFrontend::toneOff);
312 setVoltage(iDVBFrontend::voltageOff);
314 m_sn = new eSocketNotifier(eApp, m_fd, eSocketNotifier::Read);
315 CONNECT(m_sn->activated, eDVBFrontend::feEvent);
321 int eDVBFrontend::closeFrontend()
323 if (!m_fe && m_data[7] != -1)
325 // try to close the first frontend.. but the second is linked to the first
326 eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*)m_data[7];
327 if (linked_fe->m_inuse)
329 eDebug("dont close frontend %d until the linked frontend %d is still in use",
330 m_fe, linked_fe->m_frontend->getID());
336 eDebug("close frontend %d", m_fe);
337 setTone(iDVBFrontend::toneOff);
338 setVoltage(iDVBFrontend::voltageOff);
342 #if HAVE_DVB_API_VERSION < 3
355 eDVBFrontend::~eDVBFrontend()
362 void eDVBFrontend::feEvent(int w)
366 #if HAVE_DVB_API_VERSION < 3
369 dvb_frontend_event event;
373 res = ::ioctl(m_fd, FE_GET_EVENT, &event);
375 if (res && (errno == EAGAIN))
380 eWarning("FE_GET_EVENT failed! %m");
387 #if HAVE_DVB_API_VERSION < 3
388 if (event.type == FE_COMPLETION_EV)
390 eDebug("(%d)fe event: status %x, inversion %s", m_fe, event.status, (event.parameters.inversion == INVERSION_ON) ? "on" : "off");
391 if (event.status & FE_HAS_LOCK)
401 state = stateLostLock;
402 m_data[0] = m_data[1] = m_data[2] = -1; // reset diseqc
405 if (m_state != state)
408 m_stateChanged(this);
413 void eDVBFrontend::timeout()
416 if (m_state == stateTuning)
418 m_state = stateFailed;
419 m_stateChanged(this);
423 int eDVBFrontend::readFrontendData(int type)
430 if (ioctl(m_fd, FE_READ_BER, &ber) < 0 && errno != ERANGE)
431 eDebug("FE_READ_BER failed (%m)");
437 if (ioctl(m_fd, FE_READ_SNR, &snr) < 0 && errno != ERANGE)
438 eDebug("FE_READ_SNR failed (%m)");
444 if (ioctl(m_fd, FE_READ_SIGNAL_STRENGTH, &strength) < 0 && errno != ERANGE)
445 eDebug("FE_READ_SIGNAL_STRENGTH failed (%m)");
452 #ifndef FP_IOCTL_GET_ID
453 #define FP_IOCTL_GET_ID 0
455 int eDVBFrontend::readInputpower()
457 int power=m_fe; // this is needed for read inputpower from the correct tuner !
459 // open front prozessor
460 int fp=::open("/dev/dbox/fp0", O_RDWR);
463 eDebug("couldn't open fp");
466 static bool old_fp = (::ioctl(fp, FP_IOCTL_GET_ID) < 0);
467 if ( ioctl( fp, old_fp ? 9 : 0x100, &power ) < 0 )
469 eDebug("FP_IOCTL_GET_LNB_CURRENT failed (%m)");
477 bool eDVBFrontend::setSecSequencePos(int steps)
479 eDebug("set sequence pos %d", steps);
484 if (m_sec_sequence.current() != m_sec_sequence.end())
485 ++m_sec_sequence.current();
490 if (m_sec_sequence.current() != m_sec_sequence.begin() && m_sec_sequence.current() != m_sec_sequence.end())
491 --m_sec_sequence.current();
497 void eDVBFrontend::tuneLoop() // called by m_tuneTimer
500 if ( m_sec_sequence && m_sec_sequence.current() != m_sec_sequence.end() )
502 switch (m_sec_sequence.current()->cmd)
504 case eSecCommand::SLEEP:
505 delay = m_sec_sequence.current()++->msec;
506 eDebug("[SEC] sleep %dms", delay);
508 case eSecCommand::GOTO:
509 if ( !setSecSequencePos(m_sec_sequence.current()->steps) )
510 ++m_sec_sequence.current();
512 case eSecCommand::SET_VOLTAGE:
514 int voltage = m_sec_sequence.current()++->voltage;
515 eDebug("[SEC] setVoltage %d", voltage);
519 case eSecCommand::SET_TONE:
520 eDebug("[SEC] setTone %d", m_sec_sequence.current()->tone);
521 setTone(m_sec_sequence.current()++->tone);
523 case eSecCommand::SEND_DISEQC:
524 sendDiseqc(m_sec_sequence.current()->diseqc);
525 eDebugNoNewLine("[SEC] sendDiseqc: ");
526 for (int i=0; i < m_sec_sequence.current()->diseqc.len; ++i)
527 eDebugNoNewLine("%02x", m_sec_sequence.current()->diseqc.data[i]);
529 ++m_sec_sequence.current();
531 case eSecCommand::SEND_TONEBURST:
532 eDebug("[SEC] sendToneburst: %d", m_sec_sequence.current()->toneburst);
533 sendToneburst(m_sec_sequence.current()++->toneburst);
535 case eSecCommand::SET_FRONTEND:
536 eDebug("[SEC] setFrontend");
538 ++m_sec_sequence.current();
540 case eSecCommand::MEASURE_IDLE_INPUTPOWER:
542 int idx = m_sec_sequence.current()++->val;
543 if ( idx == 0 || idx == 1 )
545 m_idleInputpower[idx] = readInputpower();
546 eDebug("[SEC] idleInputpower[%d] is %d", idx, m_idleInputpower[idx]);
549 eDebug("[SEC] idleInputpower measure index(%d) out of bound !!!", idx);
552 case eSecCommand::MEASURE_RUNNING_INPUTPOWER:
553 m_runningInputpower = readInputpower();
554 eDebug("[SEC] runningInputpower is %d", m_runningInputpower);
555 ++m_sec_sequence.current();
557 case eSecCommand::SET_TIMEOUT:
558 m_timeoutCount = m_sec_sequence.current()++->val;
559 eDebug("[SEC] set timeout %d", m_timeoutCount);
561 case eSecCommand::UPDATE_CURRENT_ROTORPARAMS:
562 m_data[5] = m_data[3];
563 m_data[6] = m_data[4];
564 eDebug("[SEC] update current rotorparams %d %04x %d", m_timeoutCount, m_data[5], m_data[6]);
565 ++m_sec_sequence.current();
567 case eSecCommand::IF_TIMEOUT_GOTO:
570 eDebug("[SEC] rotor timout");
571 m_sec->setRotorMoving(false);
572 setSecSequencePos(m_sec_sequence.current()->steps);
575 ++m_sec_sequence.current();
577 case eSecCommand::SET_POWER_LIMITING_MODE:
580 ::open("/dev/i2c/1", O_RDWR) :
581 ::open("/dev/i2c/0", O_RDWR);
583 unsigned char data[2];
584 ::ioctl(fd, I2C_SLAVE_FORCE, 0x10 >> 1);
585 if(::read(fd, data, 1) != 1)
586 eDebug("[SEC] error read lnbp (%m)");
587 if ( m_sec_sequence.current()->mode == eSecCommand::modeStatic )
589 data[0] |= 0x80; // enable static current limiting
590 eDebug("[SEC] set static current limiting");
594 data[0] &= ~0x80; // enable dynamic current limiting
595 eDebug("[SEC] set dynamic current limiting");
597 if(::write(fd, data, 1) != 1)
598 eDebug("[SEC] error write lnbp (%m)");
600 ++m_sec_sequence.current();
603 case eSecCommand::IF_IDLE_INPUTPOWER_AVAIL_GOTO:
604 if (m_idleInputpower[0] && m_idleInputpower[1] && setSecSequencePos(m_sec_sequence.current()->steps))
606 ++m_sec_sequence.current();
608 case eSecCommand::IF_INPUTPOWER_DELTA_GOTO:
610 int idleInputpower = m_idleInputpower[ (m_curVoltage&1) ? 0 : 1];
611 eSecCommand::rotor &cmd = m_sec_sequence.current()->measure;
612 const char *txt = cmd.direction ? "running" : "stopped";
613 eDebug("[SEC] waiting for rotor %s %d, idle %d, delta %d",
618 if ( (cmd.direction && abs(m_runningInputpower - idleInputpower) >= cmd.deltaA)
619 || (!cmd.direction && abs(m_runningInputpower - idleInputpower) <= cmd.deltaA) )
622 eDebug("[SEC] rotor %s step %d ok", txt, cmd.okcount);
623 if ( cmd.okcount > 6 )
625 m_sec->setRotorMoving(cmd.direction);
626 eDebug("[SEC] rotor is %s", txt);
627 if (setSecSequencePos(cmd.steps))
633 eDebug("[SEC] rotor not %s... reset counter.. increase timeout", txt);
637 ++m_sec_sequence.current();
640 case eSecCommand::IF_VOLTAGE_GOTO:
642 eSecCommand::pair &compare = m_sec_sequence.current()->compare;
643 if ( compare.voltage == m_curVoltage && setSecSequencePos(compare.steps) )
645 ++m_sec_sequence.current();
649 ++m_sec_sequence.current();
650 eDebug("[SEC] unhandled sec command");
652 m_tuneTimer->start(delay,true);
656 void eDVBFrontend::setFrontend()
658 eDebug("setting frontend %d", m_fe);
659 if (ioctl(m_fd, FE_SET_FRONTEND, &parm) == -1)
661 perror("FE_SET_FRONTEND failed");
664 m_timeout->start(5000, 1); // 5 sec timeout. TODO: symbolrate dependent
667 RESULT eDVBFrontend::getFrontendType(int &t)
675 RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
677 eDebug("(%d)tune", m_fe);
684 m_sec_sequence.clear();
691 eDVBFrontendParametersSatellite feparm;
692 if (where.getDVBS(feparm))
694 eDebug("no dvbs data!");
699 eWarning("no SEC module active!");
703 res = m_sec->prepare(*this, parm, feparm, 1 << m_fe);
706 #if HAVE_DVB_API_VERSION < 3
707 eDebug("tuning to %d mhz", parm.Frequency/1000);
709 eDebug("tuning to %d mhz", parm.frequency/1000);
715 #if HAVE_DVB_API_VERSION >= 3
716 eDVBFrontendParametersCable feparm;
717 if (where.getDVBC(feparm))
719 #if HAVE_DVB_API_VERSION < 3
720 parm.Frequency = feparm.frequency * 1000;
721 parm.u.qam.SymbolRate = feparm.symbol_rate;
723 parm.frequency = feparm.frequency * 1000;
724 parm.u.qam.symbol_rate = feparm.symbol_rate;
726 fe_modulation_t mod=QAM_AUTO;
727 switch (feparm.modulation)
729 case eDVBFrontendParametersCable::Modulation::QAM16:
732 case eDVBFrontendParametersCable::Modulation::QAM32:
735 case eDVBFrontendParametersCable::Modulation::QAM64:
738 case eDVBFrontendParametersCable::Modulation::QAM128:
741 case eDVBFrontendParametersCable::Modulation::QAM256:
744 case eDVBFrontendParametersCable::Modulation::Auto:
748 #if HAVE_DVB_API_VERSION < 3
749 parm.u.qam.QAM = mod;
751 parm.u.qam.modulation = mod;
753 switch (feparm.inversion)
755 case eDVBFrontendParametersCable::Inversion::On:
756 #if HAVE_DVB_API_VERSION < 3
763 case eDVBFrontendParametersCable::Inversion::Off:
764 #if HAVE_DVB_API_VERSION < 3
771 case eDVBFrontendParametersCable::Inversion::Unknown:
772 #if HAVE_DVB_API_VERSION < 3
781 fe_code_rate_t fec_inner=FEC_AUTO;
782 switch (feparm.fec_inner)
784 case eDVBFrontendParametersCable::FEC::fNone:
785 fec_inner = FEC_NONE;
787 case eDVBFrontendParametersCable::FEC::f1_2:
790 case eDVBFrontendParametersCable::FEC::f2_3:
793 case eDVBFrontendParametersCable::FEC::f3_4:
796 case eDVBFrontendParametersCable::FEC::f4_5:
799 case eDVBFrontendParametersCable::FEC::f5_6:
802 case eDVBFrontendParametersCable::FEC::f6_7:
805 case eDVBFrontendParametersCable::FEC::f7_8:
808 case eDVBFrontendParametersCable::FEC::f8_9:
811 case eDVBFrontendParametersCable::FEC::fAuto:
812 fec_inner = FEC_AUTO;
815 #if HAVE_DVB_API_VERSION < 3
816 parm.u.qam.FEC_inner = fec_inner;
818 parm.u.qam.fec_inner = fec_inner;
821 eFatal("Old API not fully supported");
827 eDVBFrontendParametersTerrestrial feparm;
828 if (where.getDVBT(feparm))
830 eDebug("no -T data");
833 #if HAVE_DVB_API_VERSION < 3
834 parm.Frequency = feparm.frequency;
836 parm.frequency = feparm.frequency;
839 switch (feparm.bandwidth)
841 case eDVBFrontendParametersTerrestrial::Bandwidth::Bw8MHz:
842 #if HAVE_DVB_API_VERSION < 3
843 parm.u.ofdm.bandWidth =
845 parm.u.ofdm.bandwidth =
849 case eDVBFrontendParametersTerrestrial::Bandwidth::Bw7MHz:
850 #if HAVE_DVB_API_VERSION < 3
851 parm.u.ofdm.bandWidth =
853 parm.u.ofdm.bandwidth =
857 case eDVBFrontendParametersTerrestrial::Bandwidth::Bw6MHz:
858 #if HAVE_DVB_API_VERSION < 3
859 parm.u.ofdm.bandWidth =
861 parm.u.ofdm.bandwidth =
865 case eDVBFrontendParametersTerrestrial::Bandwidth::BwAuto:
866 #if HAVE_DVB_API_VERSION < 3
867 parm.u.ofdm.bandWidth =
869 parm.u.ofdm.bandwidth =
874 eWarning("invalid OFDM bandwith");
878 parm.u.ofdm.code_rate_HP = FEC_AUTO;
879 parm.u.ofdm.code_rate_LP = FEC_AUTO;
881 switch (feparm.modulation)
883 case eDVBFrontendParametersTerrestrial::Modulation::QPSK:
884 parm.u.ofdm.constellation = QPSK;
886 case eDVBFrontendParametersTerrestrial::Modulation::QAM16:
887 parm.u.ofdm.constellation = QAM_16;
889 case eDVBFrontendParametersTerrestrial::Modulation::Auto:
890 parm.u.ofdm.constellation = QAM_AUTO;
894 switch (feparm.transmission_mode)
896 case eDVBFrontendParametersTerrestrial::TransmissionMode::TM2k:
897 #if HAVE_DVB_API_VERSION < 3
898 parm.u.ofdm.TransmissionMode =
900 parm.u.ofdm.transmission_mode =
902 TRANSMISSION_MODE_2K;
904 case eDVBFrontendParametersTerrestrial::TransmissionMode::TM8k:
905 #if HAVE_DVB_API_VERSION < 3
906 parm.u.ofdm.TransmissionMode =
908 parm.u.ofdm.transmission_mode =
910 TRANSMISSION_MODE_8K;
912 case eDVBFrontendParametersTerrestrial::TransmissionMode::TMAuto:
913 #if HAVE_DVB_API_VERSION < 3
914 parm.u.ofdm.TransmissionMode =
916 parm.u.ofdm.transmission_mode =
918 TRANSMISSION_MODE_AUTO;
922 parm.u.ofdm.guard_interval = GUARD_INTERVAL_AUTO;
923 parm.u.ofdm.hierarchy_information = HIERARCHY_AUTO;
924 #if HAVE_DVB_API_VERSION < 3
934 m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
935 m_tuneTimer->start(0,true);
937 m_sec_sequence.current() = m_sec_sequence.begin();
939 if (m_state != stateTuning)
942 m_state = stateTuning;
943 m_stateChanged(this);
949 RESULT eDVBFrontend::connectStateChange(const Slot1<void,iDVBFrontend*> &stateChange, ePtr<eConnection> &connection)
951 connection = new eConnection(this, m_stateChanged.connect(stateChange));
955 RESULT eDVBFrontend::setVoltage(int voltage)
957 if (m_type != feSatellite)
959 #if HAVE_DVB_API_VERSION < 3
962 bool increased=false;
963 fe_sec_voltage_t vlt;
965 m_curVoltage=voltage;
969 for (int i=0; i < 3; ++i) // reset diseqc
971 vlt = SEC_VOLTAGE_OFF;
974 #if HAVE_DVB_API_VERSION < 3
975 vlt = SEC_VOLTAGE_13_5;
981 vlt = SEC_VOLTAGE_13;
984 #if HAVE_DVB_API_VERSION < 3
985 vlt = SEC_VOLTAGE_18_5;
991 vlt = SEC_VOLTAGE_18;
996 #if HAVE_DVB_API_VERSION < 3
997 return ::ioctl(m_secfd, SEC_SET_VOLTAGE, vlt);
999 if (::ioctl(m_fd, FE_ENABLE_HIGH_LNB_VOLTAGE, increased) < 0)
1000 perror("FE_ENABLE_HIGH_LNB_VOLTAGE");
1001 return ::ioctl(m_fd, FE_SET_VOLTAGE, vlt);
1005 RESULT eDVBFrontend::getState(int &state)
1011 RESULT eDVBFrontend::setTone(int t)
1013 if (m_type != feSatellite)
1015 #if HAVE_DVB_API_VERSION < 3
1018 fe_sec_tone_mode_t tone;
1027 tone = SEC_TONE_OFF;
1032 #if HAVE_DVB_API_VERSION < 3
1033 return ::ioctl(m_secfd, SEC_SET_TONE, tone);
1035 return ::ioctl(m_fd, FE_SET_TONE, tone);
1039 #if HAVE_DVB_API_VERSION < 3 && !defined(SEC_DISEQC_SEND_MASTER_CMD)
1040 #define SEC_DISEQC_SEND_MASTER_CMD _IOW('o', 97, struct secCommand *)
1043 RESULT eDVBFrontend::sendDiseqc(const eDVBDiseqcCommand &diseqc)
1045 #if HAVE_DVB_API_VERSION < 3
1046 struct secCommand cmd;
1047 cmd.type = SEC_CMDTYPE_DISEQC_RAW;
1048 cmd.u.diseqc.cmdtype = diseqc.data[0];
1049 cmd.u.diseqc.addr = diseqc.data[1];
1050 cmd.u.diseqc.cmd = diseqc.data[2];
1051 cmd.u.diseqc.numParams = diseqc.len-3;
1052 memcpy(cmd.u.diseqc.params, diseqc.data+3, diseqc.len-3);
1053 if (::ioctl(m_secfd, SEC_DISEQC_SEND_MASTER_CMD, &cmd))
1055 struct dvb_diseqc_master_cmd cmd;
1056 memcpy(cmd.msg, diseqc.data, diseqc.len);
1057 cmd.msg_len = diseqc.len;
1058 if (::ioctl(m_fd, FE_DISEQC_SEND_MASTER_CMD, &cmd))
1064 #if HAVE_DVB_API_VERSION < 3 && !defined(SEC_DISEQC_SEND_BURST)
1065 #define SEC_DISEQC_SEND_BURST _IO('o', 96)
1067 RESULT eDVBFrontend::sendToneburst(int burst)
1069 #if HAVE_DVB_API_VERSION < 3
1070 secMiniCmd cmd = SEC_MINI_NONE;
1071 if ( burst == eDVBSatelliteDiseqcParameters::A )
1073 else if ( burst == eDVBSatelliteDiseqcParameters::B )
1075 if (::ioctl(m_secfd, SEC_DISEQC_SEND_BURST, cmd))
1078 fe_sec_mini_cmd_t cmd = SEC_MINI_A;
1079 if ( burst == eDVBSatelliteDiseqcParameters::A )
1081 else if ( burst == eDVBSatelliteDiseqcParameters::B )
1085 eDebug("unknown toneburst!");
1088 if (::ioctl(m_fd, FE_DISEQC_SEND_BURST, cmd))
1094 RESULT eDVBFrontend::setSEC(iDVBSatelliteEquipmentControl *sec)
1100 RESULT eDVBFrontend::setSecSequence(const eSecCommandList &list)
1102 m_sec_sequence = list;
1106 RESULT eDVBFrontend::getData(int num, int &data)
1108 if ( num < (int)(sizeof(m_data)/sizeof(int)) )
1116 RESULT eDVBFrontend::setData(int num, int val)
1118 if ( num < (int)(sizeof(m_data)/sizeof(int)) )
1126 int eDVBFrontend::isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm)
1129 if (feparm->getSystem(type) || type != m_type)
1132 if (m_type == eDVBFrontend::feSatellite)
1135 eDVBFrontendParametersSatellite sat_parm;
1136 ASSERT(!feparm->getDVBS(sat_parm));
1137 return m_sec->canTune(sat_parm, this, 1 << m_fe);