From 38b8a24b2034c387aa0762eb8a3d96b786fd581b Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Thu, 15 May 2008 09:55:58 +0000 Subject: [PATCH] add support for rolloff and pilot changing (needed for some 8PSK transponders) this both values are transmitted to the frontend via linux tv api inversion param hack bits 0..1 are used for real inversion param (OFF, ON, AUTO) bits 2..3 are now used for rolloff param (0.35, 0.25, 0.20) bits 4..5 are now used for pilot param (OFF, ON, AUTO) this needs a linuxtv api kernel patch, and a driver change (alps_bsbe2.ko) both are not yet pushed to OE!! --- lib/dvb/db.cpp | 29 +++++++++++++----- lib/dvb/frontend.cpp | 51 +++++++++++++++++++++++++++---- lib/dvb/frontendparms.h | 13 ++++++-- lib/python/Screens/ScanSetup.py | 30 +++++++++++++----- lib/python/Screens/ServiceInfo.py | 19 +++++++----- lib/service/servicedvb.cpp | 16 ++++++++-- 6 files changed, 125 insertions(+), 33 deletions(-) diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp index 5fd0758e..2be0dd4c 100644 --- a/lib/dvb/db.cpp +++ b/lib/dvb/db.cpp @@ -327,8 +327,9 @@ void eDVBDB::loadServicelist(const char *file) int frequency, symbol_rate, polarisation, fec, orbital_position, inversion, system=eDVBFrontendParametersSatellite::System::DVB_S, modulation=eDVBFrontendParametersSatellite::Modulation::QPSK, - rolloff=eDVBFrontendParametersSatellite::RollOff::alpha_auto; - sscanf(line+3, "%d:%d:%d:%d:%d:%d:%d:%d:%d", &frequency, &symbol_rate, &polarisation, &fec, &orbital_position, &inversion, &system, &modulation, &rolloff); + rolloff=eDVBFrontendParametersSatellite::RollOff::alpha_0_35, + pilot=eDVBFrontendParametersSatellite::Pilot::Unknown; + sscanf(line+3, "%d:%d:%d:%d:%d:%d:%d:%d:%d:%d", &frequency, &symbol_rate, &polarisation, &fec, &orbital_position, &inversion, &system, &modulation, &rolloff, &pilot); sat.frequency = frequency; sat.symbol_rate = symbol_rate; sat.polarisation = polarisation; @@ -338,7 +339,8 @@ void eDVBDB::loadServicelist(const char *file) sat.inversion = inversion; sat.system = system; sat.modulation = modulation; - sat.roll_off = rolloff; + sat.rolloff = rolloff; + sat.pilot = pilot; feparm->setDVBS(sat); } else if (line[1]=='t') { @@ -484,14 +486,18 @@ void eDVBDB::saveServicelist() { if (sat.system == eDVBFrontendParametersSatellite::System::DVB_S2) { - fprintf(f, "\ts %d:%d:%d:%d:%d:%d:%d:%d:%d\n", + fprintf(f, "\ts %d:%d:%d:%d:%d:%d:%d:%d:%d", sat.frequency, sat.symbol_rate, sat.polarisation, sat.fec, sat.orbital_position > 1800 ? sat.orbital_position - 3600 : sat.orbital_position, sat.inversion, sat.system, sat.modulation, - sat.roll_off); + sat.rolloff); + if (sat.modulation == eDVBFrontendParametersSatellite::Modulation::M8PSK) + fprintf(f, ":%d\n", sat.pilot); + else + fprintf(f, "\n"); } else { @@ -766,7 +772,7 @@ PyObject *eDVBDB::readSatellites(ePyObject sat_list, ePyObject sat_dict, ePyObje return Py_False; } int tmp, *dest = NULL, - modulation, system, freq, sr, pol, fec; + modulation, system, freq, sr, pol, fec, inv, pilot, rolloff; char *end_ptr; const Attribute *at; std::string name; @@ -828,6 +834,9 @@ PyObject *eDVBDB::readSatellites(ePyObject sat_list, ePyObject sat_dict, ePyObje sr = 0; pol = -1; fec = 0; // AUTO default + inv = 2; // AUTO default + pilot = 2; // AUTO default + rolloff = 0; // alpha 0.35 for (AttributeConstIterator it(tp_attributes.begin()); it != end; ++it) { // eDebug("\t\tattr: %s", at->name().c_str()); @@ -839,6 +848,9 @@ PyObject *eDVBDB::readSatellites(ePyObject sat_list, ePyObject sat_dict, ePyObje else if (name == "symbol_rate") dest = &sr; else if (name == "polarization") dest = &pol; else if (name == "fec_inner") dest = &fec; + else if (name == "inversion") dest = &inv; + else if (name == "rolloff") dest = &rolloff; + else if (name == "pilot") dest = &pilot; if (dest) { tmp = strtol(at->value().c_str(), &end_ptr, 10); @@ -848,7 +860,7 @@ PyObject *eDVBDB::readSatellites(ePyObject sat_list, ePyObject sat_dict, ePyObje } if (freq && sr && pol != -1) { - tuple = PyTuple_New(7); + tuple = PyTuple_New(10); PyTuple_SET_ITEM(tuple, 0, PyInt_FromLong(0)); PyTuple_SET_ITEM(tuple, 1, PyInt_FromLong(freq)); PyTuple_SET_ITEM(tuple, 2, PyInt_FromLong(sr)); @@ -856,6 +868,9 @@ PyObject *eDVBDB::readSatellites(ePyObject sat_list, ePyObject sat_dict, ePyObje PyTuple_SET_ITEM(tuple, 4, PyInt_FromLong(fec)); PyTuple_SET_ITEM(tuple, 5, PyInt_FromLong(system)); PyTuple_SET_ITEM(tuple, 6, PyInt_FromLong(modulation)); + PyTuple_SET_ITEM(tuple, 7, PyInt_FromLong(inv)); + PyTuple_SET_ITEM(tuple, 8, PyInt_FromLong(rolloff)); + PyTuple_SET_ITEM(tuple, 9, PyInt_FromLong(pilot)); PyList_Append(tplist, tuple); Py_DECREF(tuple); } diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 9f19ada1..d81c455c 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -125,6 +125,7 @@ void eDVBFrontendParametersSatellite::set(const SatelliteDeliverySystemDescripto if ( fec != FEC::fNone && fec > FEC::f9_10 ) fec = FEC::fAuto; inversion = Inversion::Unknown; + pilot = Pilot::Unknown; orbital_position = ((descriptor.getOrbitalPosition() >> 12) & 0xF) * 1000; orbital_position += ((descriptor.getOrbitalPosition() >> 8) & 0xF) * 100; orbital_position += ((descriptor.getOrbitalPosition() >> 4) & 0xF) * 10; @@ -138,16 +139,16 @@ void eDVBFrontendParametersSatellite::set(const SatelliteDeliverySystemDescripto eDebug("satellite_delivery_descriptor non valid modulation type.. force QPSK"); modulation=QPSK; } - roll_off = descriptor.getRollOff(); + rolloff = descriptor.getRollOff(); if (system == System::DVB_S2) { - eDebug("SAT DVB-S2 freq %d, %s, pos %d, sr %d, fec %d, modulation %d, roll_off %d", + eDebug("SAT DVB-S2 freq %d, %s, pos %d, sr %d, fec %d, modulation %d, rolloff %d", frequency, polarisation ? "hor" : "vert", orbital_position, symbol_rate, fec, modulation, - roll_off); + rolloff); } else { @@ -861,8 +862,43 @@ void fillDictWithSatelliteData(ePyObject dict, const FRONTENDPARAMETERS &parm, e PutToDict(dict, "modulation", "QPSK" ); #endif PutToDict(dict, "fec_inner", tmp); - tmp = parm_u_qpsk_fec_inner > FEC_AUTO ? - "DVB-S2" : "DVB-S"; + if (parm_u_qpsk_fec_inner > FEC_AUTO) + { + switch(parm_inversion & 0xc) + { + default: // unknown rolloff + case 0: // 0.35 + tmp = "ROLLOFF_0_35"; + break; + case 4: // 0.25 + tmp = "ROLLOFF_0_25"; + break; + case 8: // 0.20 + tmp = "ROLLOFF_0_20"; + break; + } + PutToDict(dict, "rolloff", tmp); + if (parm_u_qpsk_fec_inner > FEC_S2_QPSK_9_10) + { + switch(parm_inversion & 0x30) + { + case 0: // pilot off + tmp = "PILOT_OFF"; + break; + case 0x10: // pilot on + tmp = "PILOT_ON"; + break; + case 0x20: // pilot auto + tmp = "PILOT_AUTO"; + break; + } + PutToDict(dict, "pilot", tmp); + } + tmp = "DVB-S2"; + } + else + tmp = "DVB-S"; + PutToDict(dict, "system", tmp); } @@ -1657,9 +1693,12 @@ RESULT eDVBFrontend::prepare_sat(const eDVBFrontendParametersSatellite &feparm, eDebug("no valid fec for DVB-S2 set.. abort !!"); return -EINVAL; } - if (feparm.modulation == eDVBFrontendParametersSatellite::Modulation::M8PSK) + parm_inversion |= (feparm.rolloff << 2); // Hack.. we use bit 2..3 of inversion param for rolloff + 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 + parm_inversion |= (feparm.pilot << 4); // Hack.. we use bit 4..5 of inversion param for pilot + } } #endif // FIXME !!! get frequency range from tuner diff --git a/lib/dvb/frontendparms.h b/lib/dvb/frontendparms.h index b8f47f43..c963a251 100644 --- a/lib/dvb/frontendparms.h +++ b/lib/dvb/frontendparms.h @@ -37,14 +37,21 @@ struct eDVBFrontendParametersSatellite Auto, QPSK, M8PSK, QAM_16 }; }; - struct RollOff { // dvb-s2 + // dvb-s2 + struct RollOff { enum { - alpha_0_35, alpha_0_25, alpha_0_20, alpha_auto + alpha_0_35, alpha_0_25, alpha_0_20 + }; + }; + // only 8psk + struct Pilot { + enum { + Off, On, Unknown }; }; bool no_rotor_command_on_tune; unsigned int frequency, symbol_rate; - int polarisation, fec, inversion, orbital_position, system, modulation, roll_off; + int polarisation, fec, inversion, orbital_position, system, modulation, rolloff, pilot; }; SWIG_ALLOW_OUTPUT_SIMPLE(eDVBFrontendParametersSatellite); diff --git a/lib/python/Screens/ScanSetup.py b/lib/python/Screens/ScanSetup.py index 2c636530..be0f87e4 100644 --- a/lib/python/Screens/ScanSetup.py +++ b/lib/python/Screens/ScanSetup.py @@ -84,10 +84,12 @@ def getInitialTransponderList(tlist, pos): parm.symbol_rate = x[2] parm.polarisation = x[3] parm.fec = x[4] - parm.inversion = 2 # AUTO + parm.inversion = x[7] parm.orbital_position = pos parm.system = x[5] parm.modulation = x[6] + parm.rolloff = x[8] + parm.pilot = x[9] tlist.append(parm) def getInitialCableTransponderList(tlist, nim): @@ -335,6 +337,7 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.typeOfScanEntry = None self.systemEntry = None + self.modulationEntry = None nim = nimmanager.nim_slots[index_to_scan] if nim.isCompatible("DVB-S"): self.typeOfScanEntry = getConfigListEntry(_("Type of scan"), self.scan_type) @@ -364,7 +367,11 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec)) elif self.scan_sat.system.value == "dvb-s2": self.list.append(getConfigListEntry(_("FEC"), self.scan_sat.fec_s2)) - self.list.append(getConfigListEntry(_('Modulation'), self.scan_sat.modulation)) + self.modulationEntry = getConfigListEntry(_('Modulation'), self.scan_sat.modulation) + self.list.append(self.modulationEntry) + self.list.append(getConfigListEntry(_('Rolloff'), self.scan_sat.rolloff)) + if self.scan_sat.modulation.value == "8psk": + self.list.append(getConfigListEntry(_('Pilot'), self.scan_sat.pilot)) self.list.append(getConfigListEntry(_("Network scan"), self.scan_networkScan)) elif self.scan_type.value == "single_satellite": self.updateSatList() @@ -438,7 +445,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): print "cur is", cur if cur == self.typeOfScanEntry or \ cur == self.tunerEntry or \ - cur == self.systemEntry: + cur == self.systemEntry or \ + (self.modulationEntry and self.systemEntry[1].value == "dvb-s2" and cur == self.modulationEntry): self.createSetup() def createConfig(self, frontendData): @@ -482,10 +490,12 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): defaultSat["inversion"] = {"INVERSION_OFF": "off", "INVERSION_ON": "on", "INVERSION_AUTO": "auto"}[frontendData.get("inversion", "INVERSION_AUTO")] defaultSat["symbolrate"] = int(frontendData.get("symbol_rate", 0) / 1000) defaultSat["polarization"] = {"HORIZONTAL": "horizontal", "VERTICAL": "vertical", "CIRCULAR_LEFT": "circular_left", "CIRCULAR_RIGHT": "circular_right", "UNKNOWN": None}[frontendData.get("polarization", "HORIZONTAL")] - + if frontendData.get("system", "DVB-S") == "DVB-S2": defaultSat["fec_s2"] = {"FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_4_5": "4_5", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_8_9": "8_9", "FEC_9_10": "9_10"} \ [frontendData.get("fec_inner", "FEC_AUTO")] + defaultSat["rolloff"] = {"ROLLOFF_0_35" : "0_35", "ROLLOFF_0_25" : "0_25", "0_20" : "ROLLOFF_0_20"}[frontendData.get("rolloff", "ROLLOFF_0_35")] + defaultSat["pilot"] = {"PILOT_ON" : "on", "PILOT_OFF" : "off", "PILOT_AUTO" : "auto"}[frontendData.get("pilot", "PILOT_AUTO")] else: defaultSat["fec"] = {"FEC_AUTO": "auto", "FEC_1_2": "1_2", "FEC_2_3": "2_3", "FEC_3_4": "3_4", "FEC_5_6": "5_6", "FEC_7_8": "7_8", "FEC_NONE": "none"} \ [frontendData.get("fec_inner", "FEC_AUTO")] @@ -534,6 +544,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.scan_sat.fec = ConfigSelection(default = defaultSat["fec"], choices = [("auto", _("Auto")), ("1_2", "1/2"), ("2_3", "2/3"), ("3_4", "3/4"), ("5_6", "5/6"), ("7_8", "7/8"), ("none", _("None"))]) self.scan_sat.fec_s2 = ConfigSelection(default = defaultSat["fec_s2"], choices = [("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")]) self.scan_sat.modulation = ConfigSelection(default = defaultSat["modulation"], choices = [("qpsk", "QPSK"), ("8psk", "8PSK")]) + self.scan_sat.rolloff = ConfigSelection(default = defaultSat.get("rolloff", "0_35"), choices = [("0_35", "0.35"), ("0_25", "0.25"), ("0_20", "0.20")]) + self.scan_sat.pilot = ConfigSelection(default = defaultSat.get("pilot", "auto"), choices = [("off", _("off")), ("on", _("on")), ("auto", _("Auto"))]) # cable self.scan_cab.frequency = ConfigInteger(default = defaultCab["frequency"], limits = (50, 999)) @@ -593,8 +605,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): "none": 15 } - 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(self.fecmap[fec]) + " inversion: " + str(inversion) + " modulation: " + str(modulation) + " system: " + str(system) + def addSatTransponder(self, tlist, frequency, symbol_rate, polarisation, fec, inversion, orbital_position, system, modulation, rolloff, pilot): + print "Add Sat: frequ: " + str(frequency) + " symbol: " + str(symbol_rate) + " pol: " + str(polarisation) + " fec: " + str(self.fecmap[fec]) + " inversion: " + str(inversion) + " modulation: " + str(modulation) + " system: " + str(system) + " rolloff" + str(rolloff) + " pilot" + str(pilot) print "orbpos: " + str(orbital_position) parm = eDVBFrontendParametersSatellite() if modulation == 1: @@ -608,6 +620,8 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): parm.fec = self.fecmap[fec] parm.inversion = inversion parm.orbital_position = int(orbital_position) + parm.rolloff = int(rolloff) + parm.pilot = int(pilot) tlist.append(parm) def addCabTransponder(self, tlist, frequency, symbol_rate, modulation, fec, inversion): @@ -662,7 +676,9 @@ class ScanSetup(ConfigListScreen, Screen, CableTransponderSearchSupport): self.scan_sat.inversion.index, orbpos, self.scan_sat.system.index, - self.scan_sat.modulation.index) + self.scan_sat.modulation.index, + self.scan_sat.rolloff.index, + self.scan_sat.pilot.index) flags = self.scan_networkScan.value and eComponentScan.scanNetworkSearch or 0 extFlags = False elif self.scan_type.value == "single_satellite": diff --git a/lib/python/Screens/ServiceInfo.py b/lib/python/Screens/ServiceInfo.py index aa3dc9d7..4606f883 100644 --- a/lib/python/Screens/ServiceInfo.py +++ b/lib/python/Screens/ServiceInfo.py @@ -132,16 +132,17 @@ class ServiceInfo(Screen): else: if self.transponder_info: conv = { "type" : _("Transponder Type"), + "system" : _("System"), + "modulation" : _("Modulation"), + "orbital position" : _("Orbital Position"), "frequency" : _("Frequency"), "symbolrate" : _("Symbolrate"), - "orbital position" : _("Orbital Position"), - "inversion" : _("Inversion"), - "fec inner" : _("FEC"), - "modulation" : _("Modulation"), + "bandwidth" : _("Bandwidth"), "polarization" : _("Polarization"), + "inversion" : _("Inversion"), + "pilot" : _("Pilot"), "roll off" : _("Rolloff"), - "system" : _("System"), - "bandwidth" : _("Bandwidth"), + "fec inner" : _("FEC"), "code rate lp" : _("Coderate LP"), "code rate hp" : _("Coderate HP"), "constellation" : _("Constellation"), @@ -190,7 +191,9 @@ class ServiceInfo(Screen): ("Symbolrate", frontendData["symbol_rate"], TYPE_VALUE_DEC), ("Polarization", frontendData["polarization"], TYPE_TEXT), ("Inversion", frontendData["inversion"], TYPE_TEXT), - ("FEC inner", frontendData["fec_inner"], TYPE_TEXT)) + ("FEC inner", frontendData["fec_inner"], TYPE_TEXT), + ("Pilot", frontendData.get("pilot", None), TYPE_TEXT), + ("Rolloff", frontendData.get("rolloff", None), TYPE_TEXT)) elif frontendData["tuner_type"] == "DVB-C": return (("NIM", ['A', 'B', 'C', 'D'][frontendData["tuner_number"]], TYPE_TEXT), ("Type", frontendData["tuner_type"], TYPE_TEXT), @@ -217,6 +220,8 @@ class ServiceInfo(Screen): tlist = [ ] for item in Labels: + if item[1] is None: + continue; value = item[1] if len(item) < 4: tlist.append(ServiceInfoListEntry(item[0]+":", value, item[2])) diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 0da33635..ae55aa62 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -166,15 +166,25 @@ void PutSatelliteDataToDict(ePyObject &dict, eDVBFrontendParametersSatellite &fe default: case eDVBFrontendParametersSatellite::System::DVB_S: tmp="DVB-S"; break; case eDVBFrontendParametersSatellite::System::DVB_S2: - switch(feparm.roll_off) + switch(feparm.rolloff) { + default: case eDVBFrontendParametersSatellite::RollOff::alpha_0_35: tmp="0.35"; break; case eDVBFrontendParametersSatellite::RollOff::alpha_0_25: tmp="0.25"; break; case eDVBFrontendParametersSatellite::RollOff::alpha_0_20: tmp="0.20"; break; - default: - case eDVBFrontendParametersSatellite::RollOff::alpha_auto: tmp="AUTO"; break; } PutToDict(dict, "roll off", tmp); + if (feparm.modulation == eDVBFrontendParametersSatellite::Modulation::M8PSK) + { + switch(feparm.pilot) + { + case eDVBFrontendParametersSatellite::Pilot::On: tmp="ON"; break; + case eDVBFrontendParametersSatellite::Pilot::Off: tmp="OFF"; break; + default: + case eDVBFrontendParametersSatellite::Pilot::Unknown: tmp="AUTO"; break; + } + PutToDict(dict, "pilot", tmp); + } tmp="DVB-S2"; break; } -- 2.30.2