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