from Tools.HardwareInfo import HardwareInfo
from Tools.Directories import resolveFilename, SCOPE_DEFAULTPARTITIONMOUNTDIR, SCOPE_DEFAULTDIR, SCOPE_DEFAULTPARTITION
-from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable, eConsoleAppContainer, eDVBResourceManager
+from enigma import eTimer, eDVBFrontendParametersSatellite, eComponentScan, eDVBSatelliteEquipmentControl, eDVBFrontendParametersTerrestrial, eDVBFrontendParametersCable, eConsoleAppContainer, eDVBResourceManager, getDesktop
+
+_modelName = file('/proc/stb/info/vumodel').read().strip()
+_supportNimType = { 'AVL1208':'', 'AVL6222':'6222_', 'AVL6211':'6211_', 'BCM7356':'bcm7346_'}
class Blindscan(ConfigListScreen, Screen):
- skin="""
- <screen name="Blindscan" position="center,center" 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" />
-
- <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 name="config" position="5,50" size="550,280" scrollbarMode="showOnDemand" />
- <widget name="introduction" position="0,345" size="560,20" font="Regular;20" halign="center" />
+ skin = """
+ <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="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,70" size="550,280" scrollbarMode="showOnDemand" />
+ <widget name="introduction" position="0,365" size="560,20" font="Regular;20" halign="center" />
</screen>
"""
+
def __init__(self, session):
Screen.__init__(self, session)
self["introduction"] = Label(_("Please setup your tuner configuration."))
self.i2c_mapping_table = None
+ self.nimSockets = self.ScanNimsocket()
self.makeNimSocket()
- def makeNimSocket(self):
+ def ScanNimsocket(self, filepath = '/proc/bus/nim_sockets'):
+ _nimSocket = {}
+ fp = file(filepath)
+
+ sNo, sName, sI2C = -1, "", -1
+ for line in fp:
+ line = line.strip()
+ if line.startswith('NIM Socket'):
+ sNo, sName, sI2C = -1, '', -1
+ try: sNo = line.split()[2][:-1]
+ except: sNo = -1
+ elif line.startswith('I2C_Device:'):
+ try: sI2C = line.split()[1]
+ except: sI2C = -1
+ elif line.startswith('Name:'):
+ splitLines = line.split()
+ try:
+ if splitLines[1].startswith('BCM'):
+ sName = splitLines[1]
+ else:
+ sName = splitLines[3][4:-1]
+ except: sName = ""
+ if sNo >= 0 and sName != "":
+ if sName.startswith('BCM'):
+ sI2C = sNo
+ if sI2C != -1:
+ _nimSocket[sNo] = [sName, sI2C]
+ else: _nimSocket[sNo] = [sName]
+ fp.close()
+ print "parsed nimsocket :", _nimSocket
+ return _nimSocket
+
+ def makeNimSocket(self, nimname=""):
+ is_exist_i2c = False
self.i2c_mapping_table = {0:2, 1:3, 2:1, 3:0}
+ if self.nimSockets is not None:
+ for XX in self.nimSockets.keys():
+ nimsocket = self.nimSockets[XX]
+ if len(nimsocket) > 1:
+ try: self.i2c_mapping_table[int(XX)] = int(nimsocket[1])
+ except: continue
+ is_exist_i2c = True
+ print "i2c_mapping_table :", self.i2c_mapping_table, ", is_exist_i2c :", is_exist_i2c
+ if is_exist_i2c: return
+
+ if nimname == "AVL6222":
+ model = _modelName #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":
+ nimdata = self.nimSockets['0']
+ try:
+ if nimdata[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}
+ except: 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)][0]
+ 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)
"ROLLOFF_25" : parm.RollOff_alpha_0_25,
"ROLLOFF_35" : parm.RollOff_alpha_0_35}
pilot={ "PILOT_ON" : parm.Pilot_On,
- "PILOT_OFF" : parm.Pilot_Off}
+ "PILOT_OFF" : parm.Pilot_Off,
+ "PILOT_AUTO" : parm.Pilot_Unknown}
pol = { "HORIZONTAL" : parm.Polarisation_Horizontal,
"VERTICAL" : parm.Polarisation_Vertical}
- parm.orbital_position = self.orb_position
- parm.polarisation = pol[data[1]]
- parm.frequency = int(data[2])
- parm.symbol_rate = int(data[3])
- parm.system = sys[data[4]]
- parm.inversion = inv[data[5]]
- parm.pilot = pilot[data[6]]
- parm.fec = fec[data[7]]
- parm.modulation = qam[data[8]]
- parm.rolloff = roll[data[9]]
- self.tmp_tplist.append(parm)
+ try :
+ parm.orbital_position = self.orb_position
+ parm.polarisation = pol[data[1]]
+ parm.frequency = int(data[2])
+ parm.symbol_rate = int(data[3])
+ parm.system = sys[data[4]]
+ parm.inversion = inv[data[5]]
+ parm.pilot = pilot[data[6]]
+ parm.fec = fec[data[7]]
+ parm.modulation = qam[data[8]]
+ parm.rolloff = roll[data[9]]
+ self.tmp_tplist.append(parm)
+ except: pass
self.blindscan_session.close(True)
def blindscanContainerAvail(self, str):