config.plugins.vuplusauthenticity = ConfigSubsection()
config.plugins.vuplusauthenticity.sn_a = NoSave(ConfigSelection(default = "MSA", choices = [ ("MSA", _("MSA")), ("MA", _("MA")), ("MB", _("MB")), ("MC", _("MC")), ("MD", _("MD")), ("ME", _("ME")), ("MF", _("MF")), ("MG", _("MG")), ("MH", _("MH"))] ))
config.plugins.vuplusauthenticity.sn_b = NoSave(ConfigInteger(default = 0, limits = (1, 999999999)))
+config.plugins.vuplusauthenticity.sn_b_msa = NoSave(ConfigInteger(default = 0, limits = (1, 9999999)))
config.plugins.vuplusauthenticity.email = NoSave(ConfigText(default = default_email_address, visible_width = 50, fixed_size = False))
GENUINE_MESSAGES={
def createSetup(self):
self.list = []
self.sn_aEntry = getConfigListEntry(_("1-1. Serial Number (The first two or three letters of SN)"), config.plugins.vuplusauthenticity.sn_a)
- self.sn_bEntry = getConfigListEntry(_("1-2. Serial Number (The remaining numbers of SN)"), config.plugins.vuplusauthenticity.sn_b)
+ if config.plugins.vuplusauthenticity.sn_a.value == "MSA":
+ self.sn_bEntry = getConfigListEntry(_("1-2. Serial Number (The remaining numbers of SN)"), config.plugins.vuplusauthenticity.sn_b_msa)
+ else:
+ self.sn_bEntry = getConfigListEntry(_("1-2. Serial Number (The remaining numbers of SN)"), config.plugins.vuplusauthenticity.sn_b)
self.emailEntry = getConfigListEntry(_("2. Contact"), config.plugins.vuplusauthenticity.email)
self.list.append( self.sn_aEntry )
self.list.append( self.sn_bEntry )
self["config"].l.setList(self.list)
def confirmValidSN(self):
- sn = str(config.plugins.vuplusauthenticity.sn_b.value)
- if len(sn) > 9:
- return False
- elif sn == '0':
+ if config.plugins.vuplusauthenticity.sn_a.value == 'MSA':
+ sn_length = 7
+ sn = str(config.plugins.vuplusauthenticity.sn_b_msa.value)
+ else:
+ sn_length = 9
+ sn = str(config.plugins.vuplusauthenticity.sn_b.value)
+ if len(sn) > sn_length or sn == '0':
return False
else:
- while(len(sn)<9):
+ while(len(sn)<sn_length):
sn = '0'+sn
- if int(sn[:2]) not in range(28):
- return False
- elif int(sn[2:4]) not in range(1,53):
- return False
- elif int(sn[-5:]) == 0:
- return False
+ if sn_length == 9:
+ if int(sn[:2]) not in range(28) or int(sn[2:4]) not in range(1,53) or int(sn[-5:]) == 0:
+ return False
+ else:
+ return True
else:
- return True
+ if int(sn[:2]) not in range(1,53) or int(sn[-5:]) == 0:
+ return False
+ else:
+ return True
def displayResult(self, ret = -5):
global GENUINE_MESSAGES
if(not self.confirmValidSN()):
self.displayResult(-5)
return
- sn_b = str(config.plugins.vuplusauthenticity.sn_b.value)
- while(len(sn_b)<9):
+ if config.plugins.vuplusauthenticity.sn_a.value == 'MSA':
+ sn_length = 7
+ sn_b = str(config.plugins.vuplusauthenticity.sn_b_msa.value)
+ else:
+ sn_length = 9
+ sn_b = str(config.plugins.vuplusauthenticity.sn_b.value)
+ while(len(sn_b)<sn_length):
sn_b = '0'+sn_b
serial_number = config.plugins.vuplusauthenticity.sn_a.value + sn_b
model =self.getModel()
except :
self.displayResult(-6)
+ def keyLeft(self):
+ ConfigListScreen.keyLeft(self)
+ self.createSetup()
+
+ def keyRight(self):
+ ConfigListScreen.keyRight(self)
+ self.createSetup()
+
def keyExit(self):
self.close()
from Tools import Notifications
import time
from os import system
-
+from Tools.Directories import fileExists
class HdmiCec:
("3", _("HDMI 3")),
("4", _("HDMI 4")),
("5", _("HDMI 5"))])
- config.hdmicec.devicename = ConfigSelection(
- choices = {
- "vuduo": _("VU-Duo"),
- "vusolo": _("VU-Solo"),
- "vuuno": _("VU-Uno"),
- "vuultimo":_("VU-Ultimo"),
- },
- default = "vuduo")
-
+ config.hdmicec.devicename = ConfigText(default = self.getDeviceName(), visible_width = 50, fixed_size = False)
config.misc.standbyCounter.addNotifier(self.enterStandby, initial_call = False)
config.misc.DeepStandbyOn.addNotifier(self.enterDeepStandby, initial_call = False)
self.leaveDeepStandby()
+ def getDeviceName(self):
+ deviceList = {
+ "duo": "VU+ Duo",
+ "solo": "VU+ Solo",
+ "uno": "VU+ Uno",
+ "ultimo": "VU+ Ultimo",
+ }
+ if fileExists("/proc/stb/info/vumodel"):
+ vumodel = open("/proc/stb/info/vumodel")
+ info=vumodel.read().strip()
+ vumodel.close()
+ return deviceList.setdefault(info, "VU+")
+ else:
+ return "VU+"
+
def sendMessages(self, messages):
for message in messages.split(','):
cmd = None
elif message == 0x46: # request device name
address = addresstv
cecmessage = setnamemessage
- if config.hdmicec.devicename.value == "vuduo":
- cecmessagetwo ="VU+ Duo"
- cmd = struct.pack('B8s',cecmessage,cecmessagetwo)
- elif config.hdmicec.devicename.value == "vusolo":
- cecmessagetwo ="VU+ Solo"
- cmd = struct.pack('B9s',cecmessage,cecmessagetwo)
- elif config.hdmicec.devicename.value == "vuuno":
- cecmessagetwo ="VU+ Uno"
- cmd = struct.pack('B8s',cecmessage,cecmessagetwo)
- elif config.hdmicec.devicename.value == "vuultimo":
- cecmessagetwo ="VU+ Ultimo"
- cmd = struct.pack('B8s',cecmessage,cecmessagetwo)
- else:
+ name_len = len(config.hdmicec.devicename.value)
+ if name_len == 0:
cecmessagetwo ="VU+"
cmd = struct.pack('B4s',cecmessage,cecmessagetwo)
+ else:
+ cecmessagetwo = config.hdmicec.devicename.value
+ cmd = struct.pack('B'+str(name_len+1)+'s',cecmessage,cecmessagetwo)
logcmd = "[HDMI-CEC] send cec message %x:%s to %x" % (cecmessage,cecmessagetwo,address)
elif message == 0x85: # request active source