rotor running detection should now work ( yet only with measure input power )
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 1 Dec 2005 09:49:12 +0000 (09:49 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 1 Dec 2005 09:49:12 +0000 (09:49 +0000)
lib/dvb/frontend.cpp
lib/dvb/idvb.h
lib/dvb/sec.cpp
lib/dvb/sec.h

index a05963cd2bd892df8fc173edbfb3ba8a39cb73d6..795841b830abd1d06806cbd34240945a88cbd24c 100644 (file)
@@ -292,6 +292,10 @@ eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok): m_type(-1), m_fe(fe), m_c
        for (int i=0; i<entries; ++i)
                m_data[i] = -1;
 
        for (int i=0; i<entries; ++i)
                m_data[i] = -1;
 
+       m_data[7] = !m_fe;
+
+       eDebug("m_data[7] = %d %d", m_data[7], m_fe);
+
        return;
 }
 
        return;
 }
 
@@ -333,7 +337,7 @@ void eDVBFrontend::feEvent(int w)
 #if HAVE_DVB_API_VERSION < 3
                if (event.type == FE_COMPLETION_EV)
 #else
 #if HAVE_DVB_API_VERSION < 3
                if (event.type == FE_COMPLETION_EV)
 #else
-               eDebug("fe event: status %x, inversion %s", event.status, (event.parameters.inversion == INVERSION_ON) ? "on" : "off");
+               eDebug("(%d)fe event: status %x, inversion %s", m_fe, event.status, (event.parameters.inversion == INVERSION_ON) ? "on" : "off");
                if (event.status & FE_HAS_LOCK)
 #endif
                {
                if (event.status & FE_HAS_LOCK)
 #endif
                {
@@ -503,6 +507,7 @@ void eDVBFrontend::tuneLoop()  // called by m_tuneTimer
                                if (!m_timeoutCount)
                                {
                                        eDebug("[SEC] rotor timout");
                                if (!m_timeoutCount)
                                {
                                        eDebug("[SEC] rotor timout");
+                                       m_sec->setRotorMoving(false);
                                        setSecSequencePos(m_sec_sequence.current()->steps);
                                }
                                else
                                        setSecSequencePos(m_sec_sequence.current()->steps);
                                }
                                else
@@ -553,6 +558,7 @@ void eDVBFrontend::tuneLoop()  // called by m_tuneTimer
                                        eDebug("[SEC] rotor %s step %d ok", txt, cmd.okcount);
                                        if ( cmd.okcount > 6 )
                                        {
                                        eDebug("[SEC] rotor %s step %d ok", txt, cmd.okcount);
                                        if ( cmd.okcount > 6 )
                                        {
+                                               m_sec->setRotorMoving(cmd.direction);
                                                eDebug("[SEC] rotor is %s", txt);
                                                if (setSecSequencePos(cmd.steps))
                                                        break;
                                                eDebug("[SEC] rotor is %s", txt);
                                                if (setSecSequencePos(cmd.steps))
                                                        break;
@@ -611,6 +617,8 @@ RESULT eDVBFrontend::getFrontendType(int &t)
 
 RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
 {
 
 RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
 {
+       eDebug("(%d)tune", m_fe);
+
        if (m_type == -1)
                return -ENODEV;
 
        if (m_type == -1)
                return -ENODEV;
 
@@ -1009,6 +1017,8 @@ RESULT eDVBFrontend::setData(int num, int val)
 {
        if ( num < (int)(sizeof(m_data)/sizeof(int)) )
        {
 {
        if ( num < (int)(sizeof(m_data)/sizeof(int)) )
        {
+               if ( num == 0 )
+                       eDebug("(%d) set csw %02x", m_fe, val);
                m_data[num] = val;
                return 0;
        }
                m_data[num] = val;
                return 0;
        }
index 699474d3981593638e5e93b628ac287c98ff9036..119b6e3752d1c97e3b6ebac4a1d0325dd8e023b3 100644 (file)
@@ -355,6 +355,7 @@ class iDVBSatelliteEquipmentControl: public iObject
 public:
        virtual RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat, int frontend_id)=0;
        virtual int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *fe, int frontend_id)=0;
 public:
        virtual RESULT prepare(iDVBFrontend &frontend, FRONTENDPARAMETERS &parm, eDVBFrontendParametersSatellite &sat, int frontend_id)=0;
        virtual int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *fe, int frontend_id)=0;
+       virtual void setRotorMoving(bool)=0;
 };
 
 struct eDVBCIRouting
 };
 
 struct eDVBCIRouting
index 48ab922affa5781c1493eb232886ee4b19ceee26..6444306667a600155cd128fd4f867e8d9e1accd3 100644 (file)
@@ -21,14 +21,14 @@ DEFINE_REF(eDVBSatelliteEquipmentControl);
 eDVBSatelliteEquipmentControl *eDVBSatelliteEquipmentControl::instance;
 
 eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends)
 eDVBSatelliteEquipmentControl *eDVBSatelliteEquipmentControl::instance;
 
 eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends)
-       :m_lnbidx(-1), m_curSat(m_lnbs[0].m_satellites.end()), m_avail_frontends(avail_frontends)
+       :m_lnbidx(-1), m_curSat(m_lnbs[0].m_satellites.end()), m_avail_frontends(avail_frontends), m_rotorMoving(false)
 {
        if (!instance)
                instance = this;
 
        clear();
 
 {
        if (!instance)
                instance = this;
 
        clear();
 
-#if 0
+#if 1
 // ASTRA
        addLNB();
        setLNBTunerMask(3);
 // ASTRA
        addLNB();
        setLNBTunerMask(3);
@@ -62,7 +62,7 @@ eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBR
        addSatellite(130);
        setVoltageMode(eDVBSatelliteSwitchParameters::HV);
        setToneMode(eDVBSatelliteSwitchParameters::HILO);
        addSatellite(130);
        setVoltageMode(eDVBSatelliteSwitchParameters::HV);
        setToneMode(eDVBSatelliteSwitchParameters::HILO);
-#endif
+#else
 
 // Rotor
        addLNB();
 
 // Rotor
        addLNB();
@@ -103,6 +103,7 @@ eDVBSatelliteEquipmentControl::eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBR
        setVoltageMode(eDVBSatelliteSwitchParameters::HV);
        setToneMode(eDVBSatelliteSwitchParameters::HILO);
        setRotorPosNum(1); // stored pos 1
        setVoltageMode(eDVBSatelliteSwitchParameters::HV);
        setToneMode(eDVBSatelliteSwitchParameters::HILO);
        setRotorPosNum(1); // stored pos 1
+#endif
 }
 
 int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite &sat, iDVBFrontend *fe, int frontend_id )
 }
 
 int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite &sat, iDVBFrontend *fe, int frontend_id )
