2 #include <lib/dvb/dvb.h>
3 #include <lib/base/eerror.h>
9 #ifndef I2C_SLAVE_FORCE
10 #define I2C_SLAVE_FORCE 0x0706
13 #if HAVE_DVB_API_VERSION < 3
14 #include <ost/frontend.h>
16 #define QAM_AUTO (Modulation)6
17 #define TRANSMISSION_MODE_AUTO (TransmitMode)2
18 #define BANDWIDTH_AUTO (BandWidth)3
19 #define GUARD_INTERVAL_AUTO (GuardInterval)4
20 #define HIERARCHY_AUTO (Hierarchy)4
21 #define constellation Constellation
22 #define guard_interval guardInterval
23 #define hierarchy_information HierarchyInformation
24 #define code_rate_HP HP_CodeRate
25 #define code_rate_LP LP_CodeRate
27 #include <linux/dvb/frontend.h>
30 #include <dvbsi++/satellite_delivery_system_descriptor.h>
31 #include <dvbsi++/cable_delivery_system_descriptor.h>
32 #include <dvbsi++/terrestrial_delivery_system_descriptor.h>
34 void eDVBFrontendParametersSatellite::set(const SatelliteDeliverySystemDescriptor &descriptor)
36 frequency = descriptor.getFrequency() * 10;
37 symbol_rate = descriptor.getSymbolRate() * 100;
38 switch (descriptor.getPolarization())
41 polarisation = Polarisation::Horizontal;
44 polarisation = Polarisation::Vertical;
47 polarisation = Polarisation::CircularLeft;
50 polarisation = Polarisation::CircularRight;
53 switch (descriptor.getFecInner())
77 inversion = Inversion::Unknown;
78 orbital_position = ((descriptor.getOrbitalPosition() >> 12) & 0xF) * 1000;
79 orbital_position += ((descriptor.getOrbitalPosition() >> 8) & 0xF) * 100;
80 orbital_position += ((descriptor.getOrbitalPosition() >> 4) & 0xF) * 10;
81 orbital_position += ((descriptor.getOrbitalPosition()) & 0xF);
82 if (orbital_position && (!descriptor.getWestEastFlag()))
83 orbital_position = 3600 - orbital_position;
86 void eDVBFrontendParametersCable::set(const CableDeliverySystemDescriptor &descriptor)
91 void eDVBFrontendParametersTerrestrial::set(const TerrestrialDeliverySystemDescriptor &)
96 eDVBFrontendParameters::eDVBFrontendParameters(): m_type(-1)
100 DEFINE_REF(eDVBFrontendParameters);
102 RESULT eDVBFrontendParameters::getSystem(int &t) const
110 RESULT eDVBFrontendParameters::getDVBS(eDVBFrontendParametersSatellite &p) const
112 if (m_type != iDVBFrontend::feSatellite)
118 RESULT eDVBFrontendParameters::getDVBC(eDVBFrontendParametersCable &p) const
120 if (m_type != iDVBFrontend::feCable)
126 RESULT eDVBFrontendParameters::getDVBT(eDVBFrontendParametersTerrestrial &p) const
128 if (m_type != iDVBFrontend::feTerrestrial)
134 RESULT eDVBFrontendParameters::setDVBS(const eDVBFrontendParametersSatellite &p)
137 m_type = iDVBFrontend::feSatellite;
141 RESULT eDVBFrontendParameters::setDVBC(const eDVBFrontendParametersCable &p)
144 m_type = iDVBFrontend::feCable;
148 RESULT eDVBFrontendParameters::setDVBT(const eDVBFrontendParametersTerrestrial &p)
151 m_type = iDVBFrontend::feTerrestrial;
155 RESULT eDVBFrontendParameters::calculateDifference(const iDVBFrontendParameters *parm, int &diff) const
160 if (parm->getSystem(type))
164 diff = 1<<30; // big difference
170 case iDVBFrontend::feSatellite:
172 eDVBFrontendParametersSatellite osat;
173 if (parm->getDVBS(osat))
176 if (sat.orbital_position != osat.orbital_position)
178 else if (sat.polarisation != osat.polarisation)
182 diff = abs(sat.frequency - osat.frequency);
183 diff += abs(sat.symbol_rate - osat.symbol_rate);
187 case iDVBFrontend::feCable:
188 case iDVBFrontend::feTerrestrial:
195 RESULT eDVBFrontendParameters::getHash(unsigned long &hash) const
199 case iDVBFrontend::feSatellite:
201 hash = (sat.orbital_position << 16);
202 hash |= ((sat.frequency/1000)&0xFFFF)|((sat.polarisation&1) << 15);
205 case iDVBFrontend::feCable:
206 case iDVBFrontend::feTerrestrial:
212 DEFINE_REF(eDVBFrontend);
214 eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok)
215 :m_type(-1), m_fe(fe), m_timeout(0), m_tuneTimer(0), m_fd(-1)
216 #if HAVE_DVB_API_VERSION < 3
220 #if HAVE_DVB_API_VERSION < 3
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());
334 eDebug("close frontend %d", m_fe);
340 #if HAVE_DVB_API_VERSION < 3
350 setTone(iDVBFrontend::toneOff);
351 setVoltage(iDVBFrontend::voltageOff);
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;
403 if (m_state != stateLostLock)
404 eDebug("FIXME: we lost lock, so we might have to retune.");
407 if (m_state != state)
410 m_stateChanged(this);
415 void eDVBFrontend::timeout()
418 if (m_state == stateTuning)
421 eDebug("DVBFrontend: timeout");
422 if (m_state != state)
425 m_stateChanged(this);
432 int eDVBFrontend::readFrontendData(int type)
439 if (ioctl(m_fd, FE_READ_BER, &ber) < 0 && errno != ERANGE)
440 eDebug("FE_READ_BER failed (%m)");
446 if (ioctl(m_fd, FE_READ_SNR, &snr) < 0 && errno != ERANGE)
447 eDebug("FE_READ_SNR failed (%m)");
453 if (ioctl(m_fd, FE_READ_SIGNAL_STRENGTH, &strength) < 0 && errno != ERANGE)
454 eDebug("FE_READ_SIGNAL_STRENGTH failed (%m)");
461 #ifndef FP_IOCTL_GET_ID
462 #define FP_IOCTL_GET_ID 0
464 int eDVBFrontend::readInputpower()
466 int power=m_fe; // this is needed for read inputpower from the correct tuner !
468 // open front prozessor
469 int fp=::open("/dev/dbox/fp0", O_RDWR);
472 eDebug("couldn't open fp");
475 static bool old_fp = (::ioctl(fp, FP_IOCTL_GET_ID) < 0);
476 if ( ioctl( fp, old_fp ? 9 : 0x100, &power ) < 0 )
478 eDebug("FP_IOCTL_GET_LNB_CURRENT failed (%m)");
486 bool eDVBFrontend::setSecSequencePos(int steps)
488 eDebug("set sequence pos %d", steps);
493 if (m_sec_sequence.current() != m_sec_sequence.end())
494 ++m_sec_sequence.current();
499 if (m_sec_sequence.current() != m_sec_sequence.begin() && m_sec_sequence.current() != m_sec_sequence.end())
500 --m_sec_sequence.current();
506 void eDVBFrontend::tuneLoop() // called by m_tuneTimer
509 if ( m_sec_sequence && m_sec_sequence.current() != m_sec_sequence.end() )
511 switch (m_sec_sequence.current()->cmd)
513 case eSecCommand::SLEEP:
514 delay = m_sec_sequence.current()++->msec;
515 eDebug("[SEC] sleep %dms", delay);
517 case eSecCommand::GOTO:
518 if ( !setSecSequencePos(m_sec_sequence.current()->steps) )
519 ++m_sec_sequence.current();
521 case eSecCommand::SET_VOLTAGE:
522 int voltage = m_sec_sequence.current()++->voltage;
523 eDebug("[SEC] setVoltage %d", voltage);
526 case eSecCommand::SET_TONE:
527 eDebug("[SEC] setTone %d", m_sec_sequence.current()->tone);
528 setTone(m_sec_sequence.current()++->tone);
530 case eSecCommand::SEND_DISEQC:
531 sendDiseqc(m_sec_sequence.current()->diseqc);
532 eDebugNoNewLine("[SEC] sendDiseqc: ");
533 for (int i=0; i < m_sec_sequence.current()->diseqc.len; ++i)
534 eDebugNoNewLine("%02x", m_sec_sequence.current()->diseqc.data[i]);
536 ++m_sec_sequence.current();
538 case eSecCommand::SEND_TONEBURST:
539 eDebug("[SEC] sendToneburst: %d", m_sec_sequence.current()->toneburst);
540 sendToneburst(m_sec_sequence.current()++->toneburst);
542 case eSecCommand::SET_FRONTEND:
543 eDebug("[SEC] setFrontend");
545 ++m_sec_sequence.current();
547 case eSecCommand::MEASURE_IDLE_INPUTPOWER:
549 int idx = m_sec_sequence.current()++->val;
550 if ( idx == 0 || idx == 1 )
552 m_idleInputpower[idx] = readInputpower();
553 eDebug("[SEC] idleInputpower[%d] is %d", idx, m_idleInputpower[idx]);
556 eDebug("[SEC] idleInputpower measure index(%d) out of bound !!!", idx);
559 case eSecCommand::MEASURE_RUNNING_INPUTPOWER:
560 m_runningInputpower = readInputpower();
561 eDebug("[SEC] runningInputpower is %d", m_runningInputpower);
562 ++m_sec_sequence.current();
564 case eSecCommand::SET_TIMEOUT:
565 m_timeoutCount = m_sec_sequence.current()++->val;
566 eDebug("[SEC] set timeout %d", m_timeoutCount);
568 case eSecCommand::UPDATE_CURRENT_ROTORPARAMS:
569 m_data[5] = m_data[3];
570 m_data[6] = m_data[4];
571 eDebug("[SEC] update current rotorparams %d %04x %d", m_timeoutCount, m_data[5], m_data[6]);
572 ++m_sec_sequence.current();
574 case eSecCommand::IF_TIMEOUT_GOTO:
577 eDebug("[SEC] rotor timout");
578 m_sec->setRotorMoving(false);
579 setSecSequencePos(m_sec_sequence.current()->steps);
582 ++m_sec_sequence.current();
584 case eSecCommand::SET_POWER_LIMITING_MODE:
587 ::open("/dev/i2c/1", O_RDWR) :
588 ::open("/dev/i2c/0", O_RDWR);
590 unsigned char data[2];
591 ::ioctl(fd, I2C_SLAVE_FORCE, 0x10 >> 1);
592 if(::read(fd, data, 1) != 1)
593 eDebug("[SEC] error read lnbp (%m)");
594 if ( m_sec_sequence.current()->mode == eSecCommand::modeStatic )
596 data[0] |= 0x90; // enable static current limiting
597 eDebug("[SEC] set static current limiting");
601 data[0] &= ~0x90; // enable dynamic current limiting
602 eDebug("[SEC] set dynamic current limiting");
604 if(::write(fd, data, 1) != 1)
605 eDebug("[SEC] error write lnbp (%m)");
607 ++m_sec_sequence.current();
610 case eSecCommand::IF_IDLE_INPUTPOWER_AVAIL_GOTO:
611 if (m_idleInputpower[0] && m_idleInputpower[1] && setSecSequencePos(m_sec_sequence.current()->steps))
613 ++m_sec_sequence.current();
615 case eSecCommand::IF_INPUTPOWER_DELTA_GOTO:
617 int idleInputpower = m_idleInputpower[m_curVoltage == iDVBFrontend::voltage13 ? 0 : 1];
618 eSecCommand::rotor &cmd = m_sec_sequence.current()->measure;
619 const char *txt = cmd.direction ? "running" : "stopped";
620 eDebug("[SEC] waiting for rotor %s %d, idle %d, delta %d",
625 if ( (cmd.direction && abs(m_runningInputpower - idleInputpower) >= cmd.deltaA)
626 || (!cmd.direction && abs(m_runningInputpower - idleInputpower) <= cmd.deltaA) )
629 eDebug("[SEC] rotor %s step %d ok", txt, cmd.okcount);
630 if ( cmd.okcount > 6 )
632 m_sec->setRotorMoving(cmd.direction);
633 eDebug("[SEC] rotor is %s", txt);
634 if (setSecSequencePos(cmd.steps))
640 eDebug("[SEC] rotor not %s... reset counter.. increase timeout", txt);
644 ++m_sec_sequence.current();
647 case eSecCommand::IF_VOLTAGE_GOTO:
649 eSecCommand::pair &compare = m_sec_sequence.current()->compare;
650 if ( compare.voltage == m_curVoltage && setSecSequencePos(compare.steps) )
652 ++m_sec_sequence.current();
656 ++m_sec_sequence.current();
657 eDebug("[SEC] unhandled sec command");
659 m_tuneTimer->start(delay,true);
663 void eDVBFrontend::setFrontend()
665 eDebug("setting frontend %d", m_fe);
666 if (ioctl(m_fd, FE_SET_FRONTEND, &parm) == -1)
668 perror("FE_SET_FRONTEND failed");
672 if (m_state != stateTuning)
675 m_state = stateTuning;
676 m_stateChanged(this);
678 m_timeout->start(5000, 1); // 5 sec timeout. TODO: symbolrate dependent
681 RESULT eDVBFrontend::getFrontendType(int &t)
689 RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
691 eDebug("(%d)tune", m_fe);
698 m_sec_sequence.clear();
705 eDVBFrontendParametersSatellite feparm;
706 if (where.getDVBS(feparm))
708 eDebug("no dvbs data!");
713 eWarning("no SEC module active!");
717 res = m_sec->prepare(*this, parm, feparm, 1 << m_fe);
720 #if HAVE_DVB_API_VERSION < 3
721 eDebug("tuning to %d mhz", parm.Frequency/1000);
723 eDebug("tuning to %d mhz", parm.frequency/1000);
729 #if HAVE_DVB_API_VERSION >= 3
730 eDVBFrontendParametersCable feparm;
731 if (where.getDVBC(feparm))
733 #if HAVE_DVB_API_VERSION < 3
734 parm.Frequency = feparm.frequency * 1000;
735 parm.u.qam.SymbolRate = feparm.symbol_rate;
737 parm.frequency = feparm.frequency * 1000;
738 parm.u.qam.symbol_rate = feparm.symbol_rate;
740 fe_modulation_t mod=QAM_AUTO;
741 switch (feparm.modulation)
743 case eDVBFrontendParametersCable::Modulation::QAM16:
746 case eDVBFrontendParametersCable::Modulation::QAM32:
749 case eDVBFrontendParametersCable::Modulation::QAM64:
752 case eDVBFrontendParametersCable::Modulation::QAM128:
755 case eDVBFrontendParametersCable::Modulation::QAM256:
758 case eDVBFrontendParametersCable::Modulation::Auto:
762 #if HAVE_DVB_API_VERSION < 3
763 parm.u.qam.QAM = mod;
765 parm.u.qam.modulation = mod;
767 switch (feparm.inversion)
769 case eDVBFrontendParametersCable::Inversion::On:
770 #if HAVE_DVB_API_VERSION < 3
777 case eDVBFrontendParametersCable::Inversion::Off:
778 #if HAVE_DVB_API_VERSION < 3
785 case eDVBFrontendParametersCable::Inversion::Unknown:
786 #if HAVE_DVB_API_VERSION < 3
795 fe_code_rate_t fec_inner=FEC_AUTO;
796 switch (feparm.fec_inner)
798 case eDVBFrontendParametersCable::FEC::fNone:
799 fec_inner = FEC_NONE;
801 case eDVBFrontendParametersCable::FEC::f1_2:
804 case eDVBFrontendParametersCable::FEC::f2_3:
807 case eDVBFrontendParametersCable::FEC::f3_4:
810 case eDVBFrontendParametersCable::FEC::f4_5:
813 case eDVBFrontendParametersCable::FEC::f5_6:
816 case eDVBFrontendParametersCable::FEC::f6_7:
819 case eDVBFrontendParametersCable::FEC::f7_8:
822 case eDVBFrontendParametersCable::FEC::f8_9:
825 case eDVBFrontendParametersCable::FEC::fAuto:
826 fec_inner = FEC_AUTO;
829 #if HAVE_DVB_API_VERSION < 3
830 parm.u.qam.FEC_inner = fec_inner;
832 parm.u.qam.fec_inner = fec_inner;
835 eFatal("Old API not fully supported");
841 eDVBFrontendParametersTerrestrial feparm;
842 if (where.getDVBT(feparm))
844 eDebug("no -T data");
847 #if HAVE_DVB_API_VERSION < 3
848 parm.Frequency = feparm.frequency;
850 parm.frequency = feparm.frequency;
853 switch (feparm.bandwidth)
855 case eDVBFrontendParametersTerrestrial::Bandwidth::Bw8MHz:
856 #if HAVE_DVB_API_VERSION < 3
857 parm.u.ofdm.bandWidth =
859 parm.u.ofdm.bandwidth =
863 case eDVBFrontendParametersTerrestrial::Bandwidth::Bw7MHz:
864 #if HAVE_DVB_API_VERSION < 3
865 parm.u.ofdm.bandWidth =
867 parm.u.ofdm.bandwidth =
871 case eDVBFrontendParametersTerrestrial::Bandwidth::Bw6MHz:
872 #if HAVE_DVB_API_VERSION < 3
873 parm.u.ofdm.bandWidth =
875 parm.u.ofdm.bandwidth =
879 case eDVBFrontendParametersTerrestrial::Bandwidth::BwAuto:
880 #if HAVE_DVB_API_VERSION < 3
881 parm.u.ofdm.bandWidth =
883 parm.u.ofdm.bandwidth =
888 eWarning("invalid OFDM bandwith");
892 parm.u.ofdm.code_rate_HP = FEC_AUTO;
893 parm.u.ofdm.code_rate_LP = FEC_AUTO;
895 switch (feparm.modulation)
897 case eDVBFrontendParametersTerrestrial::Modulation::QPSK:
898 parm.u.ofdm.constellation = QPSK;
900 case eDVBFrontendParametersTerrestrial::Modulation::QAM16:
901 parm.u.ofdm.constellation = QAM_16;
903 case eDVBFrontendParametersTerrestrial::Modulation::Auto:
904 parm.u.ofdm.constellation = QAM_AUTO;
908 switch (feparm.transmission_mode)
910 case eDVBFrontendParametersTerrestrial::TransmissionMode::TM2k:
911 #if HAVE_DVB_API_VERSION < 3
912 parm.u.ofdm.TransmissionMode =
914 parm.u.ofdm.transmission_mode =
916 TRANSMISSION_MODE_2K;
918 case eDVBFrontendParametersTerrestrial::TransmissionMode::TM8k:
919 #if HAVE_DVB_API_VERSION < 3
920 parm.u.ofdm.TransmissionMode =
922 parm.u.ofdm.transmission_mode =
924 TRANSMISSION_MODE_8K;
926 case eDVBFrontendParametersTerrestrial::TransmissionMode::TMAuto:
927 #if HAVE_DVB_API_VERSION < 3
928 parm.u.ofdm.TransmissionMode =
930 parm.u.ofdm.transmission_mode =
932 TRANSMISSION_MODE_AUTO;
936 parm.u.ofdm.guard_interval = GUARD_INTERVAL_AUTO;
937 parm.u.ofdm.hierarchy_information = HIERARCHY_AUTO;
938 #if HAVE_DVB_API_VERSION < 3
948 m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
949 m_tuneTimer->start(0,true);
950 m_sec_sequence.current() = m_sec_sequence.begin();
955 RESULT eDVBFrontend::connectStateChange(const Slot1<void,iDVBFrontend*> &stateChange, ePtr<eConnection> &connection)
957 connection = new eConnection(this, m_stateChanged.connect(stateChange));
961 RESULT eDVBFrontend::setVoltage(int voltage)
963 if (m_type != feSatellite)
965 #if HAVE_DVB_API_VERSION < 3
968 fe_sec_voltage_t vlt;
971 m_curVoltage=voltage;
975 for (int i=0; i < 3; ++i) // reset diseqc
977 vlt = SEC_VOLTAGE_OFF;
980 vlt = SEC_VOLTAGE_13;
983 vlt = SEC_VOLTAGE_18;
988 #if HAVE_DVB_API_VERSION < 3
989 return ::ioctl(m_secfd, SEC_SET_VOLTAGE, vlt);
991 return ::ioctl(m_fd, FE_SET_VOLTAGE, vlt);
995 RESULT eDVBFrontend::getState(int &state)
1001 RESULT eDVBFrontend::setTone(int t)
1003 if (m_type != feSatellite)
1005 #if HAVE_DVB_API_VERSION < 3
1008 fe_sec_tone_mode_t tone;
1017 tone = SEC_TONE_OFF;
1022 #if HAVE_DVB_API_VERSION < 3
1023 return ::ioctl(m_secfd, SEC_SET_TONE, tone);
1025 return ::ioctl(m_fd, FE_SET_TONE, tone);
1029 #if HAVE_DVB_API_VERSION < 3 && !defined(SEC_DISEQC_SEND_MASTER_CMD)
1030 #define SEC_DISEQC_SEND_MASTER_CMD _IOW('o', 97, struct secCommand *)
1033 RESULT eDVBFrontend::sendDiseqc(const eDVBDiseqcCommand &diseqc)
1035 #if HAVE_DVB_API_VERSION < 3
1036 struct secCommand cmd;
1037 cmd.type = SEC_CMDTYPE_DISEQC_RAW;
1038 cmd.u.diseqc.cmdtype = diseqc.data[0];
1039 cmd.u.diseqc.addr = diseqc.data[1];
1040 cmd.u.diseqc.cmd = diseqc.data[2];
1041 cmd.u.diseqc.numParams = diseqc.len-3;
1042 memcpy(cmd.u.diseqc.params, diseqc.data+3, diseqc.len-3);
1043 if (::ioctl(m_secfd, SEC_DISEQC_SEND_MASTER_CMD, &cmd))
1045 struct dvb_diseqc_master_cmd cmd;
1046 memcpy(cmd.msg, diseqc.data, diseqc.len);
1047 cmd.msg_len = diseqc.len;
1048 if (::ioctl(m_fd, FE_DISEQC_SEND_MASTER_CMD, &cmd))
1054 #if HAVE_DVB_API_VERSION < 3 && !defined(SEC_DISEQC_SEND_BURST)
1055 #define SEC_DISEQC_SEND_BURST _IO('o', 96)
1057 RESULT eDVBFrontend::sendToneburst(int burst)
1059 #if HAVE_DVB_API_VERSION < 3
1060 secMiniCmd cmd = SEC_MINI_NONE;
1061 if ( burst == eDVBSatelliteDiseqcParameters::A )
1063 else if ( burst == eDVBSatelliteDiseqcParameters::B )
1065 if (::ioctl(m_secfd, SEC_DISEQC_SEND_BURST, cmd))
1068 fe_sec_mini_cmd_t cmd = SEC_MINI_A;
1069 if ( burst == eDVBSatelliteDiseqcParameters::A )
1071 else if ( burst == eDVBSatelliteDiseqcParameters::B )
1075 eDebug("unknown toneburst!");
1078 if (::ioctl(m_fd, FE_DISEQC_SEND_BURST, cmd))
1084 RESULT eDVBFrontend::setSEC(iDVBSatelliteEquipmentControl *sec)
1090 RESULT eDVBFrontend::setSecSequence(const eSecCommandList &list)
1092 m_sec_sequence = list;
1096 RESULT eDVBFrontend::getData(int num, int &data)
1098 if ( num < (int)(sizeof(m_data)/sizeof(int)) )
1106 RESULT eDVBFrontend::setData(int num, int val)
1108 if ( num < (int)(sizeof(m_data)/sizeof(int)) )
1116 int eDVBFrontend::isCompatibleWith(ePtr<iDVBFrontendParameters> &feparm)
1119 if (feparm->getSystem(type) || type != m_type)
1122 if (m_type == eDVBFrontend::feSatellite)
1125 eDVBFrontendParametersSatellite sat_parm;
1126 ASSERT(!feparm->getDVBS(sat_parm));
1127 return m_sec->canTune(sat_parm, this, 1 << m_fe);