remove test linkage stuff
[enigma2.git] / lib / dvb / frontend.cpp
index a05963cd2bd892df8fc173edbfb3ba8a39cb73d6..c99a64ff656baf3bdd462b2dc58b1ab0c30e6d32 100644 (file)
@@ -195,8 +195,8 @@ RESULT eDVBFrontendParameters::getHash(unsigned long &hash) const
        {
        case iDVBFrontend::feSatellite:
        {
-               hash  = sat.frequency & 0xFFFF;
-               hash |= sat.orbital_position << 16;
+               hash = (sat.orbital_position << 16);
+               hash |= ((sat.frequency/1000)&0xFFFF)|((sat.polarisation&1) << 15);
                return 0;
        }
        case iDVBFrontend::feCable:
@@ -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;
 
+//     m_data[7] = !m_fe;
+
+//     eDebug("m_data[7] = %d %d", m_data[7], m_fe);
+
        return;
 }
 
@@ -333,7 +337,7 @@ void eDVBFrontend::feEvent(int w)
 #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
                {
@@ -380,34 +384,23 @@ void eDVBFrontend::timeout()
 #endif
 int eDVBFrontend::readInputpower()
 {
-       int power=0;
-//     if ( eSystemInfo::getInstance()->canMeasureLNBCurrent() )
+       int power=m_fe;
+
+       // open front prozessor
+       int fp=::open("/dev/dbox/fp0", O_RDWR);
+       if (fp < 0)
        {
-//             switch ( eSystemInfo::getInstance()->getHwType() )
-               {
-//                     case eSystemInfo::DM7000:
-//                     case eSystemInfo::DM7020:
-                       {
-                               // open front prozessor
-                               int fp=::open("/dev/dbox/fp0", O_RDWR);
-                               if (fp < 0)
-                               {
-                                       eDebug("couldn't open fp");
-                                       return -1;
-                               }
-                               static bool old_fp = (::ioctl(fp, FP_IOCTL_GET_ID) < 0);
-                               if ( ioctl( fp, old_fp ? 9 : 0x100, &power ) < 0 )
-                               {
-                                       eDebug("FP_IOCTL_GET_LNB_CURRENT failed (%m)");
-                                       return -1;
-                               }
-                               ::close(fp);
-//                             break;
-                       }
-//                     default:
-//                             eDebug("Inputpower read for platform %d not yet implemented", eSystemInfo::getInstance()->getHwType());
-               }
+               eDebug("couldn't open fp");
+               return -1;
        }
+       static bool old_fp = (::ioctl(fp, FP_IOCTL_GET_ID) < 0);
+       if ( ioctl( fp, old_fp ? 9 : 0x100, &power ) < 0 )
+       {
+               eDebug("FP_IOCTL_GET_LNB_CURRENT failed (%m)");
+               return -1;
+       }
+       ::close(fp);
+
        return power;
 }
 
@@ -503,6 +496,7 @@ void eDVBFrontend::tuneLoop()  // called by m_tuneTimer
                                if (!m_timeoutCount)
                                {
                                        eDebug("[SEC] rotor timout");
+                                       m_sec->setRotorMoving(false);
                                        setSecSequencePos(m_sec_sequence.current()->steps);
                                }
                                else
@@ -510,7 +504,10 @@ void eDVBFrontend::tuneLoop()  // called by m_tuneTimer
                                break;
                        case eSecCommand::SET_POWER_LIMITING_MODE:
                        {
-                               int fd=::open("/dev/i2c/0", O_RDWR);
+                               int fd = m_fe ?
+                                       ::open("/dev/i2c/1", O_RDWR) :
+                                       ::open("/dev/i2c/0", O_RDWR);
+
                                unsigned char data[2];
                                ::ioctl(fd, I2C_SLAVE_FORCE, 0x10 >> 1);
                                if(::read(fd, data, 1) != 1)
@@ -553,6 +550,7 @@ void eDVBFrontend::tuneLoop()  // called by m_tuneTimer
                                        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;
@@ -611,6 +609,8 @@ RESULT eDVBFrontend::getFrontendType(int &t)
 
 RESULT eDVBFrontend::tune(const iDVBFrontendParameters &where)
 {
+       eDebug("(%d)tune", m_fe);
+
        if (m_type == -1)
                return -ENODEV;
 
@@ -1009,6 +1009,8 @@ RESULT eDVBFrontend::setData(int num, int val)
 {
        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;
        }