small private epg fix
[enigma2.git] / lib / dvb / frontend.cpp
index 220d3e87ad995c92dd0206211bb7c9afde218674..1040d7cd55ae1a1d29077ee42010c7c735bb7c14 100644 (file)
@@ -1,5 +1,6 @@
 #include <lib/dvb/dvb.h>
 #include <lib/base/eerror.h>
+#include <lib/base/nconfig.h> // access to python config
 #include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -91,7 +92,6 @@ void eDVBDiseqcCommand::setCommandString(const char *str)
                eDebug("invalid diseqc command string length (string is to long)");
                return;
        }
-       eDebugNoNewLine("send diseqc:");
        unsigned char val=0;
        for (int i=0; i < slen; ++i)
        {
@@ -108,13 +108,11 @@ void eDVBDiseqcCommand::setCommandString(const char *str)
                if ( i % 2 )
                {
                        val |= c;
-                       eDebugNoNewLine("%02x", val);
                        data[i/2] = val;
                }
                else
                        val = c << 4;
        }
-       eDebug("");
        len = slen/2;
 }
 
@@ -546,9 +544,6 @@ void eDVBFrontend::feEvent(int w)
 #endif
                {
                        state = stateLock;
-                       m_data[CSW] = m_data[NEW_CSW];
-                       m_data[UCSW] = m_data[NEW_UCSW];
-                       m_data[TONEBURST] = m_data[NEW_TONEBURST];
                } else
                {
                        if (m_tuning)
@@ -1008,6 +1003,7 @@ PyObject *eDVBFrontend::readTransponderData(bool original)
                                eDebug("FE_GET_FRONTEND (%m)");
                        else
                        {
+                               const FRONTENDPARAMETERS &parm = original ? this->parm : front;
                                tmp = "INVERSION_AUTO";
                                switch(parm_inversion)
                                {
@@ -1685,6 +1681,12 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
 
        int res=0;
 
+       if (!m_sn)
+       {
+               eDebug("no frontend device opened... do not try to tune !!!");
+               return -ENODEV;
+       }
+
        if (m_type == -1)
                return -ENODEV;
 
@@ -1730,6 +1732,18 @@ RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
                if (!res)
                {
                        m_sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT) );
+                       eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*)m_data[LINKED_PREV_PTR];
+                       if (linked_fe == (eDVBRegisteredFrontend*)-1)
+                       {
+                               std::string enable_5V;
+                               ePythonConfigQuery::getConfigValue("config.terrestrial.enable_5V", enable_5V);
+                               if (enable_5V == "yes")
+                                       m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltage13) );
+                               else
+                                       m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltageOff) );
+                       }
+                       else
+                               m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_VOLTAGE, iDVBFrontend::voltageOff) );
                        m_sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) );
                }
                break;
@@ -1760,7 +1774,7 @@ RESULT eDVBFrontend::connectStateChange(const Slot1<void,iDVBFrontend*> &stateCh
 
 RESULT eDVBFrontend::setVoltage(int voltage)
 {
-       if (m_type != feSatellite)
+       if (m_type == feCable)
                return -1;
 #if HAVE_DVB_API_VERSION < 3
        secVoltage vlt;
@@ -1802,7 +1816,7 @@ RESULT eDVBFrontend::setVoltage(int voltage)
 #if HAVE_DVB_API_VERSION < 3
        return ::ioctl(m_secfd, SEC_SET_VOLTAGE, vlt);
 #else
-       if (::ioctl(m_fd, FE_ENABLE_HIGH_LNB_VOLTAGE, increased) < 0)
+       if (m_type == feSatellite && ::ioctl(m_fd, FE_ENABLE_HIGH_LNB_VOLTAGE, increased) < 0)
                perror("FE_ENABLE_HIGH_LNB_VOLTAGE");
        return ::ioctl(m_fd, FE_SET_VOLTAGE, vlt);
 #endif