from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable, eConsoleAppContainer, eDVBResourceManager, getDesktop
+_supportNimType = { 'AVL1208':'', 'AVL6222':'6222_', 'AVL6211':'6211_'}
+
class Blindscan(ConfigListScreen, Screen):
- size = getDesktop(0).size()
- position_params = size.width() > 750 and ('center') or ('140')
skin = """
- <screen name="Blindscan" position="center,%s" size="560,370" title="Blindscan">
- <ePixmap pixmap="Vu_HD/buttons/red.png" position="5,0" size="80,40" alphatest="on" />
- <ePixmap pixmap="Vu_HD/buttons/green.png" position="186,0" size="80,40" alphatest="on" />
- <ePixmap pixmap="Vu_HD/buttons/blue.png" position="372,0" size="80,40" alphatest="on" />
+ <screen position="center,center" size="560,390" title="Blindscan">
+ <ePixmap pixmap="skin_default/buttons/red.png" position="40,10" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="210,10" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/blue.png" position="380,10" size="140,40" alphatest="on" />
- <widget source="key_red" render="Label" position="28,0" zPosition="1" size="160,30" font="Regular;20" halign="center" valign="center" transparent="1"/>
- <widget source="key_green" render="Label" position="213,0" zPosition="1" size="160,30" font="Regular;20" halign="center" valign="center" transparent="1"/>
- <widget source="key_blue" render="Label" position="400,0" zPosition="1" size="160,30" font="Regular;20" halign="center" valign="center" transparent="1"/>
+ <widget source="key_red" render="Label" position="40,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" foregroundColor="#ffffff" transparent="1"/>
+ <widget source="key_green" render="Label" position="210,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" foregroundColor="#ffffff" transparent="1"/>
+ <widget source="key_blue" render="Label" position="380,10" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" foregroundColor="#ffffff" transparent="1"/>
- <widget name="config" position="5,50" size="550,280" scrollbarMode="showOnDemand" />
- <widget name="introduction" position="0,345" size="560,20" font="Regular;20" halign="center" />
+ <widget name="config" position="5,70" size="550,280" scrollbarMode="showOnDemand" />
+ <widget name="introduction" position="0,365" size="560,20" font="Regular;20" halign="center" />
</screen>
- """ % position_params
+ """
def __init__(self, session):
Screen.__init__(self, session)
self.i2c_mapping_table = None
self.makeNimSocket()
-
- def makeNimSocket(self):
- self.i2c_mapping_table = {0:2, 1:3, 2:1, 3:0}
+ self.nimSockets = self.ScanNimsocket()
+
+ def ScanNimsocket(self):
+ _nimSocket = {}
+ fp = file('/proc/bus/nim_sockets')
+
+ sNo, sName = -1, ""
+ for line in fp:
+ line = line.strip()
+ if line.startswith('NIM Socket'):
+ sNo = line.split()[2][:-1]
+ elif line.startswith('Name:'):
+ sName = line.split()[3][4:-1]
+ if sNo >= 0 and sName != "":
+ _nimSocket[sNo] = sName
+ sNo = -1
+ sName = ''
+ fp.close()
+ return _nimSocket
+
+ def makeNimSocket(self, nimname=""):
+ self.i2c_mapping_table = {}
+
+ if nimname == "AVL6222":
+ model = file('/proc/stb/info/vumodel').read().strip()
+ if model == "uno":
+ self.i2c_mapping_table = {0:3, 1:3, 2:1, 3:0}
+ elif model == "duo2":
+ if self.nimSockets['0'] == "AVL6222":
+ self.i2c_mapping_table = {0:2, 1:2, 2:4, 3:4}
+ else: self.i2c_mapping_table = {0:2, 1:4, 2:4, 3:0}
+ else: self.i2c_mapping_table = {0:2, 1:4, 2:0, 3:0}
+ else: self.i2c_mapping_table = {0:2, 1:3, 2:1, 3:0}
def getNimSocket(self, slot_number):
if slot_number < 0 or slot_number > 3:
self.doRun(tmp_list, tmp_pol, tmp_band)
def doRun(self, tmp_list, tmp_pol, tmp_band):
+ def GetCommand(nimIdx):
+ _nimSocket = self.nimSockets
+ try:
+ sName = _nimSocket[str(nimIdx)]
+ sType = _supportNimType[sName]
+ return "vuplus_%(TYPE)sblindscan"%{'TYPE':sType}, sName
+ except: pass
+ return "vuplus_blindscan", ""
+ self.binName,nimName = GetCommand(self.scan_nims.value)
+
+ self.makeNimSocket(nimName)
+ if self.binName is None:
+ self.session.open(MessageBox, "Blindscan is not supported in " + nimName + " tuner.", MessageBox.TYPE_ERROR)
+ print nimName + " is not support blindscan."
+ return
+
self.full_data = ""
self.total_list=[]
for x in tmp_list:
if self.getNimSocket(self.feid) < 0:
print "can't find i2c number!!"
return
-
- cmd = "vuplus_blindscan %d %d %d %d %d %d %d %d" % (self.blindscan_start_frequency.value/1000000, self.blindscan_stop_frequency.value/1000000, self.blindscan_start_symbol.value/1000000, self.blindscan_stop_symbol.value/1000000, tab_pol[pol], tab_hilow[band], self.feid, self.getNimSocket(self.feid))
+ try:
+ cmd = "%s %d %d %d %d %d %d %d %d" % (self.binName, self.blindscan_start_frequency.value/1000000, self.blindscan_stop_frequency.value/1000000, self.blindscan_start_symbol.value/1000000, self.blindscan_stop_symbol.value/1000000, tab_pol[pol], tab_hilow[band], self.feid, self.getNimSocket(self.feid))
+ except: return
print "prepared command : [%s]" % (cmd)
self.blindscan_container = eConsoleAppContainer()
self.blindscan_container.appClosed.append(self.blindscanContainerClose)