1 from Screens.Screen import Screen
2 from Screens.MessageBox import MessageBox
3 from Plugins.Plugin import PluginDescriptor
4 from Components.MenuList import MenuList
5 from Tools.Directories import fileExists
6 from Components.ServiceList import ServiceList
7 from Components.ActionMap import ActionMap,NumberActionMap
8 from Components.config import config
9 from os import system,access,F_OK,R_OK,W_OK
10 from Components.Label import Label
11 from Components.AVSwitch import AVSwitch
12 from time import sleep
13 from Components.Console import Console
14 from enigma import eTimer
15 from Components.HTMLComponent import HTMLComponent
16 from Components.GUIComponent import GUIComponent
17 from enigma import eListboxPythonStringContent, eListbox, gFont, eServiceCenter, eDVBResourceManager
18 from enigma import eServiceReference
19 from enigma import eMemtest
20 from enigma import eSctest
21 from enigma import eDVBDB
22 from Components.NimManager import nimmanager
23 from enigma import eDVBCI_UI,eDVBCIInterfaces
25 class TestResultList(HTMLComponent, GUIComponent):
26 def __init__(self, source):
27 GUIComponent.__init__(self)
28 self.l = eListboxPythonStringContent()
30 self.l.setList(self.list)
34 def postWidgetCreate(self, instance):
35 self.instance.setSelectionEnable(0)
36 self.instance.setContent(self.l)
38 def updateList(self,list):
41 class FactoryTest(Screen):
43 <screen position="120,125" size="440,400" title="Test Menu" >
44 <widget name="testlist" position="10,0" size="340,350" />
45 <widget name="resultlist" position="370,0" size="60,350" />
46 <widget name="testdate" position="20,350" size="150,25" font="Regular;22" />
47 <widget name="testversion" position="20,375" size="150,25" font="Regular;22" />
48 <widget name="mactext" position="180,350" size="230,25" font="Regular;22" />
50 def __init__(self, session):
52 self["actions"] = NumberActionMap(["OkCancelActions","WizardActions","NumberActions","ColorActions",],
56 "ok": self.TestAction,
57 "testexit": self.keyCancel,
58 "agingstart": self.Agingmode,
61 "0": self.numberaction,
62 "1": self.numberaction,
63 "2": self.numberaction,
64 "3": self.numberaction,
65 "4": self.numberaction,
66 "5": self.numberaction,
67 "6": self.numberaction,
68 "7": self.numberaction,
69 "8": self.numberaction,
70 "9": self.numberaction,
71 "red": self.shutdownaction,
74 Screen.__init__(self, session)
75 TESTPROGRAM_DATE = "2010-10-29"
76 TESTPROGRAM_VERSION = "Version 00.01"
81 self["testdate"]=Label((TESTPROGRAM_DATE))
82 self["testversion"]=Label(("Loading version..."))
83 self["mactext"]=Label(("Loading mac address..."))
84 nimConfig = nimmanager.getNimConfig(0)
85 nimConfig.configMode.slot_id=0
86 nimConfig.configMode.value= "simple"
87 nimConfig.diseqcMode.value="diseqc_a_b"
88 nimConfig.diseqcA.value="160"
89 nimConfig.diseqcB.value="100"
91 nimConfig = nimmanager.getNimConfig(1)
92 nimConfig.configMode.slot_id=1
93 nimConfig.configMode.value= "simple"
94 nimConfig.diseqcMode.value="diseqc_a_b"
95 nimConfig.diseqcA.value="130"
96 nimConfig.diseqcB.value="192"
99 nimmanager.sec.update()
101 system("cp /usr/lib/enigma2/python/Plugins/SystemPlugins/FactoryTest/testdb /etc/enigma2/lamedb")
102 db = eDVBDB.getInstance()
103 db.reloadServicelist()
108 tlist.append((" 0. Sata & extend hdd test",self.satetestIndex))
110 tlist.append((" 1. USB test",self.usbtestIndex))
111 self.fronttestIndex=2
112 tlist.append((" 2. Front test",self.fronttestIndex))
113 self.smarttestIndex=3
114 tlist.append((" 3. Smartcard test",self.smarttestIndex))
115 self.tuner1_1testIndex=4
116 tlist.append((" 4. T1 H 22K x 4:3 CVBS",self.tuner1_1testIndex))
117 self.tuner1_2testIndex=5
118 tlist.append((" 5. T1 V 22k o 16:9 RGB",self.tuner1_2testIndex))
119 self.tuner2_1testIndex=6
120 tlist.append((" 6. T2 H 22k x 4:3 YC",self.tuner2_1testIndex))
121 self.tuner2_2testIndex=7
122 tlist.append((" 7. T2 V 22k o 16:9 CVBS CAM",self.tuner2_2testIndex))
123 self.scarttestIndex=8
124 tlist.append((" 8. VCR Scart loop",self.scarttestIndex))
125 self.rs232testIndex=9
126 tlist.append((" 9. RS232 test",self.rs232testIndex))
127 self.ethernettestIndex=10
128 tlist.append(("10. Ethernet & mac test",self.ethernettestIndex))
129 # tlist.append(("11. DRAM test",11))
130 # tlist.append(("12. Flash test",12))
131 # tlist.append(("13. DRAM+Flash test",13))
132 self.fdefaultIndex=11
133 tlist.append(("11. Factory default",self.fdefaultIndex))
134 self.shutdownIndex=12
135 tlist.append(("12. Shutdown",self.shutdownIndex))
136 elif self.model == 1:
137 # tlist.append((" 0. Sata & extend hdd test",self.satetestIndex=0))
138 self.satetestIndex = -1
139 self.scarttestIndex = -1
144 tlist.append((" 0. USB test",self.usbtestIndex))
145 self.fronttestIndex=1
146 tlist.append((" 1. Front test",self.fronttestIndex))
147 self.smarttestIndex=2
148 tlist.append((" 2. Smartcard test",self.smarttestIndex))
149 self.tuner1_1testIndex=3
150 tlist.append((" 3. T1 H 22K x 4:3 CVBS",self.tuner1_1testIndex))
151 self.tuner1_2testIndex=4
152 tlist.append((" 4. T1 V 22k o 16:9 RGB CAM",self.tuner1_2testIndex))
153 self.tuner2_2testIndex=4
154 # tlist.append((" 6. T2 H 22k x 4:3 YC",self.tuner2_1testIndex=6))
155 # tlist.append((" 7. T2 V 22k o 16:9 CVBS CAM",self.tuner2_2testIndex=7))
156 # tlist.append((" 8. VCR Scart loop",self.scarttestIndex=8))
157 self.rs232testIndex=5
158 tlist.append((" 5. RS232 test",self.rs232testIndex))
159 self.ethernettestIndex=6
160 tlist.append((" 6. Ethernet & mac test",self.ethernettestIndex))
161 # tlist.append(("11. DRAM test",11))
162 # tlist.append(("12. Flash test",12))
163 # tlist.append(("13. DRAM+Flash test",13))
165 tlist.append((" 7. Factory default",self.fdefaultIndex))
167 tlist.append((" 8. Shutdown",self.shutdownIndex))
169 elif self.model == 2:
170 self.scarttestIndex = -1
172 tlist.append((" 0. Sata & extend hdd test",self.satetestIndex))
174 tlist.append((" 1. USB test",self.usbtestIndex))
175 self.fronttestIndex=2
176 tlist.append((" 2. Front test",self.fronttestIndex))
177 self.smarttestIndex=3
178 tlist.append((" 3. Smartcard test",self.smarttestIndex))
179 self.tuner1_1testIndex=4
180 tlist.append((" 4. T1 H 22K x 4:3 CVBS",self.tuner1_1testIndex))
181 self.tuner1_2testIndex=5
182 tlist.append((" 5. T1 V 22k o 16:9 RGB",self.tuner1_2testIndex))
183 self.tuner2_1testIndex = -1
184 self.tuner2_2testIndex=6
185 tlist.append((" 6. T2 DVB-C 4:3 YC CAM",self.tuner2_2testIndex))
186 self.rs232testIndex=7
187 tlist.append((" 7. RS232 test",self.rs232testIndex))
188 self.ethernettestIndex=8
189 tlist.append(("8. Ethernet & mac test",self.ethernettestIndex))
191 tlist.append(("9. Factory default",self.fdefaultIndex))
192 self.shutdownIndex=10
193 tlist.append(("10. Shutdown",self.shutdownIndex))
195 self.menulength= len(tlist)-1
196 self["testlist"] = MenuList(tlist)
198 for x in range(self.menulength):
199 self.rlist.append((".."))
200 self["resultlist"] = TestResultList(self.rlist)
201 self.NetworkState = 0
204 self.avswitch = AVSwitch()
205 self.memTest = eMemtest()
206 self.scTest= eSctest()
212 self.servicelist = ServiceList()
213 self.oldref = session.nav.getCurrentlyPlayingServiceReference()
214 print "oldref",self.oldref
215 session.nav.stopService() # try to disable foreground service
217 self.tunemsgtimer = eTimer()
218 self.tunemsgtimer.callback.append(self.tunemsg)
222 elif self.model == 1:
224 elif self.model == 2:
227 self.camtimer = eTimer()
228 self.camtimer.callback.append(self.cam_state)
234 self.tuningtimer = eTimer()
235 self.tuningtimer.callback.append(self.updateStatus)
238 self.satatimer = eTimer()
239 self.satatimer.callback.append(self.sataCheck)
241 def getModelInfo(self):
242 if fileExists("/proc/stb/info/vumodel"):
243 info = open("/proc/stb/info/vumodel").read()
244 if info[:5] == "combo":
246 print "getModelInfo : combo"
248 info = open("/proc/stb/info/version").read()
249 # print info,info[:2]
252 print "getModelInfo : solo"
253 elif info[:2] == "12":
255 print "getModelInfo : duo"
263 if self["testlist"].getCurrent()[1]==0:
264 self["testlist"].moveToIndex(self.menulength)
266 self["testlist"].up()
272 if self["testlist"].getCurrent()[1]==(self.menulength):
273 self["testlist"].moveToIndex(0)
275 self["testlist"].down()
277 def numberaction(self, number):
281 self["testlist"].moveToIndex(index)
284 def updateStatus(self):
285 index = self["testlist"].getCurrent()[1]
286 if index ==self.tuner1_1testIndex or index==self.tuner1_2testIndex:
288 result = eSctest.getInstance().getFrontendstatus(0)
291 result = eSctest.getInstance().getFrontendstatus(1)
293 if self.agingmode == 1:
295 result = eSctest.getInstance().getFrontendstatus(0)
297 if self.model == 2 and index==self.tuner2_2testIndex:
299 elif index == self.tuner1_2testIndex or index==self.tuner2_2testIndex:
304 print "eSctest.getInstance().getFrontendstatus - %d"%result
307 self.tunemsgtimer.stop()
308 self.session.nav.stopService()
309 self.avswitch.setColorFormat(0)
310 self.session.open( MessageBox, _("Tune%d %s Locking Fail..."%(tunno,hv)), MessageBox.TYPE_ERROR)
311 if self.agingmode==0:
312 self.rlist[self["testlist"].getCurrent()[1]]="fail"
316 if self.agingmode==1:
317 self.session.openWithCallback(self.checkaging,AgingTest)
319 def getversion(self):
321 fd = open("/proc/stb/info/version","r")
323 self["testversion"].setText(("Version %s"%version))
325 self["testversion"].setText(("Version no load"))
328 def getmacaddr(self):
331 cmd = "nanddump -s 0x" + str((self.mactry-1)*2) + "0000 -b -o -l 64 -p /dev/mtd5"
332 elif self.model == 0 or self.model == 1:
333 cmd = "nanddump -s 0x" + str((self.mactry-1)*2) + "0000 -b -o -l 64 -p /dev/mtd4"
334 self.macConsole = Console()
335 self.macConsole.ePopen(cmd, self.readmac,self.checkReadmac)
339 def readmac(self, result, retval,extra_args=None):
340 (callback) = extra_args
341 if self.macConsole is not None:
343 self.macConsole = None
345 content =result.splitlines()
347 if x.startswith('0x000'+str((self.mactry-1)*2)+'0010:'):
351 elif len(macline) < 10:
354 mac = macline[5]+":"+macline[6]+":"+macline[7]+":"+macline[8]+":"+macline[9]+":"+macline[10]
355 self["mactext"].setText(("MAC : "+mac))
358 def checkReadmac(self,data):
360 print "block %d is bad block" % self.mactry
361 self.mactry = self.mactry + 1
363 self.session.open(MessageBox, _("FLASH IS BROKEN"), type = MessageBox.TYPE_INFO, enable_input = False)
368 print 'mac dump read error'
371 print 'mac address read ok'
374 def TestAction(self):
376 # tlist.append((" 0. Sata & extend hdd test",self.satetestIndex=0))
377 # tlist.append((" 1. USB test",self.usbtestIndex=1))
378 # tlist.append((" 2. Front test",self.fronttestIndex=2))
379 # tlist.append((" 3. Smartcard test",self.smarttestIndex=3))
380 # tlist.append((" 4. T1 H 22K x 4:3 CVBS",self.tuner1_1testIndex=4))
381 # tlist.append((" 5. T1 V 22k o 16:9 RGB",self.tuner1_2testIndex=5))
382 # tlist.append((" 6. T2 H 22k x 4:3 YC",self.tuner2_1testIndex=6))
383 # tlist.append((" 7. T2 V 22k o 16:9 CVBS CAM",self.tuner2_2testIndex=7))
384 # tlist.append((" 8. VCR Scart loop",self.scarttestIndex=8))
385 # tlist.append((" 9. RS232 test",self.rs232testIndex=9))
386 # tlist.append(("10. Ethernet & mac test",self.ethernettestIndex=10))
387 # tlist.append(("11. DRAM test",11))
388 # tlist.append(("12. Flash test",12))
389 # tlist.append(("13. DRAM+Flash test",13))
390 # tlist.append(("11. Factory default",self.fdefaultIndex=11))
391 # tlist.append(("12. Shutdown",self.shutdownIndex=12))
395 print "line - ",self["testlist"].getCurrent()[1]
396 index = self["testlist"].getCurrent()[1]
398 if index==self.satetestIndex:
400 elif index==self.fronttestIndex:
402 elif index>=self.tuner1_1testIndex and index<=self.tuner2_2testIndex:
404 elif index==self.scarttestIndex:
406 elif index==self.rs232testIndex:
408 elif index==self.usbtestIndex:
410 elif index==self.ethernettestIndex:
412 elif index == self.smarttestIndex:
420 elif index==self.fdefaultIndex:
422 elif index==self.shutdownIndex:
427 def shutdownaction(self):
428 if self["testlist"].getCurrent()[1] == self.shutdownIndex:
434 self.satatimer.start(100,True)
437 # print "try", self.satatry
438 if self.satatry == 0:
441 self.rlist[self["testlist"].getCurrent()[1]]="try %d"%self.satatry
442 self["resultlist"].updateList(self.rlist)
448 mtab = open('/etc/mtab','r')
450 disk = mtab.readline().split(' ')
453 if disk[1].startswith('/media/hdd'):
455 elif disk[1].startswith('/media/sdb1'):
464 self.session.open( MessageBox, _("Sata & extend hdd test error"), MessageBox.TYPE_ERROR)
465 self.rlist[self["testlist"].getCurrent()[1]]="fail"
467 self.satatimer.start(1100,True)
471 self.session.open( MessageBox, _("one hdd test error"), MessageBox.TYPE_ERROR)
472 self.rlist[self["testlist"].getCurrent()[1]]="fail"
474 self.satatimer.start(1100,True)
478 if fileExists("/media/sdb1"):
479 if access("/media/sdb1",F_OK|R_OK|W_OK):
480 dummy=open("/media/sdb1/dummy03","w")
481 dummy.write("complete")
483 dummy=open("/media/sdb1/dummy03","r")
484 if dummy.readline()=="complete":
489 system("rm /media/sdb1/dummy03")
497 if fileExists("/media/hdd"):
498 if access("/media/hdd",F_OK|R_OK|W_OK):
499 dummy=open("/media/hdd/dummy03","w")
500 dummy.write("complete")
502 dummy=open("/media/hdd/dummy03","r")
503 if dummy.readline()=="complete":
508 system("rm /media/hdd/dummy03")
517 self.session.open( MessageBox, _("Sata & extend hdd test pass"), MessageBox.TYPE_INFO)
518 self.rlist[self["testlist"].getCurrent()[1]]="pass"
521 self.session.open( MessageBox, _("one hdd test error"), MessageBox.TYPE_ERROR)
522 self.rlist[self["testlist"].getCurrent()[1]]="fail"
524 self.satatimer.start(1100,True)
527 self.session.open( MessageBox, _("Sata & extend hdd test error"), MessageBox.TYPE_ERROR)
528 self.rlist[self["testlist"].getCurrent()[1]]="fail"
530 self.satatimer.start(1100,True)
534 self.session.openWithCallback(self.displayresult ,FrontTest)
535 elif self.model == 1:
536 self.session.openWithCallback(self.displayresult ,FrontTest_solo)
537 elif self.model == 2:
538 self.session.openWithCallback(self.displayresult ,FrontTest_solo)
540 def displayresult(self):
543 self.rlist[self["testlist"].getCurrent()[1]]="pass"
545 self.rlist[self["testlist"].getCurrent()[1]]="fail"
547 INTERNAL_PID_STATUS_NOOP = 0
548 INTERNAL_PID_STATUS_WAITING = 1
549 INTERNAL_PID_STATUS_SUCCESSFUL = 2
550 INTERNAL_PID_STATUS_FAILED = 3
552 def TestTune(self,index):
553 if self.oldref is None:
554 eref = eServiceReference("1:0:19:1324:3EF:1:C00000:0:0:0")
555 serviceHandler = eServiceCenter.getInstance()
556 servicelist = serviceHandler.list(eref)
557 if not servicelist is None:
558 ref = servicelist.getNext()
560 ref = self.getCurrentSelection()
561 print "servicelist none"
564 self.session.nav.stopService() # try to disable foreground service
565 if index==self.tuner1_1testIndex:
570 ref.setData(4,0xA00000)
571 self.session.nav.playService(ref)
572 self.avswitch.setColorFormat(0)
573 self.avswitch.setAspectRatio(0)
574 elif index==self.tuner1_2testIndex:
577 self.camtimer.start(100,True)
579 ref.setData(1,0x1325)
582 ref.setData(4,0x64af79)
583 # ref.setData(0,0x19)
584 # ref.setData(1,0x83)
586 # ref.setData(3,0x85)
587 # ref.setData(4,0x640000)
588 self.session.nav.playService(ref)
589 self.avswitch.setColorFormat(1)
590 self.avswitch.setAspectRatio(6)
591 elif index==self.tuner2_1testIndex:
593 # self.camtimer.start(100,True)
598 ref.setData(4,0x820000)
599 self.session.nav.playService(ref)
600 self.avswitch.setColorFormat(2)
601 self.avswitch.setAspectRatio(0)
602 elif index==self.tuner2_2testIndex:
604 self.camtimer.start(100,True)
605 # ref.setData(0,0x19)
606 # ref.setData(1,0x83)
608 # ref.setData(3,0x85)
609 # ref.setData(4,0xC00000)
610 # ikseong - for 22000 tp ( /home/ikseong/share/lamedb_ORF)
613 ref.setData(1,0x1325)
616 ref.setData(4,0xC00000)
617 self.session.nav.playService(ref)
618 self.avswitch.setColorFormat(0)
619 self.avswitch.setAspectRatio(6)
622 ref.setData(1,0x1325)
625 ref.setData(4,0xfff029a)
626 self.session.nav.playService(ref)
627 self.avswitch.setColorFormat(2)
628 self.avswitch.setAspectRatio(0)
629 self.tuningtimer.start(4000,True)
630 self.tunemsgtimer.start(5000, True)
633 if self.camstep == 1:
635 state = eDVBCI_UI.getInstance().getState(slot)
636 print '-1-stat',state
639 self.camtimer.start(100,True)
641 self.session.nav.stopService()
642 self.session.open( MessageBox, _("CAM1_NOT_INSERTED\nPress exit!"), MessageBox.TYPE_ERROR)
643 self.rlist[self["testlist"].getCurrent()[1]]="fail"
644 self.tunemsgtimer.stop()
645 # self.rlist[index]="fail"
646 # self["resultlist"].updateList(self.rlist)
647 elif self.camstep == 2:
649 appname = eDVBCI_UI.getInstance().getAppName(slot)
650 print 'appname',appname
652 self.session.nav.stopService()
653 self.session.open( MessageBox, _("NO_GET_APPNAME\nPress exit!"), MessageBox.TYPE_ERROR)
654 self.rlist[self["testlist"].getCurrent()[1]]="fail"
655 self.tunemsgtimer.stop()
658 self.camtimer.start(100,True)
659 elif self.camstep==3:
661 state = eDVBCI_UI.getInstance().getState(slot)
662 print '-2-stat',state
665 self.camtimer.start(100,True)
667 self.session.nav.stopService()
668 self.session.open( MessageBox, _("CAM2_NOT_INSERTED\nPress exit!"), MessageBox.TYPE_ERROR)
669 self.rlist[self["testlist"].getCurrent()[1]]="fail"
670 self.tunemsgtimer.stop()
671 # self.rlist[index]="fail"
672 # self["resultlist"].updateList(self.rlist)
673 elif self.camstep == 4:
675 appname = eDVBCI_UI.getInstance().getAppName(slot)
676 print 'appname',appname
678 self.session.nav.stopService()
679 self.session.open( MessageBox, _("NO_GET_APPNAME\nPress exit!"), MessageBox.TYPE_ERROR)
680 self.rlist[self["testlist"].getCurrent()[1]]="fail"
681 self.tunemsgtimer.stop()
685 # self.session.open( MessageBox, _("CAM OK!"), MessageBox.TYPE_INFO,2)
687 # ikseong - for 22000 tp
689 filename = ("/proc/stb/tsmux/ci0_input")
690 fd = open(filename,'w')
694 # filename = ("/proc/stb/tsmux/ci1_input")
695 # fd = open(filename,'w')
698 fd=open("/proc/stb/tsmux/input1","w")
699 # fd=open("/proc/stb/tsmux/input0","w")
702 print "CI loop test!!!!!!!!!!!!!!"
704 def resetSource(self):
705 fd=open("/proc/stb/tsmux/input1","w")
708 print "CI loop test end!!!!!!!!!!!!!!"
711 self.tuningtimer.stop()
712 self.session.openWithCallback(self.tuneback, MessageBox, _("%s ok?" %(self["testlist"].getCurrent()[0])), MessageBox.TYPE_YESNO)
714 def tuneback(self,yesno):
715 self.session.nav.stopService() # try to disable foreground service
717 self.rlist[self["testlist"].getCurrent()[1]]="pass"
718 if self.tunerlock == 0:
719 self.rlist[self["testlist"].getCurrent()[1]]="fail"
720 elif self["testlist"].getCurrent()[1] == self.cam_index and self.camstep < 5:
721 self.rlist[self["testlist"].getCurrent()[1]]="fail"
723 self.rlist[self["testlist"].getCurrent()[1]]="fail"
724 if self["testlist"].getCurrent()[1] == 6: # YC
725 self.avswitch.setColorFormat(0)
727 self["resultlist"].updateList(self.rlist)
730 self.avswitch.setInput("SCART")
732 self.session.openWithCallback(self.check6, MessageBox, _("Scart loop ok?"), MessageBox.TYPE_YESNO)
734 def check6(self,yesno):
736 self.rlist[self["testlist"].getCurrent()[1]]="pass"
738 self.rlist[self["testlist"].getCurrent()[1]]="fail"
739 self.avswitch.setInput("ENCODER")
744 self.rlist[self["testlist"].getCurrent()[1]]="pass"
746 self.rlist[self["testlist"].getCurrent()[1]]="fail"
749 self.session.openWithCallback(self.check7,RS232Test)
754 if self.oldref is None:
755 eref = eServiceReference("1:0:19:1324:3EF:1:C00000:0:0:0")
756 serviceHandler = eServiceCenter.getInstance()
757 servicelist = serviceHandler.list(eref)
758 if not servicelist is None:
759 ref = servicelist.getNext()
761 ref = self.getCurrentSelection()
762 print "servicelist none"
765 self.session.nav.stopService() # try to disable foreground service
767 ref.setData(1,0x1325)
770 ref.setData(4,0x64af79)
772 # ref.setData(1,0x6D3)
774 # ref.setData(3,0xA4)
775 # ref.setData(4,0xA00000)
776 self.session.nav.playService(ref)
777 self.avswitch.setColorFormat(0)
778 self.avswitch.setAspectRatio(0)
779 self.tuningtimer.start(2000,True)
782 def checkaging(self):
785 self["testlist"].moveToIndex(self.fdefaultIndex)
787 self["testlist"].moveToIndex(self.shutdownIndex)
789 # self["testlist"].instance.moveSelection(self["testlist"].instance.moveDown)
797 mtab = open('/etc/mtab','r')
799 disk = mtab.readline().split(' ')
802 if disk[1].startswith('/media/hdd'):
804 elif disk[1].startswith('/media/sdb1'):
806 elif disk[1].startswith('/media/sd'):
812 self.session.open( MessageBox, _("USB test pass %d devices\nPress OK!"%result), MessageBox.TYPE_INFO)
813 self.rlist[self["testlist"].getCurrent()[1]]="pass"
815 self.session.open( MessageBox, _("USB test error : Success-%d"%result+" Fail-%d\nPress EXIT!"%(3-result)), MessageBox.TYPE_ERROR)
816 self.rlist[self["testlist"].getCurrent()[1]]="fail"
821 self.session.open( MessageBox, _("USB test pass %d devices\nPress OK!"%result), MessageBox.TYPE_INFO)
822 self.rlist[self["testlist"].getCurrent()[1]]="pass"
824 self.session.open( MessageBox, _("USB test error : Success-%d"%result+" Fail-%d\nPress EXIT!"%(3-result)), MessageBox.TYPE_ERROR)
825 self.rlist[self["testlist"].getCurrent()[1]]="fail"
829 mtab = open('/etc/mtab','r')
831 disk = mtab.readline().split(' ')
834 if disk[1].startswith('/media/'):
840 self.session.open( MessageBox, _("USB test pass %d devices\nPress OK!"%result), MessageBox.TYPE_INFO)
841 self.rlist[self["testlist"].getCurrent()[1]]="pass"
843 self.session.open( MessageBox, _("USB test error : Success-%d"%result+" Fail-%d\nPress EXIT!"%(2-result)), MessageBox.TYPE_ERROR)
844 self.rlist[self["testlist"].getCurrent()[1]]="fail"
849 self.session.open( MessageBox, _("USB test pass %d devices\nPress OK!"%result), MessageBox.TYPE_INFO)
850 self.rlist[self["testlist"].getCurrent()[1]]="pass"
852 self.session.open( MessageBox, _("USB test error : Success-%d"%result+" Fail-%d\nPress EXIT!"%(2-result)), MessageBox.TYPE_ERROR)
853 self.rlist[self["testlist"].getCurrent()[1]]="fail"
858 mtab = open('/etc/mtab','r')
860 disk = mtab.readline().split(' ')
863 if disk[1].startswith('/media/hdd'):
865 elif disk[1].startswith('/media/sdb1'):
867 elif disk[1].startswith('/media/sd'):
873 self.session.open( MessageBox, _("USB test pass %d devices\nPress OK!"%result), MessageBox.TYPE_INFO)
874 self.rlist[self["testlist"].getCurrent()[1]]="pass"
876 self.session.open( MessageBox, _("USB test error : Success-%d"%result+" Fail-%d\nPress EXIT!"%(2-result)), MessageBox.TYPE_ERROR)
877 self.rlist[self["testlist"].getCurrent()[1]]="fail"
882 self.session.open( MessageBox, _("USB test pass %d devices\nPress OK!"%result), MessageBox.TYPE_INFO)
883 self.rlist[self["testlist"].getCurrent()[1]]="pass"
885 self.session.open( MessageBox, _("USB test error : Success-%d"%result+" Fail-%d\nPress EXIT!"%(2-result)), MessageBox.TYPE_ERROR)
886 self.rlist[self["testlist"].getCurrent()[1]]="fail"
891 # system("/etc/init.d/networking stop")
892 system("ifconfig eth0 192.168.0.10")
893 # system("/etc/init.d/networking start")
894 cmd1 = "ping -c 1 192.168.0.100"
895 self.PingConsole = Console()
896 self.PingConsole.ePopen(cmd1, self.checkNetworkStateFinished,self.NetworkStatedataAvail)
898 def checkNetworkStateFinished(self, result, retval,extra_args):
899 (statecallback) = extra_args
900 if self.PingConsole is not None:
902 self.PingConsole = None
903 content = result.splitlines()
904 # print 'content',content
905 x = content[4].split()
915 def NetworkStatedataAvail(self,data):
920 # self.session.open( MessageBox, _("Ping test pass"), MessageBox.TYPE_INFO,2)
921 self.session.openWithCallback(self.openMacConfig ,MessageBox, _("Ping test pass"), MessageBox.TYPE_INFO,2)
926 self.session.open( MessageBox, _("Ping test fail\nPress exit"), MessageBox.TYPE_ERROR)
932 def openMacConfig(self, ret=False):
933 self.session.openWithCallback(self.macresult ,MacConfig,mactry=self.mactry)
938 self.rlist[self.ethernettestIndex]="pass"
939 # self.rlist[self["testlist"].getCurrent()[1]]="pass"
941 self.rlist[self.ethernettestIndex]="fail"
942 # self.rlist[self["testlist"].getCurrent()[1]]="fail"
946 def MemTest(self, which):
950 result = eMemtest.getInstance().dramtest()
952 result = eMemtest.getInstance().flashtest()
955 result = eMemtest.getInstance().dramtest()
956 result = eMemtest.getInstance().flashtest()
962 print index,self.rlist[index]
963 self.rlist[index]="pass"
965 print index,self.rlist[index]
966 self.rlist[index]="fail"
967 self["resultlist"].updateList(self.rlist)
969 def scciresult(self):
971 if smartcardtest == 1:
972 self.rlist[self["testlist"].getCurrent()[1]]="pass"
974 self.rlist[self["testlist"].getCurrent()[1]]="fail"
977 self.session.openWithCallback(self.scciresult ,SmartCardTest)
991 system("rm -R /etc/enigma2")
992 system("cp -R /usr/share/enigma2/defaults /etc/enigma2")
993 self.rlist[self["testlist"].getCurrent()[1]]="pass"
994 self["resultlist"].updateList(self.rlist)
996 self.rlist[self["testlist"].getCurrent()[1]]="fail"
997 self["resultlist"].updateList(self.rlist)
998 self.session.open( MessageBox, _("Factory reset fail"), MessageBox.TYPE_ERROR)
1001 self.session.openWithCallback(self.shutdown ,MessageBox, _("Do you want to shut down?"), MessageBox.TYPE_YESNO)
1003 def shutdown(self, yesno):
1005 from os import _exit
1006 system("/usr/bin/showiframe /boot/backdrop.mvi")
1011 def keyCancel(self):
1016 # if self.oldref is not None:
1017 # self.session.nav.playService(self.oldref)
1020 class MacConfig(Screen):
1022 <screen position="100,250" size="520,100" title="Mac Config" >
1023 <eLabel text="Mac Address " position="10,15" size="200,40" font="Regular;30" />
1024 <widget name="text" position="230,15" size="230,40" font="Regular;30" />
1025 <widget name="text1" position="470,15" size="40,40" font="Regular;30" />
1026 <eLabel text=" " position="5,55" zPosition="-1" size="510,5" backgroundColor="#02e1e8e6" />
1027 <widget name="stattext" position="30,75" size="400,25" font="Regular;20" />
1030 def __init__(self, session, mactry = 1):
1031 self["actions"] = ActionMap(["DirectionActions","OkCancelActions"],
1034 "left": self.keyleft,
1035 "right": self.keyright,
1036 "cancel": self.keyCancel,
1039 Screen.__init__(self, session)
1041 self.mactry = mactry
1046 self.macaddr = "000000000000"
1047 self.NetworkState = 0
1048 self["text"]=Label((self.macaddr))
1049 self["text1"]= Label(("< >"))
1050 self["stattext"]= Label((""))
1057 def getModelInfo(self):
1058 if fileExists("/proc/stb/info/vumodel"):
1059 info = open("/proc/stb/info/vumodel").read()
1060 if info[:5] == "combo":
1062 print "MacConfig, model : combo"
1064 info = open("/proc/stb/info/version").read()
1065 if info[:2] == "14":
1067 print "MacConfig, model : solo"
1068 elif info[:2] == "12":
1070 print "MacConfig, model: duo"
1072 def loadmacaddr(self):
1076 mtab = open('/etc/mtab','r')
1078 disk = mtab.readline().split(' ')
1081 if disk[1].startswith('/media/sd') or disk[1].startswith('/media/hdd'):
1082 print 'try..',disk[1]
1083 if fileExists(disk[1]+"/macinfo.txt"):
1084 self.macfd = open(disk[1]+"/macinfo.txt","r+")
1087 self["text"].setText(("cannot read usb!!"))
1088 self["text1"].setText((" "))
1089 self["stattext"].setText((" Press Exit Key."))
1093 macaddr=self.macfd.readline().split(":")
1094 self.macaddr=macaddr[1]+macaddr[2]+macaddr[3]+macaddr[4]+macaddr[5]+macaddr[6]
1096 self.NetworkState = 1
1098 self["text"].setText(("cannot read usb!!"))
1099 self["text1"].setText((" "))
1100 self["stattext"].setText((" Press Exit Key."))
1102 # self.session.open( MessageBox, _("Mac address fail"), MessageBox.TYPE_ERROR)
1104 def getmacaddr(self):
1105 if self.NetworkState==0:
1109 cmd = "nanddump -s 0x" + str((self.mactry-1)*2) + "0000 -b -o -l 64 -p /dev/mtd5"
1110 elif self.model == 0 or self.model == 1:
1111 cmd = "nanddump -s 0x" + str((self.mactry-1)*2) + "0000 -b -o -l 64 -p /dev/mtd4"
1112 self.macConsole = Console()
1113 self.macConsole.ePopen(cmd, self.readmac,self.checkReadmac)
1117 def readmac(self, result, retval,extra_args=None):
1118 (callback) = extra_args
1119 if self.macConsole is not None:
1121 self.macConsole = None
1123 content =result.splitlines()
1125 if x.startswith('0x000'+str((self.mactry-1)*2)+'0010:'):
1129 elif len(macline) < 10:
1132 mac = macline[5]+":"+macline[6]+":"+macline[7]+":"+macline[8]+":"+macline[9]+":"+macline[10]
1133 self["stattext"].setText(("now : "+mac))
1136 def checkReadmac(self,data):
1138 print "block %d is bad block" % self.mactry
1139 self.mactry = self.mactry + 1
1141 self.session.open(MessageBox, _("FLASH IS BROKEN"), type = MessageBox.TYPE_INFO, enable_input = False)
1146 print 'mac dump read error'
1149 print 'mac address read ok'
1154 if self.NetworkState==0 :
1156 macaddress = long(self.macaddr,16)-1
1158 macaddress = 0xffffffffffff
1159 self.macaddr = "%012x"%macaddress
1163 if self.NetworkState==0 :
1165 macaddress = long(self.macaddr,16)+1
1166 if macaddress > 0xffffffffffff:
1168 self.macaddr = "%012x"%macaddress
1171 def displaymac(self):
1172 macaddr= self.macaddr
1173 self["text"].setText(("%02x:%02x:%02x:%02x:%02x:%02x"%(int(macaddr[0:2],16),int(macaddr[2:4],16),int(macaddr[4:6],16),int(macaddr[6:8],16),int(macaddr[8:10],16),int(macaddr[10:12],16))))
1176 if self.NetworkState==0 :
1179 macaddr = self.macaddr
1180 #make_mac_sector 00-99-99-99-00-00 > /tmp/mac.sector
1181 #flash_eraseall /dev/mtd4
1182 #nandwrite /dev/mtd4 /tmp/mac.sector -p
1183 cmd = "make_mac_sector %02x-%02x-%02x-%02x-%02x-%02x > /tmp/mac.sector"%(int(macaddr[0:2],16),int(macaddr[2:4],16),int(macaddr[4:6],16),int(macaddr[6:8],16),int(macaddr[8:10],16),int(macaddr[10:12],16))
1186 system("flash_eraseall /dev/mtd5")
1187 system("nandwrite /dev/mtd5 /tmp/mac.sector -p")
1188 elif self.model == 0 or self.model ==1 :
1189 system("flash_eraseall /dev/mtd4")
1190 system("nandwrite /dev/mtd4 /tmp/mac.sector -p")
1191 macaddress = long(macaddr,16)+1
1192 if macaddress > 0xffffffffffff:
1194 macaddr = "%012x"%macaddress
1195 macwritetext = "MAC:%02x:%02x:%02x:%02x:%02x:%02x"%(int(macaddr[0:2],16),int(macaddr[2:4],16),int(macaddr[4:6],16),int(macaddr[6:8],16),int(macaddr[8:10],16),int(macaddr[10:12],16))
1197 self.macfd.write(macwritetext)
1200 self.macaddr = macaddr
1203 self.session.open( MessageBox, _("Mac address fail"), MessageBox.TYPE_ERROR)
1208 def keyCancel(self):
1218 class ScCiTest(Screen):
1220 <screen position="120,225" size="440,200" title="CI Smartcard Test" >
1221 <widget name="testlist" position="10,0" size="340,120" />
1222 <widget name="resultlist" position="370,0" size="60,120" />
1223 <eLabel text=" " position="5,125" zPosition="-1" size="430,5" backgroundColor="#02e1e8e6" />
1224 <widget name="text" position="10,140" size="420,50" font="Regular;25" />
1227 def __init__(self, session):
1228 self["actions"] = ActionMap(["DirectionActions","OkCancelActions"],
1233 "cancel": self.keyCancel,
1236 Screen.__init__(self, session)
1238 tlist.append(("Smartcard 1 Test",0))
1239 tlist.append(("Smartcard 2 Test",1))
1240 tlist.append(("CI 1 Test",2))
1241 tlist.append(("CI 2 Test",3))
1242 self["testlist"] = MenuList(tlist)
1245 self.rlist.append((".."))
1246 self["resultlist"] = TestResultList(self.rlist)
1248 self.removecard = eTimer()
1249 self.removecard.callback.append(self.remove_card)
1250 self["text"]=Label(("Press OK Key"))
1251 self.camstate= eTimer()
1252 self.camstate.callback.append(self.cam_state)
1256 def keyCancel(self):
1258 print "result ", self.result
1265 self["text"].setText(_("Press OK Key"))
1266 self["testlist"].instance.moveSelection(self["testlist"].instance.moveUp)
1269 self["text"].setText(_("Press OK Key"))
1270 self["testlist"].instance.moveSelection(self["testlist"].instance.moveDown)
1273 print "line - ",self["testlist"].getCurrent()[1]
1274 index = self["testlist"].getCurrent()[1]
1276 if index==0 or index==1:
1277 self["text"].setText(_("Insert Card?"))
1279 elif index ==2 or index==3:
1280 self["text"].setText(_("Insert Cam"))
1286 self.camstate.start(1000,True)
1288 def setSource(self, cislot):
1289 filename = ("/proc/stb/tsmux/ci%d_input"%cislot)
1290 fd = open(filename,'w')
1294 def setInputSource(self, cislot):
1295 fd=open("/proc/stb/tsmux/input0","w")
1302 def resetSource(self):
1303 fd=open("/proc/stb/tsmux/input0","w")
1306 # fd = open("/proc/stb/tsmux/ci0_input","w")
1309 # fd = open("/proc/stb/tsmux/ci1_input","w")
1313 def channelstart(self):
1314 ref = eServiceReference("1:0:19:1324:3EF:1:C00000:0:0:0")
1319 ref.setData(4,0x640000)
1320 self.session.nav.playService(ref)
1322 def channelstop(self):
1323 self.session.nav.stopService() # try to disable foreground service
1325 def cam_state(self):
1326 index = self["testlist"].getCurrent()[1]
1331 print 'cam_state', self.camstep,self.camtry
1332 if self.camstep == 1:
1333 state = eDVBCI_UI.getInstance().getState(slot)
1338 self["text"].setText(_("Getting Cam name...."))
1339 self.camstate.start(5000,True)
1343 self.camstate.start(1000,True)
1345 self.session.open( MessageBox, _("NO_NOT_INSERTED"), MessageBox.TYPE_ERROR)
1346 self.rlist[index]="fail"
1347 self["resultlist"].updateList(self.rlist)
1349 elif self.camstep == 2:
1350 appname = eDVBCI_UI.getInstance().getAppName(slot)
1351 print 'appname',appname
1355 self.camstate.start(1000,True)
1357 self.session.open( MessageBox, _("NO_GET_APPNAME"), MessageBox.TYPE_ERROR)
1358 self.rlist[index]="fail"
1359 self["resultlist"].updateList(self.rlist)
1361 self["text"].setText(_("Get Cam name : %s"%appname+". \n Remove Cam!"))
1363 self.setInputSource(slot)
1364 self.setSource(slot)
1367 self.camstate.start(1000,True)
1368 elif self.camstep==3:
1369 state = eDVBCI_UI.getInstance().getState(slot)
1373 self.result += (1<<index)
1375 self.rlist[index]="pass"
1376 self["text"].setText(_("Press OK Key"))
1377 self["resultlist"].updateList(self.rlist)
1385 self.camstate.start(1000,True)
1388 self.session.open( MessageBox, _("NO_REMOVE_CAM"), MessageBox.TYPE_ERROR)
1389 self.rlist[index]="fail"
1390 self["resultlist"].updateList(self.rlist)
1392 def check_smart_card(self,which):
1396 result = eSctest.getInstance().check_smart_card("/dev/sci0")
1398 result = eSctest.getInstance().check_smart_card("/dev/sci1")
1408 self.session.open( MessageBox, _("1:NO_DEV_FOUND"), MessageBox.TYPE_ERROR)
1410 self.session.open( MessageBox, _("1:SC_NOT_INSERTED"), MessageBox.TYPE_ERROR)
1412 self.session.open( MessageBox, _("1:SC_NOT_VALID_ATR"), MessageBox.TYPE_ERROR)
1414 self.session.open( MessageBox, _("1:SC_READ_TIMEOUT"), MessageBox.TYPE_ERROR)
1415 self.rlist[which]="fail"
1416 self["resultlist"].updateList(self.rlist)
1419 def remove_card(self):
1420 index = self["testlist"].getCurrent()[1]
1422 result = eSctest.getInstance().eject_smart_card("/dev/sci0")
1424 result = eSctest.getInstance().eject_smart_card("/dev/sci1")
1425 print 'remove result' ,result
1427 self.rlist[index]="pass"
1428 self.result += (1<<index)
1431 self.session.open( MessageBox, _("2:NO_DEV_FOUND"), MessageBox.TYPE_ERROR)
1433 self.session.open( MessageBox, _("2:SC_NOT_INSERTED"), MessageBox.TYPE_ERROR)
1435 self.session.open( MessageBox, _("2:SC_NOT_VALID_ATR"), MessageBox.TYPE_ERROR)
1437 self.session.open( MessageBox, _("2:SC_NOT_REMOVED"), MessageBox.TYPE_ERROR)
1438 self.rlist[index]="fail"
1439 self["resultlist"].updateList(self.rlist)
1440 self["text"].setText(_("Press OK Key"))
1445 def ScTest(self, yesno):
1448 index = self["testlist"].getCurrent()[1]
1449 result = self.check_smart_card(index)
1451 self.removecard.start(100,True)
1452 self["text"].setText(_("Read Ok. Remove Card!"))
1458 class SmartCardTest(Screen):
1460 <screen position="300,240" size="160,120" title="SmartCard Test" >
1461 <widget name="text" position="10,10" size="140,100" font="Regular;22" />
1464 def __init__(self, session):
1465 self["actions"] = ActionMap(["DirectionActions", "OkCancelActions"],
1467 "cancel": self.keyCancel,
1468 "ok" : self.keyCancel
1471 Screen.__init__(self, session)
1472 # self["text"]=Label(("Press Key LEFT"))
1473 self["text"]=Label(("Testing Smartcard 1..."))
1475 self.smartcardtimer = eTimer()
1476 self.smartcardtimer.callback.append(self.check_smart_card)
1477 self.smartcardtimer.start(100,True)
1478 self.closetimer = eTimer()
1479 self.closetimer.callback.append(self.close)
1481 global smartcardtest
1487 def check_mode(self):
1489 if fileExists("/proc/stb/info/vumodel"):
1490 info = open("/proc/stb/info/vumodel").read()
1492 if info[:5] == "combo":
1496 info = open("/proc/stb/info/version").read()
1498 if info[:2] == "14":
1500 elif info[:2] == "12":
1503 # fd = open("/proc/stb/info/version","r")
1504 # version = fd.read()
1505 # if int(version,16) <= 0x1200A3:
1509 # if int(version,16) < 0x130000:
1511 # elif int(version,16) > 0x140000:
1516 def check_smart_card(self):
1517 global smartcardtest
1518 index = self.smartcard
1521 if self.Testmode==0:
1522 result = eSctest.getInstance().check_smart_card("/dev/sci0")
1524 result = eSctest.getInstance().n_check_smart_card("/dev/sci0")
1526 if self.Testmode==0:
1527 result = eSctest.getInstance().check_smart_card("/dev/sci1")
1529 result = eSctest.getInstance().n_check_smart_card("/dev/sci1")
1537 if(index== 0 and ( self.model== 0 or self.model==2) ):
1539 self["text"].setText(_("Testing Smartcard 2..."))
1540 self.smartcardtimer.start(100,True)
1542 elif (index==1 or self.model==1):
1544 # self.session.open( MessageBox, _("Smart Card OK!!"), MessageBox.TYPE_INFO,2)
1546 self["text"].setText(_("Smart Card OK!!"))
1547 self.closetimer.start(2000,True)
1548 self.smartcardtimer.stop()
1549 # self.session.openWithCallback(self.check6, MessageBox, _("Scart loop ok?"), MessageBox.TYPE_INFO)
1552 # self.session.open( MessageBox, _("%d:NO_DEV_FOUND"%(index+1)), MessageBox.TYPE_ERROR)
1553 # elif result == -2:
1554 # self.session.open( MessageBox, _("%d:SC_NOT_INSERTED"%(index+1)), MessageBox.TYPE_ERROR)
1555 # elif result == -3:
1556 # self.session.open( MessageBox, _("%d:SC_NOT_VALID_ATR"%(index+1)), MessageBox.TYPE_ERROR)
1557 # elif result == -5:
1558 # self.session.open( MessageBox, _("%d:SC_READ_TIMEOUT"%(index+1)), MessageBox.TYPE_ERROR)
1560 self["text"].setText(_("Smart Card 1 Error!\nerrorcode=%d"%result))
1562 self["text"].setText(_("Smart Card 2 Error!\nerrorcode=%d"%result))
1563 self.closetimer.start(2000,True)
1564 self.smartcardtimer.stop()
1567 def keyCancel(self):
1574 class FrontTest(Screen):
1576 <screen position="260,240" size="200,180" title="Front Test" >
1577 <widget name="text" position="10,10" size="180,160" font="Regular;22" />
1580 def __init__(self, session):
1581 self["actions"] = ActionMap(["DirectionActions", "OkCancelActions"],
1585 "down":self.keyDown,
1586 "cancel": self.keyCancel,
1589 Screen.__init__(self, session)
1590 self["text"]=Label(("Wheel LEFT"))
1593 self.fronttimer= eTimer()
1594 self.fronttimer.callback.append(self.FrontAnimate)
1595 self.frontturnonoff = 0
1596 eSctest.getInstance().VFD_Open()
1597 self.keytimeout = eTimer()
1598 self.keytimeout.callback.append(self.KeyTimeOut)
1599 self.keytimeout.start(5000,True)
1601 def KeyTimeOut(self):
1603 self["text"].setText(("Wheel LEFT ERROR"))
1604 elif self.step ==2 :
1605 self["text"].setText(("Wheel RIGHT ERROR"))
1606 elif self.step == 3:
1607 self["text"].setText(("Wheel BUTTON ERROR"))
1611 def keyCancel(self):
1613 self.fronttimer.stop()
1614 eSctest.getInstance().VFD_Close()
1623 self.keytimeout.stop()
1624 self.keytimeout.start(5000,True)
1626 self["text"].setText(_("Press Front Wheel"))
1630 self.keytimeout.stop()
1631 self.keytimeout.start(5000,True)
1633 self["text"].setText(_("Wheel RIGHT"))
1639 self.keytimeout.stop()
1641 self.fronttimer.start(1000,True)
1642 self["text"].setText(("Front Test OK!\nPress Exit Key"))
1643 # elif self.step==4:
1645 # self.fronttimer.stop()
1646 # eSctest.getInstance().VFD_Close()
1650 def FrontAnimate(self):
1651 if (self.frontturnonoff==0):
1652 eSctest.getInstance().turnon_VFD()
1653 self.frontturnonoff = 1
1655 self.frontturnonoff = 0
1656 eSctest.getInstance().turnoff_VFD()
1657 self.fronttimer.start(1000,True)
1660 class FrontTest_solo(Screen):
1662 <screen position="260,240" size="200,180" title="Front Test" >
1663 <widget name="text" position="10,10" size="180,160" font="Regular;22" />
1666 def __init__(self, session):
1667 self["actions"] = ActionMap(["DirectionActions", "OkCancelActions","GlobalActions"],
1670 "cancel": self.keyCancel,
1671 "left": self.keyleft,
1672 "right": self.keyright,
1673 "power_down": self.keypower,
1674 "volumeUp": self.keyvolup,
1675 "volumeDown": self.keyvoldown,
1678 Screen.__init__(self, session)
1679 self["text"]=Label(("Press Front STANDBY"))
1682 self.fronttimer= eTimer()
1683 self.fronttimer.callback.append(self.FrontAnimate)
1684 self.frontturnonoff = 0
1685 eSctest.getInstance().VFD_Open()
1686 self.keytimeout = eTimer()
1687 self.keytimeout.callback.append(self.KeyTimeOut)
1688 self.keytimeout.start(5000,True)
1690 def KeyTimeOut(self):
1692 self["text"].setText(("Front STANDBY ERROR\nPress exit!"))
1693 elif self.step == 2 :
1694 self["text"].setText(("Front CH - ERROR\nPress exit!"))
1695 elif self.step == 3:
1696 self["text"].setText(("Front CH + ERROR\nPress exit!"))
1697 elif self.step == 4 :
1698 self["text"].setText(("Front VOL - ERROR\nPress exit!"))
1699 elif self.step == 5:
1700 self["text"].setText(("Front VOL + ERROR\nPress exit!"))
1707 self.keytimeout.stop()
1708 self.keytimeout.start(5000,True)
1710 self["text"].setText(_("Press Front CH -"))
1714 self.keytimeout.stop()
1715 self.keytimeout.start(5000,True)
1717 self["text"].setText(_("Press Front VOL -"))
1721 self.keytimeout.stop()
1722 self.keytimeout.start(5000,True)
1724 self["text"].setText(_("Press Front CH +"))
1728 self.keytimeout.stop()
1730 self.fronttimer.start(1000,True)
1731 self["text"].setText(_("Front LED OK?\n\nyes-ok\nno-exit"))
1732 # self["text"].setText(("Front Test OK!\nPress Exit Key"))
1734 def keyvoldown(self):
1736 self.keytimeout.stop()
1737 self.keytimeout.start(5000,True)
1739 self["text"].setText(_("Press Front VOL +"))
1741 def checkled(self, yesno):
1748 def keyCancel(self):
1750 self.fronttimer.stop()
1751 eSctest.getInstance().VFD_Close()
1757 self.fronttimer.stop()
1758 eSctest.getInstance().VFD_Close()
1763 def FrontAnimate(self):
1764 if (self.frontturnonoff==0):
1765 eSctest.getInstance().turnon_VFD()
1766 self.frontturnonoff = 1
1768 self.frontturnonoff = 0
1769 eSctest.getInstance().turnoff_VFD()
1770 self.fronttimer.start(1000,True)
1779 class RS232Test(Screen):
1781 <screen position="300,240" size="160,100" title="RS232 Test" >
1782 <widget name="text" position="10,10" size="140,80" font="Regular;22" />
1785 def __init__(self, session):
1786 self["actions"] = ActionMap(["DirectionActions", "OkCancelActions"],
1788 "cancel": self.keyCancel,
1791 Screen.__init__(self, session)
1792 self["text"]=Label(("Press \"Enter\" Key"))
1793 self.timer = eTimer()
1794 self.timer.callback.append(self.checkrs232)
1795 self.timer.start(100, True)
1797 def checkrs232(self):
1800 rs=open('/dev/ttyS0','r')
1802 r,w,e = select.select(rd, [], [], 10)
1817 def keyCancel(self):
1822 class AgingTest(Screen):
1824 <screen position="200,240" size="250,100" title="Aging Test" >
1825 <widget name="text1" position="10,10" size="230,40" font="Regular;22" />
1826 <widget name="text2" position="10,50" size="230,40" font="Regular;22" />
1829 def __init__(self, session):
1830 self["actions"] = ActionMap(["WizardActions","GlobalActions"],
1832 "agingend": self.keyEnd,
1833 "agingfinish": self.keyFinish,
1834 "volumeUp": self.nothing,
1835 "volumeDown": self.nothing,
1836 "volumeMute": self.nothing,
1839 Screen.__init__(self, session)
1840 self["text1"]=Label(("Exit - Press Pause Key"))
1841 self["text2"]=Label(("Reset - Press Stop Key"))
1842 # self.servicelist = ServiceList()
1843 # self.oldref = session.nav.getCurrentlyPlayingServiceReference()
1844 # print "oldref",self.oldref
1845 # session.nav.stopService() # try to disable foreground service
1848 self.tuningtimer = eTimer()
1849 self.tuningtimer.callback.append(self.updateStatus)
1850 # self.tuningtimer.start(2000,True)
1853 def updateStatus(self):
1854 result = eSctest.getInstance().getFrontendstatus(0)
1857 print "eSctest.getInstance().getFrontendstatus - %d"%result
1860 self.session.nav.stopService()
1861 self.session.open( MessageBox, _("Tune 1 Ver Locking Fail..."), MessageBox.TYPE_ERROR)
1866 self.session.nav.stopService()
1867 self.session.open( MessageBox, _("Tune 1 Ver Error %d..."%result), MessageBox.TYPE_ERROR)
1874 if self.oldref is None:
1875 eref = eServiceReference("1:0:19:1324:3EF:1:C00000:0:0:0")
1876 serviceHandler = eServiceCenter.getInstance()
1877 servicelist = serviceHandler.list(eref)
1878 if not servicelist is None:
1879 ref = servicelist.getNext()
1881 ref = self.getCurrentSelection()
1882 print "servicelist none"
1885 self.session.nav.stopService() # try to disable foreground service
1890 ref.setData(4,0x640000)
1891 self.session.nav.playService(ref)
1896 self.session.nav.stopService() # try to disable foreground service
1899 def keyFinish(self):
1902 self.session.nav.stopService() # try to disable foreground service
1914 def main(session, servicelist, **kwargs):
1918 Servicelist = servicelist
1919 bouquets = Servicelist.getBouquetList()
1921 bouquetSel = Session.openWithCallback(cleanup, FactoryTest)
1923 #def Plugins(**kwargs):
1924 # return PluginDescriptor(name=_("Factory Test"), description="Test App for Factory", where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)