From c223012f1c3d5f1f32f622afb0709136a51ab86f Mon Sep 17 00:00:00 2001 From: littlesat Date: Wed, 7 Dec 2016 19:34:45 +0100 Subject: [PATCH 01/11] HdmiCec: Only weekup from standby when HDMI-CEC is enabled --- lib/python/Components/HdmiCec.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/python/Components/HdmiCec.py b/lib/python/Components/HdmiCec.py index 073ef012c3..de17ddea6e 100644 --- a/lib/python/Components/HdmiCec.py +++ b/lib/python/Components/HdmiCec.py @@ -59,9 +59,8 @@ def __init__(self): eActionMap.getInstance().bindAction('', -maxint - 1, self.keyEvent) config.hdmicec.volume_forwarding.addNotifier(self.configVolumeForwarding) config.hdmicec.enabled.addNotifier(self.configVolumeForwarding) - if config.hdmicec.handle_deepstandby_events.value: - if not getFPWasTimerWakeup(): - self.onLeaveStandby() + if config.hdmicec.enabled.value and config.hdmicec.handle_deepstandby_events.value and not getFPWasTimerWakeup(): + self.onLeaveStandby() def getPhysicalAddress(self): physicaladdress = eHdmiCEC.getInstance().getPhysicalAddress() From 186a39cfe45b653b4fb14dca0f19f3d4ac0d1dc2 Mon Sep 17 00:00:00 2001 From: Dimitrij Date: Wed, 7 Dec 2016 20:43:21 +0200 Subject: [PATCH 02/11] [Navigation] add func isRestartUI for notification (#546) --- Navigation.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Navigation.py b/Navigation.py index f9acd6cf3f..5694de0681 100644 --- a/Navigation.py +++ b/Navigation.py @@ -36,6 +36,7 @@ def __init__(self): self.currentlyPlayingService = None self.RecordTimer = RecordTimer.RecordTimer() self.__wasTimerWakeup = getFPWasTimerWakeup() + self.__isRestartUI = config.misc.RestartUI.value startup_to_standby = config.usage.startup_to_standby.value wakeup_time_type = config.misc.prev_wakeup_time_type.value if self.__wasTimerWakeup: @@ -55,6 +56,9 @@ def __init__(self): def wasTimerWakeup(self): return self.__wasTimerWakeup + def isRestartUI(self): + return self.__isRestartUI + def dispatchEvent(self, i): for x in self.event: x(i) From d301d9f242b9d4d5558aba96d5e296fa1399c257 Mon Sep 17 00:00:00 2001 From: Littlesat Date: Sat, 10 Dec 2016 11:56:14 +0100 Subject: [PATCH 03/11] Revert "Hide volumebar when mute and show when unmute" This reverts commit ded34172f61f35a798c11951ec5a7b42a5723d0b. --- lib/python/Components/VolumeControl.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/python/Components/VolumeControl.py b/lib/python/Components/VolumeControl.py index 19fbc7b227..e68ab56984 100644 --- a/lib/python/Components/VolumeControl.py +++ b/lib/python/Components/VolumeControl.py @@ -83,10 +83,7 @@ def volMute(self, showMuteSymbol=True, force=False): if self.volctrl.isMuted(): if showMuteSymbol: self.showMute() - self.volumeDialog.hide() self.volumeDialog.setValue(0) else: self.muteDialog.hide() self.volumeDialog.setValue(vol) - self.volumeDialog.show() - self.hideVolTimer.start(3000, True) From 1cf14c4ec753a2252df86bf434a663ab224c6edd Mon Sep 17 00:00:00 2001 From: Littlesat Date: Sat, 10 Dec 2016 11:56:43 +0100 Subject: [PATCH 04/11] Revert "Autohide mute indicator the same as volume button" This reverts commit 2e875f5ca0c53dbe40866a8fac2e8ceb86801eb9. --- lib/python/Components/VolumeControl.py | 8 +------- lib/python/Screens/InfoBarGenerics.py | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/python/Components/VolumeControl.py b/lib/python/Components/VolumeControl.py index e68ab56984..e28a7cd138 100644 --- a/lib/python/Components/VolumeControl.py +++ b/lib/python/Components/VolumeControl.py @@ -69,12 +69,6 @@ def setVolume(self, direction): def volHide(self): self.volumeDialog.hide() - self.muteDialog.hide() - - def showMute(self): - if self.volctrl.isMuted(): - self.muteDialog.show() - self.hideVolTimer.start(3000, True) def volMute(self, showMuteSymbol=True, force=False): vol = self.volctrl.getVolume() @@ -82,7 +76,7 @@ def volMute(self, showMuteSymbol=True, force=False): self.volctrl.volumeToggleMute() if self.volctrl.isMuted(): if showMuteSymbol: - self.showMute() + self.muteDialog.show() self.volumeDialog.setValue(0) else: self.muteDialog.hide() diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index 780c266935..1f5d4c8f79 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -283,7 +283,6 @@ def __onShow(self): for x in self.onShowHideNotifiers: x(True) self.startHideTimer() - VolumeControl.instance and VolumeControl.instance.showMute() def __onHide(self): self.__state = self.STATE_HIDDEN From 7cbf58a2c8bdb0fa8978c7273933b65c4931445a Mon Sep 17 00:00:00 2001 From: Littlesat Date: Sat, 10 Dec 2016 12:08:46 +0100 Subject: [PATCH 05/11] Mute with long mute when you wnat to mute and do not want to see the icon --- data/keymap.xml | 1 + lib/python/Components/VolumeControl.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/data/keymap.xml b/data/keymap.xml index bdaa1ab0da..18bc1b506e 100644 --- a/data/keymap.xml +++ b/data/keymap.xml @@ -256,6 +256,7 @@ + diff --git a/lib/python/Components/VolumeControl.py b/lib/python/Components/VolumeControl.py index e28a7cd138..b82ddb3c7c 100644 --- a/lib/python/Components/VolumeControl.py +++ b/lib/python/Components/VolumeControl.py @@ -16,6 +16,7 @@ def __init__(self, session): globalActionMap.actions["volumeUp"]=self.volUp globalActionMap.actions["volumeDown"]=self.volDown globalActionMap.actions["volumeMute"]=self.volMute + globalActionMap.actions["volumeMuteLong"]=self.volMuteLong assert not VolumeControl.instance, "only one VolumeControl instance is allowed!" VolumeControl.instance = self @@ -81,3 +82,6 @@ def volMute(self, showMuteSymbol=True, force=False): else: self.muteDialog.hide() self.volumeDialog.setValue(vol) + + def volMuteLong(self): + self.muteDialog.hide() From b43b2caf45af87e8e7aae95c47a04a6e3e826bfa Mon Sep 17 00:00:00 2001 From: Littlesat Date: Sat, 10 Dec 2016 12:10:01 +0100 Subject: [PATCH 06/11] Remove repeat on mute button as this makes no sense --- data/keymap.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/keymap.xml b/data/keymap.xml index 18bc1b506e..f5337ad0f9 100644 --- a/data/keymap.xml +++ b/data/keymap.xml @@ -255,7 +255,7 @@ - + From 0b20fb8c925b5bd746793ac0aa44704cffaa2981 Mon Sep 17 00:00:00 2001 From: Littlesat Date: Sat, 10 Dec 2016 12:12:02 +0100 Subject: [PATCH 07/11] VolumeControl: cosmetics --- lib/python/Components/VolumeControl.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/python/Components/VolumeControl.py b/lib/python/Components/VolumeControl.py index b82ddb3c7c..47ff5a1061 100644 --- a/lib/python/Components/VolumeControl.py +++ b/lib/python/Components/VolumeControl.py @@ -13,10 +13,10 @@ class VolumeControl: a corresponding dialog""" def __init__(self, session): global globalActionMap - globalActionMap.actions["volumeUp"]=self.volUp - globalActionMap.actions["volumeDown"]=self.volDown - globalActionMap.actions["volumeMute"]=self.volMute - globalActionMap.actions["volumeMuteLong"]=self.volMuteLong + globalActionMap.actions["volumeUp"] = self.volUp + globalActionMap.actions["volumeDown"] = self.volDown + globalActionMap.actions["volumeMute"] = self.volMute + globalActionMap.actions["volumeMuteLong"] = self.volMuteLong assert not VolumeControl.instance, "only one VolumeControl instance is allowed!" VolumeControl.instance = self From 4ec828411ed6ba9865a280e75627d2a9010e09fc Mon Sep 17 00:00:00 2001 From: Littlesat Date: Sat, 10 Dec 2016 12:40:11 +0100 Subject: [PATCH 08/11] HdmiCec: Change wakeup repeat timer default to 3 seconds It seems some TVs need such delay and therefore always enable this timer --- lib/python/Components/HdmiCec.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/python/Components/HdmiCec.py b/lib/python/Components/HdmiCec.py index de17ddea6e..eedfd6dce8 100644 --- a/lib/python/Components/HdmiCec.py +++ b/lib/python/Components/HdmiCec.py @@ -33,9 +33,9 @@ choicelist.append(("%d" % i, "%d ms" % i)) config.hdmicec.minimum_send_interval = ConfigSelection(default = "0", choices = [("0", _("Disabled"))] + choicelist) choicelist = [] -for i in range(5, 65, 5): +for i in [3] + range(5, 65, 5): choicelist.append(("%d" % i, _("%d sec") % i)) -config.hdmicec.repeat_wakeup_timer = ConfigSelection(default = "0", choices = [("0", _("Disabled"))] + choicelist) +config.hdmicec.repeat_wakeup_timer = ConfigSelection(default = "3", choices = [("0", _("Disabled"))] + choicelist) class HdmiCec: From 805765ccc13d276099b78315b478d5361dc5abba Mon Sep 17 00:00:00 2001 From: littlesat Date: Wed, 10 Aug 2016 19:36:23 +0200 Subject: [PATCH 09/11] JESS: Update unicable.xml with JESS products included. --- data/unicable.xml | 411 +++++++++++++++++++++++++++++++--------------- 1 file changed, 275 insertions(+), 136 deletions(-) diff --git a/data/unicable.xml b/data/unicable.xml index e41d845a49..bda7aa6344 100644 --- a/data/unicable.xml +++ b/data/unicable.xml @@ -1,180 +1,319 @@ - - - + - - + + + + + + + + + + + + + - - + + + + + + + + - + - - + + + + + - + - + - - + - + + + + + + + + + + + + + - + + + + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + - + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + + + + - - - - - + + + + + + + + + - - - - + + + + + + From e58c478ec4162f2314a1507b1f2b73090be8dcc0 Mon Sep 17 00:00:00 2001 From: littlesat Date: Wed, 10 Aug 2016 19:34:47 +0200 Subject: [PATCH 10/11] JESS: User interface. - add unicable_user - add position (default is LNB number) - add Unicable / JESS mode switch - add positionsoffset - store selected Unicable LNB or switch type - do not forward the positions, which in fact means max positions. As the mode defines how many positions are possible and the UI in python determines the maximum positions by the selected hardware - do not fake when there is no unicable/jess enabled a frequency index of -1. Use mode 0 instead. - Forward the unicable/jess mode as integer. 0 = none, 1 = Unicable, 2 = JESS. --- lib/python/Components/NimManager.py | 246 ++++++++++------------------ lib/python/Screens/Satconfig.py | 70 +++----- 2 files changed, 107 insertions(+), 209 deletions(-) diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index 1600e617e6..bf8498c404 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -20,6 +20,8 @@ from Tools import Directories import xml.etree.cElementTree +config.unicable = ConfigSubsection() + def getConfigSatlist(orbpos, satlist): default_orbpos = None for x in satlist: @@ -313,39 +315,19 @@ def updateAdvanced(self, sec, slotid): tunermask |= (1 << slot) if currLnb.lof.value != "unicable": - sec.setLNBSatCR(-1) - + sec.setLNBSatCRformat(0) # Unicable / JESS disabled, 0 = SatCR_format_none if currLnb.lof.value == "universal_lnb": sec.setLNBLOFL(9750000) sec.setLNBLOFH(10600000) sec.setLNBThreshold(11700000) elif currLnb.lof.value == "unicable": - def setupUnicable(configManufacturer, ProductDict): - manufacturer_name = configManufacturer.value - manufacturer = ProductDict[manufacturer_name] - product_name = manufacturer.product.value - sec.setLNBSatCR(manufacturer.scr[product_name].index) - sec.setLNBSatCRvco(manufacturer.vco[product_name][manufacturer.scr[product_name].index].value*1000) - sec.setLNBSatCRpositions(manufacturer.positions[product_name][0].value) - sec.setLNBLOFL(manufacturer.lofl[product_name][0].value * 1000) - sec.setLNBLOFH(manufacturer.lofh[product_name][0].value * 1000) - sec.setLNBThreshold(manufacturer.loft[product_name][0].value * 1000) - configManufacturer.save_forced = True - manufacturer.product.save_forced = True - manufacturer.vco[product_name][manufacturer.scr[product_name].index].save_forced = True - - if currLnb.unicable.value == "unicable_user": -#TODO satpositions for satcruser - sec.setLNBLOFL(currLnb.lofl.value * 1000) - sec.setLNBLOFH(currLnb.lofh.value * 1000) - sec.setLNBThreshold(currLnb.threshold.value * 1000) - sec.setLNBSatCR(currLnb.satcruser.index) - sec.setLNBSatCRvco(currLnb.satcrvcouser[currLnb.satcruser.index].value*1000) - sec.setLNBSatCRpositions(1) #HACK - elif currLnb.unicable.value == "unicable_matrix": - setupUnicable(currLnb.unicableMatrixManufacturer, currLnb.unicableMatrix) - elif currLnb.unicable.value == "unicable_lnb": - setupUnicable(currLnb.unicableLnbManufacturer, currLnb.unicableLnb) + sec.setLNBLOFL(currLnb.lofl.value * 1000) + sec.setLNBLOFH(currLnb.lofh.value * 1000) + sec.setLNBThreshold(currLnb.threshold.value * 1000) + sec.setLNBSatCR(currLnb.scrList.index) + sec.setLNBSatCRvco(currLnb.scrfrequency.value * 1000) + sec.setLNBSatCRPositionNumber(int(currLnb.positionNumber.value) + int(currLnb.positionsOffset.value)) + sec.setLNBSatCRformat(currLnb.format.value == "jess" and 2 or 1) elif currLnb.lof.value == "c_band": sec.setLNBLOFL(5150000) sec.setLNBLOFH(5150000) @@ -1161,69 +1143,6 @@ def InitNimManager(nimmgr, update_slots = []): lnb_choices_default = "universal_lnb" - unicablelnbproducts = {} - unicablematrixproducts = {} - doc = xml.etree.cElementTree.parse(eEnv.resolve("${datadir}/enigma2/unicable.xml")) - root = doc.getroot() - - entry = root.find("lnb") - for manufacturer in entry.getchildren(): - m={} - for product in manufacturer.getchildren(): - scr=[] - lscr=("scr1","scr2","scr3","scr4","scr5","scr6","scr7","scr8") - for i in range(len(lscr)): - scr.append(product.get(lscr[i],"0")) - for i in range(len(lscr)): - if scr[len(lscr)-i-1] == "0": - scr.pop() - else: - break; - lof=[] - lof.append(int(product.get("positions",1))) - lof.append(int(product.get("lofl",9750))) - lof.append(int(product.get("lofh",10600))) - lof.append(int(product.get("threshold",11700))) - scr.append(tuple(lof)) - m.update({product.get("name"):tuple(scr)}) - unicablelnbproducts.update({manufacturer.get("name"):m}) - - entry = root.find("matrix") - for manufacturer in entry.getchildren(): - m={} - for product in manufacturer.getchildren(): - scr=[] - lscr=("scr1","scr2","scr3","scr4","scr5","scr6","scr7","scr8") - for i in range(len(lscr)): - scr.append(product.get(lscr[i],"0")) - for i in range(len(lscr)): - if scr[len(lscr)-i-1] == "0": - scr.pop() - else: - break; - lof=[] - lof.append(int(product.get("positions",1))) - lof.append(int(product.get("lofl",9750))) - lof.append(int(product.get("lofh",10600))) - lof.append(int(product.get("threshold",11700))) - scr.append(tuple(lof)) - m.update({product.get("name"):tuple(scr)}) - unicablematrixproducts.update({manufacturer.get("name"):m}) - - UnicableLnbManufacturers = unicablelnbproducts.keys() - UnicableLnbManufacturers.sort() - UnicableMatrixManufacturers = unicablematrixproducts.keys() - UnicableMatrixManufacturers.sort() - - unicable_choices = { - "unicable_lnb": _("Unicable LNB"), - "unicable_matrix": _("Unicable Matrix"), - "unicable_user": "Unicable "+_("User defined")} - unicable_choices_default = "unicable_lnb" - - advanced_lnb_satcruser_choices = [ ("1", "SatCR 1"), ("2", "SatCR 2"), ("3", "SatCR 3"), ("4", "SatCR 4"), - ("5", "SatCR 5"), ("6", "SatCR 6"), ("7", "SatCR 7"), ("8", "SatCR 8")] - prio_list = [ ("-1", _("Auto")) ] for prio in range(65)+range(14000,14065)+range(19000,19065): description = "" @@ -1280,79 +1199,78 @@ def configLOFChanged(configElement): lnbs = nim.advanced.lnb section = lnbs[lnb] if isinstance(section.unicable, ConfigNothing): - if lnb == 1: - section.unicable = ConfigSelection(unicable_choices, unicable_choices_default) - elif lnb == 2: - section.unicable = ConfigSelection(choices = {"unicable_matrix": _("Unicable Matrix"),"unicable_user": "Unicable "+_("User defined")}, default = "unicable_matrix") - else: - section.unicable = ConfigSelection(choices = {"unicable_user": _("User defined")}, default = "unicable_user") - - def fillUnicableConf(sectionDict, unicableproducts, vco_null_check): - for y in unicableproducts: - products = unicableproducts[y].keys() - products.sort() - tmp = ConfigSubsection() - tmp.product = ConfigSelection(choices = products, default = products[0]) - tmp.scr = ConfigSubDict() - tmp.vco = ConfigSubDict() - tmp.lofl = ConfigSubDict() - tmp.lofh = ConfigSubDict() - tmp.loft = ConfigSubDict() - tmp.positions = ConfigSubDict() - for z in products: - scrlist = [] - vcolist = unicableproducts[y][z] - tmp.vco[z] = ConfigSubList() - for cnt in range(1,1+len(vcolist)-1): - vcofreq = int(vcolist[cnt-1]) - if vcofreq == 0 and vco_null_check: - scrlist.append(("%d" %cnt,"SCR %d " %cnt +_("not used"))) - else: - scrlist.append(("%d" %cnt,"SCR %d" %cnt)) - tmp.vco[z].append(ConfigInteger(default=vcofreq, limits = (vcofreq, vcofreq))) - tmp.scr[z] = ConfigSelection(choices = scrlist, default = scrlist[0][0]) - - positions = int(vcolist[len(vcolist)-1][0]) - tmp.positions[z] = ConfigSubList() - tmp.positions[z].append(ConfigInteger(default=positions, limits = (positions, positions))) - - lofl = vcolist[len(vcolist)-1][1] - tmp.lofl[z] = ConfigSubList() - tmp.lofl[z].append(ConfigInteger(default=lofl, limits = (lofl, lofl))) - - lofh = int(vcolist[len(vcolist)-1][2]) - tmp.lofh[z] = ConfigSubList() - tmp.lofh[z].append(ConfigInteger(default=lofh, limits = (lofh, lofh))) - - loft = int(vcolist[len(vcolist)-1][3]) - tmp.loft[z] = ConfigSubList() - tmp.loft[z].append(ConfigInteger(default=loft, limits = (loft, loft))) - sectionDict[y] = tmp - - if lnb < 3: - print "[InitNimManager] MATRIX" - section.unicableMatrix = ConfigSubDict() - section.unicableMatrixManufacturer = ConfigSelection(UnicableMatrixManufacturers, UnicableMatrixManufacturers[0]) - fillUnicableConf(section.unicableMatrix, unicablematrixproducts, True) - - if lnb < 2: - print "[InitNimManager] LNB" - section.unicableLnb = ConfigSubDict() - section.unicableLnbManufacturer = ConfigSelection(UnicableLnbManufacturers, UnicableLnbManufacturers[0]) - fillUnicableConf(section.unicableLnb, unicablelnbproducts, False) - -#TODO satpositions for satcruser - section.satcruser = ConfigSelection(advanced_lnb_satcruser_choices, default="1") - tmp = ConfigSubList() - tmp.append(ConfigInteger(default=1284, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1400, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1516, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1632, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1748, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1864, limits = (950, 2150))) - tmp.append(ConfigInteger(default=1980, limits = (950, 2150))) - tmp.append(ConfigInteger(default=2096, limits = (950, 2150))) - section.satcrvcouser = tmp + def positionsChanged(configEntry): + section.positionNumber = ConfigSelection(["%d" % (x+1) for x in range(configEntry.value)], default="%d" % min(lnb, configEntry.value)) + def scrListChanged(productparameters, srcfrequencylist, configEntry): + section.format = ConfigSelection([("unicable", _("Unicable")), ("jess", _("JESS"))], default=productparameters.get("format", "unicable")) + section.scrfrequency = ConfigInteger(default=int(srcfrequencylist[configEntry.index])) + section.positions = ConfigInteger(default=int(productparameters.get("positions", 1))) + section.positions.addNotifier(positionsChanged) + section.positionsOffset = ConfigInteger(default=int(productparameters.get("positionsoffset", 0))) + section.lofl = ConfigInteger(default=int(productparameters.get("lofl", 9750))) + section.lofh = ConfigInteger(default=int(productparameters.get("lofh", 10600))) + section.threshold = ConfigInteger(default=int(productparameters.get("threshold", 11700))) + def unicableProductChanged(manufacturer, lnb_or_matrix, configEntry): + config.unicable.unicableProduct.value = configEntry.value + config.unicable.unicableProduct.save() + productparameters = [p for p in [m.getchildren() for m in unicable_xml.find(lnb_or_matrix) if m.get("name") == manufacturer][0] if p.get("name") == configEntry.value][0] + srcfrequencylist = productparameters.get("scrs").split(",") + section.scrList = ConfigSelection([("%d" % (x + 1), "SCR %d (%s)" % ((x + 1), srcfrequencylist[x])) for x in range(len(srcfrequencylist))]) + section.scrList.save_forced = True + section.scrList.addNotifier(boundFunction(scrListChanged, productparameters, srcfrequencylist)) + def unicableManufacturerChanged(lnb_or_matrix, configEntry): + config.unicable.unicableManufacturer.value = configEntry.value + config.unicable.unicableManufacturer.save() + productslist = [p.get("name") for p in [m.getchildren() for m in unicable_xml.find(lnb_or_matrix) if m.get("name") == configEntry.value][0]] + if not config.unicable.content.items.get("unicableProduct", False) or config.unicable.unicableProduct.value not in productslist: + config.unicable.unicableProduct = ConfigSelection(productslist) + config.unicable.unicableProduct.save_forced = True + section.unicableProduct = ConfigSelection(productslist, default=config.unicable.unicableProduct.value) + section.unicableProduct.save_forced = True + section.unicableProduct.addNotifier(boundFunction(unicableProductChanged, configEntry.value, lnb_or_matrix)) + def userScrListChanged(srcfrequencyList, configEntry): + section.scrfrequency = ConfigInteger(default=int(srcfrequencyList[configEntry.index]), limits=(950, 2150)) + section.lofl = ConfigInteger(default=9750, limits=(950, 2150)) + section.lofh = ConfigInteger(default=10600, limits=(950, 2150)) + section.threshold = ConfigInteger(default=11700, limits=(950, 2150)) + def formatChanged(configEntry): + section.positions = ConfigInteger(default=configEntry.value == "jess" and 64 or 2) + section.positions.addNotifier(positionsChanged) + section.positionsOffset = ConfigInteger(default=0) + section.scrList = ConfigSelection([("%d" % (x + 1), "SCR %d" % (x + 1)) for x in range(configEntry.value == "jess" and 32 or 8)]) + section.scrList.save_forced = True + srcfrequencyList = configEntry.value=="jess" and (1210, 1420, 1680, 2040, 984, 1020, 1056, 1092, 1128, 1164, 1256, 1292, 1328, 1364, 1458, 1494, 1530, 1566, 1602,\ + 1638, 1716, 1752, 1788, 1824, 1860, 1896, 1932, 1968, 2004, 2076, 2112, 2148) or (1284, 1400, 1516, 1632, 1748, 1864, 1980, 2096) + section.scrList.addNotifier(boundFunction(userScrListChanged, srcfrequencyList)) + def unicableChanged(configEntry): + config.unicable.unicable.value = configEntry.value + config.unicable.unicable.save() + if configEntry.value == "unicable_matrix": + manufacturerlist = [m.get("name") for m in unicable_xml.find("matrix")] + if not config.unicable.content.items.get("unicableManufacturer", False) or config.unicable.unicableManufacturer.value not in manufacturerlist: + config.unicable.unicableManufacturer = ConfigSelection(manufacturerlist) + section.unicableManufacturer = ConfigSelection(manufacturerlist, default=config.unicable.unicableManufacturer.value) + section.unicableManufacturer.save_forced = True + config.unicable.unicableManufacturer.save_forced = True + section.unicableManufacturer.addNotifier(boundFunction(unicableManufacturerChanged, "matrix")) + elif configEntry.value == "unicable_lnb": + manufacturerlist = [m.get("name") for m in unicable_xml.find("lnb")] + if not config.unicable.content.items.get("unicableManufacturer", False) or config.unicable.unicableManufacturer.value not in manufacturerlist: + config.unicable.unicableManufacturer = ConfigSelection(manufacturerlist) + section.unicableManufacturer = ConfigSelection(manufacturerlist, default=config.unicable.unicableManufacturer.value) + section.unicableManufacturer.save_forced = True + config.unicable.unicableManufacturer.save_forced = True + section.unicableManufacturer.addNotifier(boundFunction(unicableManufacturerChanged, "lnb")) + else: + section.format = ConfigSelection([("unicable", _("Unicable")), ("jess", _("JESS"))]) + section.format.addNotifier(formatChanged) + + unicable_xml = xml.etree.cElementTree.parse(eEnv.resolve("${datadir}/enigma2/unicable.xml")).getroot() + unicableList = [("unicable_lnb", _("Unicable LNB")), ("unicable_matrix", _("Unicable switch")), ("unicable_user", "Unicable "+_("User defined"))] + if not config.unicable.content.items.get("unicable", False): + config.unicable.unicable = ConfigSelection(unicableList) + section.unicable = ConfigSelection(unicableList, default=config.unicable.unicable.value) + section.unicable.addNotifier(unicableChanged) nim.advanced.unicableconnected = ConfigYesNo(default=False) nim.advanced.unicableconnectedTo = ConfigSelection([(str(id), nimmgr.getNimDescription(id)) for id in nimmgr.getNimListOfType("DVB-S") if id != x]) diff --git a/lib/python/Screens/Satconfig.py b/lib/python/Screens/Satconfig.py index 77ab5f01da..ddfadadc5f 100644 --- a/lib/python/Screens/Satconfig.py +++ b/lib/python/Screens/Satconfig.py @@ -116,6 +116,8 @@ def createSetup(self): self.cableConfigScanDetails = None self.have_advanced = False self.advancedUnicable = None + self.advancedFormat = None + self.advancedPosition = None self.advancedType = None self.advancedManufacturer = None self.advancedSCR = None @@ -252,23 +254,17 @@ def createSetup(self): def newConfig(self): self.setTextKeyBlue() - checkList = (self.configMode, self.diseqcModeEntry, self.advancedSatsEntry, \ - self.advancedLnbsEntry, self.advancedDiseqcMode, self.advancedUsalsEntry, \ - self.advancedLof, self.advancedPowerMeasurement, self.turningSpeed, \ - self.advancedType, self.advancedSCR, self.advancedManufacturer, self.advancedUnicable, self.advancedConnected, \ - self.toneburst, self.committedDiseqcCommand, self.uncommittedDiseqcCommand, self.singleSatEntry, \ - self.commandOrder, self.showAdditionalMotorOptions, self.cableScanType, self.cableConfigScanDetails, self.multiType) if self["config"].getCurrent() == self.multiType: update_slots = [self.slotid] from Components.NimManager import InitNimManager InitNimManager(nimmanager, update_slots) self.nim = nimmanager.nim_slots[self.slotid] self.nimConfig = self.nim.config - - for x in checkList: - if self["config"].getCurrent() == x: - self.createSetup() - break + if self["config"].getCurrent() in (self.configMode, self.diseqcModeEntry, self.advancedSatsEntry, self.advancedLnbsEntry, self.advancedDiseqcMode, self.advancedUsalsEntry,\ + self.advancedLof, self.advancedPowerMeasurement, self.turningSpeed, self.advancedType, self.advancedSCR, self.advancedPosition, self.advancedFormat, self.advancedManufacturer,\ + self.advancedUnicable, self.advancedConnected, self.toneburst, self.committedDiseqcCommand, self.uncommittedDiseqcCommand, self.singleSatEntry, self.commandOrder,\ + self.showAdditionalMotorOptions, self.cableScanType, self.multiType): + self.createSetup() def run(self): if self.nimConfig.configMode.value == "simple": @@ -324,8 +320,7 @@ def fillListWithAdvancedSatEntrys(self, Sat): if currLnb: if self.nim.isFBCLink(): - if currLnb.lof.value != "unicable": - currLnb.lof.value = "unicable" + currLnb.lof.value = "unicable" self.list.append(getConfigListEntry(_("Priority"), currLnb.prio)) self.advancedLof = getConfigListEntry("LOF", currLnb.lof) self.list.append(self.advancedLof) @@ -338,35 +333,26 @@ def fillListWithAdvancedSatEntrys(self, Sat): self.advancedUnicable = getConfigListEntry("Unicable "+_("Configuration mode"), currLnb.unicable) self.list.append(self.advancedUnicable) if currLnb.unicable.value == "unicable_user": - self.advancedSCR = getConfigListEntry(_("Channel"), currLnb.satcruser) + self.advancedFormat = getConfigListEntry(_("Format"), currLnb.format) + self.advancedPosition = getConfigListEntry(_("Position"), currLnb.positionNumber) + self.advancedSCR = getConfigListEntry(_("Channel"), currLnb.scrList) + self.list.append(self.advancedFormat) + self.list.append(self.advancedPosition) self.list.append(self.advancedSCR) - self.list.append(getConfigListEntry(_("Frequency"), currLnb.satcrvcouser[currLnb.satcruser.index])) + self.list.append(getConfigListEntry(_("Frequency"), currLnb.scrfrequency)) self.list.append(getConfigListEntry("LOF/L", currLnb.lofl)) self.list.append(getConfigListEntry("LOF/H", currLnb.lofh)) self.list.append(getConfigListEntry(_("Threshold"), currLnb.threshold)) - elif currLnb.unicable.value == "unicable_matrix": - manufacturer_name = currLnb.unicableMatrixManufacturer.value - manufacturer = currLnb.unicableMatrix[manufacturer_name] - product_name = manufacturer.product.value - self.advancedManufacturer = getConfigListEntry(_("Manufacturer"), currLnb.unicableMatrixManufacturer) - self.advancedType = getConfigListEntry(_("Type"), manufacturer.product) - self.advancedSCR = getConfigListEntry(_("Channel"), manufacturer.scr[product_name]) - self.list.append(self.advancedManufacturer) - self.list.append(self.advancedType) - self.list.append(self.advancedSCR) - self.list.append(getConfigListEntry(_("Frequency"), manufacturer.vco[product_name][manufacturer.scr[product_name].index])) - elif currLnb.unicable.value == "unicable_lnb": - manufacturer_name = currLnb.unicableLnbManufacturer.value - manufacturer = currLnb.unicableLnb[manufacturer_name] - product_name = manufacturer.product.value - self.advancedManufacturer = getConfigListEntry(_("Manufacturer"), currLnb.unicableLnbManufacturer) - self.advancedType = getConfigListEntry(_("Type"), manufacturer.product) - self.advancedSCR = getConfigListEntry(_("Channel"), manufacturer.scr[product_name]) + else: + self.advancedManufacturer = getConfigListEntry(_("Manufacturer"), currLnb.unicableManufacturer) + self.advancedType = getConfigListEntry(_("Type"), currLnb.unicableProduct) + self.advancedSCR = getConfigListEntry(_("Channel"), currLnb.scrList) + self.advancedPosition = getConfigListEntry(_("Position"), currLnb.positionNumber) self.list.append(self.advancedManufacturer) self.list.append(self.advancedType) + if currLnb.positions.value > 1: + self.list.append(self.advancedPosition) self.list.append(self.advancedSCR) - self.list.append(getConfigListEntry(_("Frequency"), manufacturer.vco[product_name][manufacturer.scr[product_name].index])) - choices = [] connectable = nimmanager.canConnectTo(self.slotid) for id in connectable: @@ -554,11 +540,8 @@ def __init__(self, session, slotid): self.setTitle(_("Setup") + " " + self.nim.friendly_full_description) def keyLeft(self): - if self.nim.isFBCLink(): - checkList = (self.advancedLof, self.advancedConnected) - curEntry = self["config"].getCurrent() - if curEntry in checkList: - return + if self.nim.isFBCLink() and self["config"].getCurrent() in (self.advancedLof, self.advancedConnected): + return ConfigListScreen.keyLeft(self) if self["config"].getCurrent() in (self.advancedSelectSatsEntry, self.selectSatsEntry): self.keyOk() @@ -572,11 +555,8 @@ def setTextKeyBlue(self): self["key_blue"].setText(self["config"].isChanged() and _("Set default") or "") def keyRight(self): - if self.nim.isFBCLink(): - checkList = (self.advancedLof, self.advancedConnected) - curEntry = self["config"].getCurrent() - if curEntry in checkList: - return + if self.nim.isFBCLink() and self["config"].getCurrent() in (self.advancedLof, self.advancedConnected): + return ConfigListScreen.keyRight(self) if self["config"].getCurrent() in (self.advancedSelectSatsEntry, self.selectSatsEntry): self.keyOk() From 72f2e5b08a0d2ed5d948e45f236968682872e796 Mon Sep 17 00:00:00 2001 From: Erik Slagter Date: Wed, 7 Dec 2016 19:41:23 +0100 Subject: [PATCH 11/11] JESS: C++ interface code and implementation. --- lib/dvb/frontend.cpp | 2 +- lib/dvb/frontend.h | 1 + lib/dvb/idvb.h | 2 +- lib/dvb/sec.cpp | 259 ++++++++++++++++++++++++++++++++++++++----- lib/dvb/sec.h | 24 +++- 5 files changed, 257 insertions(+), 31 deletions(-) diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index 67f4f8abe0..85193edce8 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -713,7 +713,7 @@ int eDVBFrontend::closeFrontend(bool force, bool no_delayed) { if (!no_delayed) { - m_sec->prepareTurnOffSatCR(*this, m_data[SATCR]); + m_sec->prepareTurnOffSatCR(*this); m_tuneTimer->start(0, true); if(!m_tuneTimer->isActive()) { diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index c23c81eb7a..df779faa8c 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -69,6 +69,7 @@ class eDVBFrontend: public iDVBFrontend, public Object CUR_VOLTAGE, // current voltage CUR_TONE, // current continuous tone SATCR, // current SatCR + DICTION, // current "diction" (0 = normal, 1 = Unicable, 2 = JESS) NUM_DATA_ENTRIES }; Signal1 m_stateChanged; diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index 3f20374ad9..e03a9f97c7 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -544,7 +544,7 @@ class iDVBSatelliteEquipmentControl: public iObject { public: virtual RESULT prepare(iDVBFrontend &frontend, const eDVBFrontendParametersSatellite &sat, int &frequency, int frontend_id, unsigned int timeout)=0; - virtual void prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr)=0; + virtual void prepareTurnOffSatCR(iDVBFrontend &frontend)=0; virtual int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *fe, int frontend_id, int *highest_score_lnb=0)=0; virtual void setRotorMoving(int slotid, bool)=0; }; diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index fbd3ad7639..90bf67b68d 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -103,7 +103,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite { bool rotor=false; eDVBSatelliteLNBParameters &lnb_param = m_lnbs[idx]; - bool is_unicable = lnb_param.SatCR_idx != -1; + bool is_unicable = lnb_param.SatCR_format != SatCR_format_none; bool is_unicable_position_switch = lnb_param.SatCR_positions > 1; if ( lnb_param.m_slot_mask & slot_id ) // lnb for correct tuner? @@ -324,7 +324,7 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, const eDVB eDVBSatelliteDiseqcParameters::t_diseqc_mode diseqc_mode = di_param.m_diseqc_mode; eDVBSatelliteSwitchParameters::t_voltage_mode voltage_mode = sw_param.m_voltage_mode; bool diseqc13V = voltage_mode == eDVBSatelliteSwitchParameters::HV_13; - bool is_unicable = lnb_param.SatCR_idx != -1; + bool is_unicable = lnb_param.SatCR_format != SatCR_format_none; bool useGotoXX = false; int RotorCmd=-1; @@ -722,12 +722,113 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, const eDVB eDVBDiseqcCommand diseqc; memset(diseqc.data, 0, MAX_DISEQC_LENGTH); - diseqc.len = 5; - diseqc.data[0] = 0xE0; - diseqc.data[1] = 0x10; - diseqc.data[2] = 0x5A; - diseqc.data[3] = lnb_param.UnicableTuningWord >> 8; - diseqc.data[4] = lnb_param.UnicableTuningWord; + + switch(lnb_param.SatCR_format) + { + case(SatCR_format_unicable): + { + // Unicable ODU_channel_change command + // + // data[0] framing: 0xe0 + // data[1] addressing: 0x10 + // data[2] command: ODU_channel_change 0x5a + // data[3] "data1": data[3][7..5]: user band, data[3][4..2]: bank, data[3][1..0]: T[9..8] + // data[4] "data2": data[4][7..0]: T[7..0] + + unsigned int ub = lnb_param.SatCR_idx & 0x07; + unsigned int ub_mhz = lnb_param.SatCRvco / 1000; + unsigned int frequency_mhz = sat.frequency / 1000; + unsigned int lof_mhz = lof / 1000; + unsigned int mode = band & 0x03; + unsigned int position = (lnb_param.SatCR_position - 1) & 0x01; + unsigned int bank = (position << 2) | (mode << 0); + unsigned int t1, t2, t3, t4, t5, t6; + unsigned int encoded_frequency_T; + + /* calculate "T" value */ + + t1 = (absdiff(frequency_mhz, lof_mhz) + ub_mhz) * 10; /* multiply "T" base by ten for proper rounding to nearest integer */ + t2 = t1 / 4; // divide by 4 MHz (per Unicable specification) + t3 = t2 / 10; // divide by 10 to correct earlier multiplication by 10, now integer*10 truncated + t4 = t3 * 10; // multiply again by 10 to get actual integer result + t5 = t2 - t4; // calculate difference between result and result integer*10 truncated, the fraction + t6 = t3 + (t5 >= 5 ? 1 : 0); // round the result + encoded_frequency_T = t6 - 350; + + diseqc.len = 5; + diseqc.data[0] = 0xe0; + diseqc.data[1] = 0x10; + diseqc.data[2] = 0x5a; + diseqc.data[3] = (unsigned char)((ub << 5) | (bank << 2) | ((encoded_frequency_T & 0x300) >> 8)); + diseqc.data[4] = (unsigned char)(encoded_frequency_T & 0xff); + //diseqc.data[3] = (lnb_param.UnicableTuningWord >> 8) & 0xff; + //diseqc.data[4] = (lnb_param.UnicableTuningWord >> 0) & 0xff; + + frontend.setData(eDVBFrontend::SATCR, lnb_param.SatCR_idx); + frontend.setData(eDVBFrontend::DICTION, SatCR_format_unicable); + + eDebug("**** Tuning Unicable"); + eDebug("**** frequency_mhz: %u", frequency_mhz); + eDebug("**** lo_mhz: %u", lof_mhz); + eDebug("**** ub_mhz: %u", ub_mhz); + eDebug("**** T: %u", encoded_frequency_T); + eDebug("**** ub: %u", ub); + eDebug("**** position: %u", position); + eDebug("**** mode: %u", mode); + eDebug("**** bank: %u", bank); + eDebug("**** Unicable: %02x %02x %02x %02x %02x", diseqc.data[0], diseqc.data[1], + diseqc.data[2], diseqc.data[3], diseqc.data[4]); + eDebug("**** Calculated tuningword: %04x", (diseqc.data[3] << 8) | (diseqc.data[4] << 0)); + eDebug("**** Stored tuningword: %04x", lnb_param.UnicableTuningWord); + + break; + } + + case(SatCR_format_jess): + { + // JESS ODU_channel_change command + // + // data[0] framing: 0x70 + // data[1] data[1][7..3]: ub, data[1][2..0:] T [10..8] + // data[2] data[2][7..0]: T [7..0] + // data[3] data[3][7..2]: position, data[3][1]: polarity, data[3][0]: band + + unsigned int ub = lnb_param.SatCR_idx & 0x1f; + unsigned int frequency_mhz = sat.frequency / 1000; + unsigned int lof_mhz = lof / 1000; + unsigned int encoded_frequency_T = frequency_mhz - lof_mhz - 100; + unsigned int mode = band & 0x03; + unsigned int position = (lnb_param.SatCR_position - 1) & 0x3f; + + diseqc.len = 4; + diseqc.data[0] = 0x70; + diseqc.data[1] = (unsigned char)((ub << 3) | ((encoded_frequency_T & 0x700) >> 8)); + diseqc.data[2] = (unsigned char)(encoded_frequency_T & 0xff); + diseqc.data[3] = (unsigned char)((position << 2) | mode); + + frontend.setData(eDVBFrontend::SATCR, lnb_param.SatCR_idx); + frontend.setData(eDVBFrontend::DICTION, SatCR_format_jess); + + eDebug("**** Tuning JESS"); + eDebug("**** frequency_mhz: %u", frequency_mhz); + eDebug("**** lo_mhz: %u", lof_mhz); + eDebug("**** T: %u", encoded_frequency_T); + eDebug("**** position: %u", position); + eDebug("**** ub: %u", ub); + eDebug("**** mode: %u", mode); + eDebug("**** JESS: %02x %02x %02x %02x", diseqc.data[0], diseqc.data[1], diseqc.data[2], diseqc.data[3]); + + break; + } + + default: + { + frontend.setData(eDVBFrontend::SATCR, 0); + frontend.setData(eDVBFrontend::DICTION, SatCR_format_none); + + eDebug("**** SatCR_format neither Unicable nor JESS!"); + } + } sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) ); @@ -735,6 +836,11 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, const eDVB if ( RotorCmd != -1 && RotorCmd != lastRotorCmd && !rotor_param.m_inputpower_parameters.m_use) sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_VOLTAGE_CHANGE_BEFORE_MOTOR_CMD]) ); // wait 150msec after voltage change } + else + { + frontend.setData(eDVBFrontend::SATCR, 0); + frontend.setData(eDVBFrontend::DICTION, SatCR_format_none); + } eDebugNoSimulate("[eDVBSatelliteEquipmentControl] RotorCmd %02x, lastRotorCmd %02lx", RotorCmd, lastRotorCmd); if ( RotorCmd != -1 && RotorCmd != lastRotorCmd ) @@ -964,9 +1070,13 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, const eDVB return -1; } -void eDVBSatelliteEquipmentControl::prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr) +void eDVBSatelliteEquipmentControl::prepareTurnOffSatCR(iDVBFrontend &frontend) { eSecCommandList sec_sequence; + long userband, diction; + + frontend.getData(eDVBFrontend::SATCR, userband); + frontend.getData(eDVBFrontend::DICTION, diction); // check if voltage is disabled eSecCommand::pair compare; @@ -983,12 +1093,67 @@ void eDVBSatelliteEquipmentControl::prepareTurnOffSatCR(iDVBFrontend &frontend, eDVBDiseqcCommand diseqc; memset(diseqc.data, 0, MAX_DISEQC_LENGTH); - diseqc.len = 5; - diseqc.data[0] = 0xE0; - diseqc.data[1] = 0x10; - diseqc.data[2] = 0x5A; - diseqc.data[3] = satcr << 5; - diseqc.data[4] = 0x00; + + switch((SatCR_format_t)diction) + { + case(SatCR_format_unicable): + { + // Unicable ODU_channel_change command, T = 0 means shutdown UB + // + // data[0] framing: 0xe0 + // data[1] addressing: 0x10 + // data[2] command: ODU_channel_change 0x5a + // data[3] "data1": data[3][7..5]: user band, data[3][4..2]: bank, data[3][1..0]: T[9..8] + // data[4] "data2": data[4][7..0]: T[7..0] + + unsigned int ub = userband & 0x01; + unsigned int encoded_frequency_T = 0; + unsigned int mode = 0; + unsigned int position = 0; + unsigned int bank = (position << 2) | (mode << 0); + + diseqc.len = 5; + diseqc.data[0] = 0xe0; + diseqc.data[1] = 0x10; + diseqc.data[2] = 0x5a; + diseqc.data[3] = (unsigned char)((ub << 5) | (bank << 2) | ((encoded_frequency_T & 0x300) >> 8)); + diseqc.data[4] = (unsigned char)(encoded_frequency_T & 0xff); + + eDebug("**** shutdown unicable ub %u", ub); + + break; + } + + case(SatCR_format_jess): + { + // JESS ODU_channel_change command, T = 0 means shutdown UB + // + // data[0] framing: 0x70 + // data[1] data[1][7..3]: ub, data[1][2..0:] T [10..8] + // data[2] data[2][7..0]: T [7..0] + // data[3] data[3][7..2]: position, data[3][1]: polarity, data[3][0]: band + + unsigned int ub = userband & 0x1f; + unsigned int encoded_frequency_T = 0; + unsigned int mode = 0; + unsigned int position = 0; + + diseqc.len = 4; + diseqc.data[0] = 0x70; + diseqc.data[1] = (unsigned char)((ub << 3) | ((encoded_frequency_T & 0x700) >> 8)); + diseqc.data[2] = (unsigned char)(encoded_frequency_T & 0xff); + diseqc.data[3] = (unsigned char)((position << 2) | mode); + + eDebug("**** shutdown JESS ub %d", ub); + + break; + } + + default: + { + eDebug("**** shutdown unknown unicable type ub %d!", (int)userband); + } + } sec_sequence.push_back( eSecCommand(eSecCommand::SEND_DISEQC, diseqc) ); sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, m_params[DELAY_AFTER_LAST_DISEQC_CMD]) ); @@ -1270,6 +1435,14 @@ RESULT eDVBSatelliteEquipmentControl::setInputpowerDelta(int delta) } /* Unicable Specific Parameters */ + +RESULT eDVBSatelliteEquipmentControl::getLNBSatCR() +{ + if ( currentLNBValid() ) + return m_lnbs[m_lnbidx].SatCR_idx; + return -ENOENT; +} + RESULT eDVBSatelliteEquipmentControl::setLNBSatCR(int SatCR_idx) { eSecDebug("[eDVBSatelliteEquipmentControl::setLNBSatCR] idx=%d", SatCR_idx); @@ -1282,6 +1455,13 @@ RESULT eDVBSatelliteEquipmentControl::setLNBSatCR(int SatCR_idx) return 0; } +RESULT eDVBSatelliteEquipmentControl::getLNBSatCRvco() +{ + if ( currentLNBValid() ) + return m_lnbs[m_lnbidx].SatCRvco; + return -ENOENT; +} + RESULT eDVBSatelliteEquipmentControl::setLNBSatCRvco(int SatCRvco) { eSecDebug("[eDVBSatelliteEquipmentControl::setLNBSatCRvco] vco=%d", SatCRvco); @@ -1296,6 +1476,13 @@ RESULT eDVBSatelliteEquipmentControl::setLNBSatCRvco(int SatCRvco) return 0; } +RESULT eDVBSatelliteEquipmentControl::getLNBSatCRpositions() +{ + if ( currentLNBValid() ) + return m_lnbs[m_lnbidx].SatCR_positions; + return -ENOENT; +} + RESULT eDVBSatelliteEquipmentControl::setLNBSatCRpositions(int SatCR_positions) { eSecDebug("[eDVBSatelliteEquipmentControl::setLNBSatCRpositions] positions=%d", SatCR_positions); @@ -1308,27 +1495,49 @@ RESULT eDVBSatelliteEquipmentControl::setLNBSatCRpositions(int SatCR_positions) return 0; } -RESULT eDVBSatelliteEquipmentControl::getLNBSatCRpositions() +RESULT eDVBSatelliteEquipmentControl::getLNBSatCRformat() { - if ( currentLNBValid() ) - return m_lnbs[m_lnbidx].SatCR_positions; + if (currentLNBValid()) + return m_lnbs[m_lnbidx].SatCR_format; + return -ENOENT; } -RESULT eDVBSatelliteEquipmentControl::getLNBSatCR() +RESULT eDVBSatelliteEquipmentControl::setLNBSatCRformat(SatCR_format_t SatCR_format) { - if ( currentLNBValid() ) - return m_lnbs[m_lnbidx].SatCR_idx; - return -ENOENT; + eSecDebug("eDVBSatelliteEquipmentControl::setLNBSatCRformat(%d)", (int)SatCR_format); + + if(SatCR_format > SatCR_format_jess) + return -EPERM; + + if (currentLNBValid()) + m_lnbs[m_lnbidx].SatCR_format = SatCR_format; + else + return -ENOENT; + + return 0; } -RESULT eDVBSatelliteEquipmentControl::getLNBSatCRvco() +RESULT eDVBSatelliteEquipmentControl::getLNBSatCRPositionNumber() { - if ( currentLNBValid() ) - return m_lnbs[m_lnbidx].SatCRvco; + if (currentLNBValid()) + return m_lnbs[m_lnbidx].SatCR_position; + return -ENOENT; } +RESULT eDVBSatelliteEquipmentControl::setLNBSatCRPositionNumber(unsigned int position_number) +{ + eSecDebug("eDVBSatelliteEquipmentControl::setLNBSatPositionNumber(%u)", position_number); + + if (currentLNBValid()) + m_lnbs[m_lnbidx].SatCR_position = position_number; + else + return -ENOENT; + + return 0; +} + /* Satellite Specific Parameters */ RESULT eDVBSatelliteEquipmentControl::addSatellite(int orbital_position) { diff --git a/lib/dvb/sec.h b/lib/dvb/sec.h index 9d6de652a7..f951667b81 100644 --- a/lib/dvb/sec.h +++ b/lib/dvb/sec.h @@ -6,6 +6,13 @@ #include +typedef enum +{ + SatCR_format_none = 0, + SatCR_format_unicable = 1, + SatCR_format_jess = 2 +} SatCR_format_t; + #ifndef SWIG class eSecCommand { @@ -235,11 +242,14 @@ class eDVBSatelliteRotorParameters class eDVBSatelliteLNBParameters { + public: + eDVBSatelliteLNBParameters() + { + SatCR_format = SatCR_format_none; + } #ifdef SWIG - eDVBSatelliteLNBParameters(); - ~eDVBSatelliteLNBParameters(); + ~eDVBSatelliteLNBParameters(); #endif -public: enum t_12V_relais_state { OFF=0, ON }; #ifndef SWIG t_12V_relais_state m_12V_relais_state; // 12V relais output on/off @@ -265,7 +275,9 @@ class eDVBSatelliteLNBParameters #define MAX_SATCR 8 #define MAX_LNBNUM 32 + SatCR_format_t SatCR_format; int SatCR_positions; + int SatCR_position; int SatCR_idx; unsigned int SatCRvco; unsigned int UnicableTuningWord; @@ -326,7 +338,7 @@ class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl #ifndef SWIG eDVBSatelliteEquipmentControl(eSmartPtrList &avail_frontends, eSmartPtrList &avail_simulate_frontends); RESULT prepare(iDVBFrontend &frontend, const eDVBFrontendParametersSatellite &sat, int &frequency, int frontend_id, unsigned int tunetimeout); - void prepareTurnOffSatCR(iDVBFrontend &frontend, int satcr); // used for unicable + void prepareTurnOffSatCR(iDVBFrontend &frontend); int canTune(const eDVBFrontendParametersSatellite &feparm, iDVBFrontend *, int frontend_id, int *highest_score_lnb=0); bool currentLNBValid() { return m_lnbidx > -1 && m_lnbidx < (int)(sizeof(m_lnbs) / sizeof(eDVBSatelliteLNBParameters)); } #endif @@ -363,9 +375,13 @@ class eDVBSatelliteEquipmentControl: public iDVBSatelliteEquipmentControl RESULT setLNBSatCR(int SatCR_idx); RESULT setLNBSatCRvco(int SatCRvco); RESULT setLNBSatCRpositions(int SatCR_positions); + RESULT setLNBSatCRformat(SatCR_format_t SatCR_format); + RESULT setLNBSatCRPositionNumber(unsigned int position_number); RESULT getLNBSatCR(); RESULT getLNBSatCRvco(); RESULT getLNBSatCRpositions(); + RESULT getLNBSatCRformat(); + RESULT getLNBSatCRPositionNumber(); /* Satellite Specific Parameters */ RESULT addSatellite(int orbital_position); RESULT setVoltageMode(int mode);