do voltage and tone control in SEC_SEND_SEQUENCE on old api..sorry for this hack
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 25 Apr 2005 14:37:54 +0000 (14:37 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Mon, 25 Apr 2005 14:37:54 +0000 (14:37 +0000)
lib/dvb/frontend.cpp
lib/dvb/idvb.h
lib/dvb/sec.cpp

index 411e118fc91078a5bbbd42b98ebf071f8be83f8f..00886ee4839dc6355361ffee52c64e0aa3b6a951 100644 (file)
@@ -628,13 +628,23 @@ RESULT eDVBFrontend::sendDiseqc(const eDVBDiseqcCommand &diseqc)
                eDebugNoNewLine("%02x ", diseqc.data[3+i]);
        eDebug("");
 
                eDebugNoNewLine("%02x ", diseqc.data[3+i]);
        eDebug("");
 
-       seq.continuousTone = SEC_TONE_OFF;
-       seq.voltage = SEC_VOLTAGE_13;
+       seq.continuousTone = diseqc.tone == toneOn ? SEC_TONE_ON : SEC_TONE_OFF;
+       switch ( diseqc.voltage )
+       {
+               case voltageOff:
+                       seq.voltage = SEC_VOLTAGE_OFF;
+                       break;
+               case voltage13:
+                       seq.voltage = SEC_VOLTAGE_13;
+                       break;
+               case voltage18:
+                       seq.voltage = SEC_VOLTAGE_18;
+                       break;
+       }
        seq.miniCommand = SEC_MINI_NONE;
        seq.commands=&cmd;
        seq.numCommands=1;
 
        seq.miniCommand = SEC_MINI_NONE;
        seq.commands=&cmd;
        seq.numCommands=1;
 
-
        if ( ioctl(m_secfd, SEC_SEND_SEQUENCE, &seq) < 0 )
        {
                eDebug("SEC_SEND_SEQUENCE failed ( %m )");
        if ( ioctl(m_secfd, SEC_SEND_SEQUENCE, &seq) < 0 )
        {
                eDebug("SEC_SEND_SEQUENCE failed ( %m )");
index c201c1a47dbed1d7fb6719bc35c211c2dcaf8f46..a6533a9cb2f950adc75aa1bff17dd817ca796ecb 100644 (file)
@@ -363,6 +363,10 @@ struct eDVBDiseqcCommand
 {
        int len;
        __u8 data[MAX_DISEQC_LENGTH];
 {
        int len;
        __u8 data[MAX_DISEQC_LENGTH];
+#if HAVE_DVB_API_VERSION < 3
+       int tone;
+       int voltage;
+#endif
 };
 
 class iDVBSatelliteEquipmentControl;
 };
 
 class iDVBSatelliteEquipmentControl;
index 1555090cb0a321acf4c9e5c13e7f7c00bb4ba856..a668ebe7b782f7814accf5f192b5212400252d39 100644 (file)
@@ -25,7 +25,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
 {
        int hi;
        eDebug("(very) ugly and hardcoded eDVBSatelliteEquipmentControl");
 {
        int hi;
        eDebug("(very) ugly and hardcoded eDVBSatelliteEquipmentControl");
-       
+
        if (sat.frequency > 11700000)
                hi = 1;
        else
        if (sat.frequency > 11700000)
                hi = 1;
        else
@@ -50,24 +50,32 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA
        }
        parm.u.qpsk.SYMBOLRATE = sat.symbol_rate;
 
        }
        parm.u.qpsk.SYMBOLRATE = sat.symbol_rate;
 
-       frontend.setVoltage((sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Vertical) ? iDVBFrontend::voltage13 : iDVBFrontend::voltage18);
-
        eDVBDiseqcCommand diseqc;
        eDVBDiseqcCommand diseqc;
-       
+
+#if HAVE_DVB_API_VERSION < 3
+       diseqc.voltage = sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Vertical ? iDVBFrontend::voltage13 : iDVBFrontend::voltage18;
+       diseqc.tone = hi ? iDVBFrontend::toneOn : iDVBFrontend::toneOff;
+#else
+       frontend.setVoltage(sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Vertical ? iDVBFrontend::voltage13 : iDVBFrontend::voltage18);
+#endif
+
        diseqc.len = 4;
        diseqc.data[0] = 0xe0;
        diseqc.data[1] = 0x10;
        diseqc.data[2] = 0x38;
        diseqc.data[3] = 0xF0;
        diseqc.len = 4;
        diseqc.data[0] = 0xe0;
        diseqc.data[1] = 0x10;
        diseqc.data[2] = 0x38;
        diseqc.data[3] = 0xF0;
-       
+
        if (hi)
                diseqc.data[3] |= 1;
        if (hi)
                diseqc.data[3] |= 1;
-               
+
        if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
                diseqc.data[3] |= 2;
 
        frontend.sendDiseqc(diseqc);
        if (sat.polarisation == eDVBFrontendParametersSatellite::Polarisation::Horizontal)
                diseqc.data[3] |= 2;
 
        frontend.sendDiseqc(diseqc);
+
+#if HAVE_DVB_API_VERSION > 2
        frontend.setTone(hi ? iDVBFrontend::toneOn : iDVBFrontend::toneOff);
        frontend.setTone(hi ? iDVBFrontend::toneOn : iDVBFrontend::toneOff);
+#endif
 
        return 0;
 }
 
        return 0;
 }