@@ -938,6 +939,10 @@ RESULT eDVBSatelliteEquipmentControl::setTunerLinked(int tu1, int tu2)
 
 bool eDVBSatelliteEquipmentControl::isRotorMoving()
 {
 
 bool eDVBSatelliteEquipmentControl::isRotorMoving()
 {
-       // TODO please fill with life
-       return false;
+       return m_rotorMoving;
+}
+
+void eDVBSatelliteEquipmentControl::setRotorMoving(bool b)
+{
+       m_rotorMoving=b;
 }
 }
index 93d9cf241645fc2ae5d92584a5ed35090c8a0c82..aa9c02717a90d0bf2aa8064916db7af2ee517038 100644 (file)
@@ -211,6 +211,7 @@ class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl
        int m_lnbidx; // current index for set parameters
        std::map<int, eDVBSatelliteSwitchParameters>::iterator m_curSat;
        eSmartPtrList<eDVBRegisteredFrontend> &m_avail_frontends;
        int m_lnbidx; // current index for set parameters
        std::map<int, eDVBSatelliteSwitchParameters>::iterator m_curSat;
        eSmartPtrList<eDVBRegisteredFrontend> &m_avail_frontends;
+       bool m_rotorMoving;
 #endif
 public:
        eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends);
 #endif
 public:
        eDVBSatelliteEquipmentControl(eSmartPtrList<eDVBRegisteredFrontend> &avail_frontends);
@@ -252,7 +253,8 @@ public:
        RESULT setRotorPosNum(int rotor_pos_num);
 /* Tuner Specific Parameters */
        RESULT setTunerLinked(int from, int to);
        RESULT setRotorPosNum(int rotor_pos_num);
 /* Tuner Specific Parameters */
        RESULT setTunerLinked(int from, int to);
-       
+
+       void setRotorMoving(bool); // called from the frontend's
        bool isRotorMoving();
 };
 
        bool isRotorMoving();
 };