add support for 8PSK
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 24 May 2006 15:21:52 +0000 (15:21 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Wed, 24 May 2006 15:21:52 +0000 (15:21 +0000)
lib/dvb/frontend.cpp
lib/python/Components/NimManager.py
lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py
lib/python/Screens/ScanSetup.py
lib/python/Screens/ServiceInfo.py

index 925da31..b85fbc2 100644 (file)
 #ifdef FEC_9_10
        #warning "FEC_9_10 already exist in dvb api ... it seems it is now ready for DVB-S2"
 #else
-       #define FEC_S2_1_2 (fe_code_rate_t)(FEC_AUTO+1)
-       #define FEC_S2_2_3 (fe_code_rate_t)(FEC_S2_1_2+1)
-       #define FEC_S2_3_4 (fe_code_rate_t)(FEC_S2_2_3+1)
-       #define FEC_S2_5_6 (fe_code_rate_t)(FEC_S2_3_4+1)
-       #define FEC_S2_7_8 (fe_code_rate_t)(FEC_S2_5_6+1)
-       #define FEC_S2_8_9 (fe_code_rate_t)(FEC_S2_7_8+1)
-       #define FEC_S2_3_5 (fe_code_rate_t)(FEC_S2_8_9+1)
-       #define FEC_S2_4_5 (fe_code_rate_t)(FEC_S2_3_5+1)
-       #define FEC_S2_9_10 (fe_code_rate_t)(FEC_S2_4_5+1)
+       #define FEC_S2_QPSK_1_2 (fe_code_rate_t)(FEC_AUTO+1)
+       #define FEC_S2_QPSK_2_3 (fe_code_rate_t)(FEC_S2_QPSK_1_2+1)
+       #define FEC_S2_QPSK_3_4 (fe_code_rate_t)(FEC_S2_QPSK_2_3+1)
+       #define FEC_S2_QPSK_5_6 (fe_code_rate_t)(FEC_S2_QPSK_3_4+1)
+       #define FEC_S2_QPSK_7_8 (fe_code_rate_t)(FEC_S2_QPSK_5_6+1)
+       #define FEC_S2_QPSK_8_9 (fe_code_rate_t)(FEC_S2_QPSK_7_8+1)
+       #define FEC_S2_QPSK_3_5 (fe_code_rate_t)(FEC_S2_QPSK_8_9+1)
+       #define FEC_S2_QPSK_4_5 (fe_code_rate_t)(FEC_S2_QPSK_3_5+1)
+       #define FEC_S2_QPSK_9_10 (fe_code_rate_t)(FEC_S2_QPSK_4_5+1)
+       #define FEC_S2_8PSK_1_2 (fe_code_rate_t)(FEC_S2_QPSK_9_10+1)
+       #define FEC_S2_8PSK_2_3 (fe_code_rate_t)(FEC_S2_8PSK_1_2+1)
+       #define FEC_S2_8PSK_3_4 (fe_code_rate_t)(FEC_S2_8PSK_2_3+1)
+       #define FEC_S2_8PSK_5_6 (fe_code_rate_t)(FEC_S2_8PSK_3_4+1)
+       #define FEC_S2_8PSK_7_8 (fe_code_rate_t)(FEC_S2_8PSK_5_6+1)
+       #define FEC_S2_8PSK_8_9 (fe_code_rate_t)(FEC_S2_8PSK_7_8+1)
+       #define FEC_S2_8PSK_3_5 (fe_code_rate_t)(FEC_S2_8PSK_8_9+1)
+       #define FEC_S2_8PSK_4_5 (fe_code_rate_t)(FEC_S2_8PSK_3_5+1)
+       #define FEC_S2_8PSK_9_10 (fe_code_rate_t)(FEC_S2_8PSK_4_5+1)
 #endif
 #endif
 
@@ -265,7 +274,7 @@ RESULT eDVBFrontendParameters::calculateDifference(const iDVBFrontendParameters
                diff = 1<<30; // big difference
                return 0;
        }
-       
+
        switch (type)
        {
        case iDVBFrontend::feSatellite:
@@ -273,7 +282,7 @@ RESULT eDVBFrontendParameters::calculateDifference(const iDVBFrontendParameters
                eDVBFrontendParametersSatellite osat;
                if (parm->getDVBS(osat))
                        return -2;
-               
+
                if (sat.orbital_position != osat.orbital_position)
                        diff = 1<<29;
                else if (sat.polarisation != osat.polarisation)
@@ -289,7 +298,7 @@ RESULT eDVBFrontendParameters::calculateDifference(const iDVBFrontendParameters
                eDVBFrontendParametersCable ocable;
                if (parm->getDVBC(ocable))
                        return -2;
-               
+
                if (cable.modulation != ocable.modulation && cable.modulation != eDVBFrontendParametersCable::Modulation::Auto && ocable.modulation != eDVBFrontendParametersCable::Modulation::Auto)
                        diff = 1 << 29;
                else if (cable.inversion != ocable.inversion && cable.inversion != eDVBFrontendParametersCable::Inversion::Unknown && ocable.inversion != eDVBFrontendParametersCable::Inversion::Unknown)
@@ -299,13 +308,13 @@ RESULT eDVBFrontendParameters::calculateDifference(const iDVBFrontendParameters
                        diff = abs(cable.frequency - ocable.frequency);
                        diff += abs(cable.symbol_rate - ocable.symbol_rate);
                }
-               
+
                return 0;
        case iDVBFrontend::feTerrestrial:
                eDVBFrontendParametersTerrestrial oterrestrial;
                if (parm->getDVBT(oterrestrial))
                        return -2;
-               
+
                diff = abs(terrestrial.frequency - oterrestrial.frequency);
 
                return 0;
@@ -513,7 +522,7 @@ void eDVBFrontend::feEvent(int w)
                int res;
                int state;
                res = ::ioctl(m_fd, FE_GET_EVENT, &event);
-               
+
                if (res && (errno == EAGAIN))
                        break;
 
@@ -522,7 +531,7 @@ void eDVBFrontend::feEvent(int w)
                        eWarning("FE_GET_EVENT failed! %m");
                        return;
                }
-               
+
                if (w < 0)
                        continue;
 
@@ -675,35 +684,50 @@ void fillDictWithSatelliteData(PyObject *dict, const FRONTENDPARAMETERS &parm, e
                tmp = "FEC_AUTO";
                break;
 #if HAVE_DVB_API_VERSION >=3
-       case FEC_S2_1_2:
+       case FEC_S2_8PSK_1_2:
+       case FEC_S2_QPSK_1_2:
                tmp = "FEC_1_2";
                break;
-       case FEC_S2_2_3:
+       case FEC_S2_8PSK_2_3:
+       case FEC_S2_QPSK_2_3:
                tmp = "FEC_2_3";
                break;
-       case FEC_S2_3_4:
+       case FEC_S2_8PSK_3_4:
+       case FEC_S2_QPSK_3_4:
                tmp = "FEC_3_4";
                break;
-       case FEC_S2_5_6:
+       case FEC_S2_8PSK_5_6:
+       case FEC_S2_QPSK_5_6:
                tmp = "FEC_5_6";
                break;
-       case FEC_S2_7_8:
+       case FEC_S2_8PSK_7_8:
+       case FEC_S2_QPSK_7_8:
                tmp = "FEC_7_8";
                break;
-       case FEC_S2_8_9:
+       case FEC_S2_8PSK_8_9:
+       case FEC_S2_QPSK_8_9:
                tmp = "FEC_8_9";
                break;
-       case FEC_S2_3_5:
+       case FEC_S2_8PSK_3_5:
+       case FEC_S2_QPSK_3_5:
                tmp = "FEC_3_5";
                break;
-       case FEC_S2_4_5:
+       case FEC_S2_8PSK_4_5:
+       case FEC_S2_QPSK_4_5:
                tmp = "FEC_4_5";
                break;
-       case FEC_S2_9_10:
+       case FEC_S2_8PSK_9_10:
+       case FEC_S2_QPSK_9_10:
                tmp = "FEC_9_10";
                break;
 #endif
        }
+#if HAVE_DVB_API_VERSION >=3
+       PutToDict(dict, "modulation",
+               parm_u_qpsk_fec_inner > FEC_S2_QPSK_9_10 ? "8PSK": "QPSK" );
+#else
+       PutToDict(dict, "modulation", "QPSK" );
+#endif
        PutToDict(dict, "fec_inner", tmp);
        tmp = parm_u_qpsk_fec_inner > FEC_AUTO ?
                "DVB-S2" : "DVB-S";
@@ -1377,39 +1401,44 @@ RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm)
                        }
 #if HAVE_DVB_API_VERSION >= 3
                else // DVB_S2
+               {
                        switch (feparm.fec)
                        {
                                case eDVBFrontendParametersSatellite::FEC::f1_2:
-                                       parm_u_qpsk_fec_inner = FEC_S2_1_2;
+                                       parm_u_qpsk_fec_inner = FEC_S2_QPSK_1_2;
                                        break;
                                case eDVBFrontendParametersSatellite::FEC::f2_3:
-                                       parm_u_qpsk_fec_inner = FEC_S2_2_3;
+                                       parm_u_qpsk_fec_inner = FEC_S2_QPSK_2_3;
                                        break;
                                case eDVBFrontendParametersSatellite::FEC::f3_4:
-                                       parm_u_qpsk_fec_inner = FEC_S2_3_4;
+                                       parm_u_qpsk_fec_inner = FEC_S2_QPSK_3_4;
                                        break;
                                case eDVBFrontendParametersSatellite::FEC::f3_5:
-                                       parm_u_qpsk_fec_inner = FEC_S2_3_5;
+                                       parm_u_qpsk_fec_inner = FEC_S2_QPSK_3_5;
                                        break;
                                case eDVBFrontendParametersSatellite::FEC::f4_5:
-                                       parm_u_qpsk_fec_inner = FEC_S2_4_5;
+                                       parm_u_qpsk_fec_inner = FEC_S2_QPSK_4_5;
                                        break;
                                case eDVBFrontendParametersSatellite::FEC::f5_6:
-                                       parm_u_qpsk_fec_inner = FEC_S2_5_6;
+                                       parm_u_qpsk_fec_inner = FEC_S2_QPSK_5_6;
                                        break;
                                case eDVBFrontendParametersSatellite::FEC::f7_8:
-                                       parm_u_qpsk_fec_inner = FEC_S2_7_8;
+                                       parm_u_qpsk_fec_inner = FEC_S2_QPSK_7_8;
                                        break;
                                case eDVBFrontendParametersSatellite::FEC::f8_9:
-                                       parm_u_qpsk_fec_inner = FEC_S2_8_9;
+                                       parm_u_qpsk_fec_inner = FEC_S2_QPSK_8_9;
                                        break;
                                case eDVBFrontendParametersSatellite::FEC::f9_10:
-                                       parm_u_qpsk_fec_inner = FEC_S2_9_10;
+                                       parm_u_qpsk_fec_inner = FEC_S2_QPSK_9_10;
                                        break;
                                default:
                                        eDebug("no valid fec for DVB-S2 set.. abort !!");
                                        return -EINVAL;
                        }
+                       if (feparm.modulation == eDVBFrontendParametersSatellite::Modulation::M8PSK)
+                               parm_u_qpsk_fec_inner = (fe_code_rate_t)((int)parm_u_qpsk_fec_inner+9);
+                               // 8PSK fec driver values are decimal 9 bigger
+               }
 #endif
                // FIXME !!! get frequency range from tuner
                if ( parm_frequency < 900000 || parm_frequency > 2200000 )
index c8aa3c9..8454bbe 100644 (file)
@@ -348,6 +348,7 @@ class NimManager:
                                self.satList.append( (tname, tpos) )
                                self.parsedSat = int(tpos)
                        elif (name == "transponder"):
+                               modulation = int(attrs.get('modulation',"1"))
                                system = int(attrs.get('system',"0"))
                                freq = int(attrs.get('frequency',""))
                                sr = int(attrs.get('symbol_rate',""))
@@ -358,7 +359,7 @@ class NimManager:
                                else:
                                        self.transponders[self.parsedSat] = [ ]
 
-                               self.transponders[self.parsedSat].append((0, freq, sr, pol, fec, system))
+                               self.transponders[self.parsedSat].append((0, freq, sr, pol, fec, system, modulation))
 
        class parseCables(ContentHandler):
                def __init__(self, cablesList, transponders):
index 67da8bb..087838a 100644 (file)
@@ -350,6 +350,7 @@ class Tuner:
                parm.inversion = transponder[4]
                parm.orbital_position = transponder[5]
                parm.system = 0  # FIXMEE !! HARDCODED DVB-S (add support for DVB-S2)
+               parm.modulation = 1 # FIXMEE !! HARDCODED QPSK 
                feparm = eDVBFrontendParameters()
                feparm.setDVBS(parm, True)
                self.lastparm = feparm
index 6aeaf78..89b93d1 100644 (file)
@@ -84,6 +84,7 @@ def getInitialTransponderList(tlist, pos):
                        parm.inversion = 2              #AUTO
                        parm.orbital_position = pos
                        parm.system = x[5]  #DVB-S or DVB-S2
+                       parm.modulation = x[6]
                        tlist.append(parm)
 
 def getInitialCableTransponderList(tlist, cable):
@@ -205,6 +206,7 @@ class ScanSetup(Screen):
                                        self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec))
                                elif currentConfigSelectionElement(config.scan.sat.system) == "dvb-s2":
                                        self.list.append(getConfigListEntry(_("FEC"), config.scan.sat.fec_s2))
