Merge branch 'master' of fraxinas@git.opendreambox.org:/git/enigma2
[enigma2.git] / lib / python / Plugins / SystemPlugins / NFIFlash / flasher.py
index b077905ff84dd6cbcb9a1b7370c6904be0100dfe..860efc027e966de0707c1b3c09455492d2ca56be 100644 (file)
@@ -1,4 +1,3 @@
-# -*- coding: utf8 -*-
 from Screens.Screen import Screen
 from Screens.MessageBox import MessageBox
 from Screens.ChoiceBox import ChoiceBox
 from Screens.Screen import Screen
 from Screens.MessageBox import MessageBox
 from Screens.ChoiceBox import ChoiceBox
@@ -18,7 +17,7 @@ import re
 
 class writeNAND(Task):
        def __init__(self,job,param,box):
 
 class writeNAND(Task):
        def __init__(self,job,param,box):
-               Task.__init__(self,job, _("Writing image file to NAND Flash"))
+               Task.__init__(self,job, ("Writing image file to NAND Flash"))
                self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/mywritenand")
                if box == "dm7025":
                        self.end = 256
                self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/mywritenand")
                if box == "dm7025":
                        self.end = 256
@@ -27,7 +26,7 @@ class writeNAND(Task):
                if box == "dm8000":
                        self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand")
                self.args += param
                if box == "dm8000":
                        self.setTool("/usr/lib/enigma2/python/Plugins/SystemPlugins/NFIFlash/dm8000_writenand")
                self.args += param
-               self.weighting = 1      
+               self.weighting = 1
 
        def processOutput(self, data):
                print "[writeNand] " + data
 
        def processOutput(self, data):
                print "[writeNand] " + data
@@ -147,9 +146,9 @@ class NFIFlash(Screen):
                        if fileExists(nfofilename):
                                nfocontent = open(nfofilename, "r").read()
                                self["infolabel"].text = nfocontent
                        if fileExists(nfofilename):
                                nfocontent = open(nfofilename, "r").read()
                                self["infolabel"].text = nfocontent
-                               pos = nfocontent.find("md5sum")
+                               pos = nfocontent.find("MD5:")
                                if pos > 0:
                                if pos > 0:
-                                       self.md5sum = nfofilename
+                                       self.md5sum = nfocontent[pos+5:pos+5+32] + "  " + self.nfifile
                                else:
                                        self.md5sum = ""
                        else:
                                else:
                                        self.md5sum = ""
                        else:
@@ -175,17 +174,22 @@ class NFIFlash(Screen):
                print sign
                if sign.find("NFI1" + self.box + "\0") == 0:
                        if self.md5sum != "":
                print sign
                if sign.find("NFI1" + self.box + "\0") == 0:
                        if self.md5sum != "":
-                               self["statusbar"].text = _("Please wait for md5 signature verification...")
-                               self.session.summary.setText(_("Please wait for md5 signature verification..."))
+                               self["statusbar"].text = ("Please wait for md5 signature verification...")
+                               self.session.summary.setText(("Please wait for md5 signature verification..."))
                                self.container = eConsoleAppContainer()
                                self.container.setCWD(self["filelist"].getCurrentDirectory())
                                self.container = eConsoleAppContainer()
                                self.container.setCWD(self["filelist"].getCurrentDirectory())
-                               self.container.appClosed.get().append(self.md5finished)
-                               self.container.execute("md5sum -cs " + self.md5sum)
+                               self.container.appClosed.append(self.md5finished)
+                               self.container.dataSent.append(self.md5ready)
+                               self.container.execute("md5sum -cw -")
+                               self.container.write(self.md5sum)
                        else:
                                self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file does not have a md5sum signature and is not guaranteed to work. Do you really want to burn this image to flash memory?"), MessageBox.TYPE_YESNO)
                else:
                        self.session.open(MessageBox, (_("This .NFI file does not contain a valid %s image!") % (self.box.upper())), MessageBox.TYPE_ERROR)
                        else:
                                self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file does not have a md5sum signature and is not guaranteed to work. Do you really want to burn this image to flash memory?"), MessageBox.TYPE_YESNO)
                else:
                        self.session.open(MessageBox, (_("This .NFI file does not contain a valid %s image!") % (self.box.upper())), MessageBox.TYPE_ERROR)
-                       
+
+       def md5ready(self, retval):
+               self.container.sendEOF()
+
        def md5finished(self, retval):
                if retval==0:
                        self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"), MessageBox.TYPE_YESNO)
        def md5finished(self, retval):
                if retval==0:
                        self.session.openWithCallback(self.queryCB, MessageBox, _("This .NFI file has a valid md5 signature. Continue programming this image to flash memory?"), MessageBox.TYPE_YESNO)
@@ -248,7 +252,7 @@ class NFIFlash(Screen):
 
        def reboot(self):
                if self.job.status == self.job.FINISHED:
 
        def reboot(self):
                if self.job.status == self.job.FINISHED:
-                       self["statusbar"].text = _("rebooting...")
+                       self["statusbar"].text = ("rebooting...")
                        TryQuitMainloop(self.session,2)
                        
        def createSummary(self):
                        TryQuitMainloop(self.session,2)
                        
        def createSummary(self):