lib/dvb/tstools.cpp: support for stream id extension defined in ISO 13818-1 Amendment...
[enigma2.git] / lib / dvb / frontend.cpp
index b91c0ca7aaedba63caefb050d9391362f4bfa606..c0263fb4024daf1b43d5e91e3f0bf7e5b5fbb85e 100644 (file)
@@ -604,7 +604,7 @@ int eDVBFrontend::closeFrontend(bool force)
                setVoltage(iDVBFrontend::voltageOff);
                m_tuneTimer->stop();
                if (m_sec && !m_simulate)
-                       m_sec->setRotorMoving(false);
+                       m_sec->setRotorMoving(m_slotid, false);
                if (!::close(m_fd))
                        m_fd=-1;
                else
@@ -666,15 +666,28 @@ void eDVBFrontend::feEvent(int w)
 #if HAVE_DVB_API_VERSION < 3
                if (event.type == FE_COMPLETION_EV)
 #else
-               eDebug("(%d)fe event: status %x, inversion %s", m_dvbid, event.status, (event.parameters.inversion == INVERSION_ON) ? "on" : "off");
+               eDebug("(%d)fe event: status %x, inversion %s, m_tuning %d", m_dvbid, event.status, (event.parameters.inversion == INVERSION_ON) ? "on" : "off", m_tuning);
                if (event.status & FE_HAS_LOCK)
 #endif
                {
                        state = stateLock;
                } else
                {
-                       if (m_tuning)
+                       if (m_tuning) {
                                state = stateTuning;
+#if HAVE_DVB_API_VERSION >= 3
+                               if (event.status & FE_TIMEDOUT) {
+                                       eDebug("FE_TIMEDOUT! ..abort");
+                                       m_tuneTimer->stop();
+                                       timeout();
+                                       return;
+                               }
+                               ++m_tuning;
+#else
+                               m_tuneTimer->stop();
+                               timeout();
+#endif
+                       }
                        else
                        {
                                eDebug("stateLostLock");
@@ -737,7 +750,7 @@ int eDVBFrontend::readFrontendData(int type)
                                float SDS_SNRE = snr << 16;
                                float snr_in_db;
 
-                               if (parm_u_qpsk_fec_inner <= FEC_AUTO) // DVB-S1 / QPSK
+                               if (oparm.sat.system == eDVBFrontendParametersSatellite::System_DVB_S) // DVB-S1 / QPSK
                                {
                                        static float SNR_COEFF[6] = {
                                                100.0 / 4194304.0,
@@ -791,7 +804,7 @@ int eDVBFrontend::readFrontendData(int type)
                                ret = (int)(snr_in_db * 100);
                        }
                        else if (strstr(m_description, "Alps BSBE1 C01A") ||
-                               !strcmp(m_description, "Alps -S(STV0288)"))
+                               strstr(m_description, "Alps -S(STV0288)"))
                        {
                                if (snr == 0)
                                        ret = 0;
@@ -860,7 +873,7 @@ int eDVBFrontend::readFrontendData(int type)
                                if (snr != 0)
                                        ret = 10 * (int)(-100 * (log10(snr) - log10(255)));
                        }
-                       else if (!strcmp(m_description, "BCM4506"))
+                       else if (strstr(m_description, "BCM4506") || strstr(m_description, "BCM4505"))
                                ret = (snr * 100) >> 8;
 
                        if (type == signalQuality)
@@ -1681,12 +1694,12 @@ void eDVBFrontend::tuneLoop()  // called by m_tuneTimer
                                break;
                        case eSecCommand::SET_ROTOR_MOVING:
                                if (!m_simulate)
-                                       m_sec->setRotorMoving(true);
+                                       m_sec->setRotorMoving(m_slotid, true);
                                ++m_sec_sequence.current();
                                break;
                        case eSecCommand::SET_ROTOR_STOPPED:
                                if (!m_simulate)
-                                       m_sec->setRotorMoving(false);
+                                       m_sec->setRotorMoving(m_slotid, false);
                                ++m_sec_sequence.current();
                                break;
                        case eSecCommand::IF_INPUTPOWER_DELTA_GOTO:
@@ -1845,7 +1858,6 @@ void eDVBFrontend::setFrontend(bool recvEvents)
                if (recvEvents)
                        m_sn->start();
                feEvent(-1); // flush events
-               if (ioctl(m_fd, FE_SET_FRONTEND, &parm) == -1)
 #if HAVE_DVB_API_VERSION >= 5
                if (m_type == iDVBFrontend::feSatellite)
                {
@@ -1881,12 +1893,12 @@ void eDVBFrontend::setFrontend(bool recvEvents)
                        cmdseq.props = p;
                        p[0].cmd = DTV_CLEAR;
                        p[1].cmd = DTV_DELIVERY_SYSTEM, p[1].u.data = system;
-                       p[2].cmd = DTV_FREQUENCY,       p[1].u.data = parm_frequency;
+                       p[2].cmd = DTV_FREQUENCY,       p[2].u.data = parm_frequency;
                        p[3].cmd = DTV_MODULATION,      p[3].u.data = modulation;
                        p[4].cmd = DTV_SYMBOL_RATE,     p[4].u.data = parm_u_qpsk_symbol_rate;
                        p[5].cmd = DTV_INNER_FEC,       p[5].u.data = parm_u_qpsk_fec_inner;
                        p[6].cmd = DTV_INVERSION,       p[6].u.data = parm_inversion;
-                       if (system = SYS_DVBS2)
+                       if (system == SYS_DVBS2)
                        {
                                p[7].cmd = DTV_ROLLOFF,         p[7].u.data = rolloff;
                                p[8].cmd = DTV_PILOT,           p[8].u.data = pilot;
@@ -2332,7 +2344,7 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
                        goto tune_error;
                }
                if (!m_simulate)
-                       m_sec->setRotorMoving(false);
+                       m_sec->setRotorMoving(m_slotid, false);
                res=prepare_sat(feparm, timeout);
                if (res)
                        goto tune_error;
@@ -2388,9 +2400,9 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
        if (!m_simulate)
        {
                m_tuneTimer->start(0,true);
+               m_tuning = 1;
                if (m_state != stateTuning)
                {
-                       m_tuning = 1;
                        m_state = stateTuning;
                        m_stateChanged(this);
                }