+                                       self.list.append(getConfigListEntry(_('Modulation'), config.scan.sat.modulation))
                        elif currentConfigSelectionElement(config.scan.type) == "single_satellite":
                                self.updateSatList()
                                print config.scan.satselection[config.scan.nims.value]
@@ -317,7 +319,8 @@ class ScanSetup(Screen):
                        config.scan.sat.polarization = configElement_nonSave("config.scan.sat.polarization", configSelection, 0, (("horizontal", _("horizontal")), ("vertical", _("vertical")),  ("circular_left", _("circular left")), ("circular_right", _("circular right"))))
                        config.scan.sat.fec = configElement_nonSave("config.scan.sat.fec", configSelection, 7, (("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("none", _("None"))))
                        config.scan.sat.fec_s2 = configElement_nonSave("config.scan.sat.fec_s2", configSelection, 8, (("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("3_5", "3/5"), ("4_5", "4/5"), ("5_6", "5/6"), ("7_8", "7/8"), ("8_9", "8/9"), ("9_10", "9/10")))
-
+                       config.scan.sat.modulation = configElement_nonSave("config.scan.sat.modulation", configSelection, 0, ("qpsk", "QPSK"), ("8psk", "8PSK")))
+       
                        # cable
                        config.scan.cab.frequency = configElement_nonSave("config.scan.cab.frequency", configSequence, [466], configsequencearg.get("INTEGER", (50, 999)))
                        config.scan.cab.inversion = configElement_nonSave("config.scan.cab.inversion", configSelection, 2, (("off", _("off")), ("on", _("on")), ("auto", _("Auto"))))
@@ -382,15 +385,18 @@ class ScanSetup(Screen):
                           "none": 15
                           }
 
-       def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system):
+       def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation):
                print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(fec) + " inversion: " + str(inversion)
                print "orbpos: " + str(orbital_position)
                parm = eDVBFrontendParametersSatellite()
+               if modulation == 1:
+                       parm.modulation = 2 # eDVBFrontendParametersSatellite.Modulation.8PSK
+               else:
+                       parm.modulation = 1 # eDVBFrontendParametersSatellite.Modulation.QPSK
                parm.system = system
                parm.frequency = frequency * 1000
                parm.symbol_rate = symbol_rate * 1000
                parm.polarisation = polarisation # eDVBFrontendParametersSatellite.Polarisation.Verti
-
                parm.fec = self.fecmap[fec]                     # eDVBFrontendParametersSatellite.FEC.f3_4;
                #parm.fec = 6                                   # AUTO
                parm.inversion = inversion      #eDVBFrontendParametersSatellite.Inversion.Off;
@@ -438,7 +444,8 @@ class ScanSetup(Screen):
                                                                                fec,
                                                                                config.scan.sat.inversion.value,
                                                                                orbpos,
-                                                                               config.scan.sat.system.value)
+                                                                               config.scan.sat.system.value,
+                                                                               config.scan.sat.modulation)
                        elif currentConfigSelectionElement(config.scan.type) == "single_satellite":
                                sat = self.satList[config.scan.nims.value][config.scan.satselection[config.scan.nims.value].value]
                                getInitialTransponderList(tlist, int(sat[1]))
index 84eaec4..f545369 100644 (file)
@@ -122,8 +122,8 @@ class ServiceInfo(Screen):
                        return []
                if frontendData["tuner_type"] == "DVB-S":
                        return ( ("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT),
-                                          ("System", frontendData["system"], TYPE_TEXT),
-                                          ("Type", frontendData["tuner_type"], TYPE_TEXT),
+                                          ("Type", frontendData["system"], TYPE_TEXT),
+                                          ("Modulation", frontendData["modulation"], TYPE_TEXT),
                                           ("Orbital position", frontendData["orbital_position"], TYPE_VALUE_DEC),
                                           ("Frequency", frontendData["frequency"], TYPE_VALUE_DEC),
                                           ("Symbolrate", frontendData["symbol_rate"], TYPE_VALUE_DEC),