Exemplo n.º 1
0
    def formatFilesSystem(self, sdmEnable):
        self.displayTitle('Initializes the file system...')
        bDontAutoRun = 0
        ret = self.shakeHands(sdmEnable)
        if (ret != 0):
            ret = self.reboot()
            if (ret == 0):
                bDontAutoRun = 1
                ret = fastboot('DontAutoRun')
            if (ret == 0):
                ret = self.runApp()
            if (ret == 0):
                sTimer = timer(5 * 1000)
                while (sTimer.check() > 0):
                    ret = self.shakeHands(sdmEnable)
                    if (ret == 0):
                        break

        if (ret == 0 and sdmEnable == SDMEnabled):
            ret = sdmclient('fsformat')
        if (ret == 0 and sdmEnable == SDMDisabled):
            ret = fastboot('fileSystem init 0 4M')
        if (ret == 0 and sdmEnable == SDMDisabled):
            ret = fastboot('fileSystem format 123456')
        if (ret == 0 and bDontAutoRun == 1):
            self.setAutoRun()
        return ret
Exemplo n.º 2
0
 def reboot(self):
     self.displayTitle('device reboot, plz waiting...')
     ret = sdmclient('reset')
     if (ret != 0):
         ret = fastboot('reset')
     if (ret == 0):
         ret = self.waitDeviceConnect(40)
     return ret
Exemplo n.º 3
0
 def setDontAutoRun(self):
     self.displayTitle('set device dont auto run...')
     ret = self.shakeHands(SDMEnabled)
     if (ret == 0):
         ret = sdmclient('stop')
     if (ret != 0):
         ret = self.shakeHands(SDMDisabled)
     if (ret == 0):
         ret = fastboot('DontAutoRun')
     if (ret == 0):
         ret = self.reboot()
     return ret
Exemplo n.º 4
0
    def shakeHands(self, sdmEnable):
        count = 0
        while (count < 3):
            if (sdmEnable == SDMEnabled):
                ret = sdmclient('version')
            else:
                ret = fastboot('mercuryVersion')

            if (ret == 0):
                break
            count = count + 1
        return ret
Exemplo n.º 5
0
    def readFileList(self, sdmEnable, path=None):
        self.displayTitle('read file list %s, plz waiting...' % (path))
        if (os.path.isfile(localpath) == False):
            return -1

        ret = self.shakeHands(sdmEnable)
        if (ret != 0):
            ret = self.reboot()
            if (ret == 0):
                self.runApp()
        if (ret == 0):
            if (sdmEnable == SDMEnabled):
                ret = sdmclient('push %s %s' % (localpath, fileName))
            else:
                ret = fastboot('push %s e:\%s' % (localpath, fileName))
        return ret
Exemplo n.º 6
0
    def downloadMainApp(self, fileName):
        self.displayTitle('download main app, plz waiting...')
        if (os.path.isfile(fileName) == False):
            return -1

        ret = self.shakeHands(SDMEnabled)
        if (ret == 0):
            ret = sdmclient('stop')
        if (ret != 0):
            ret = self.shakeHands(SDMDisabled)
        if (ret == 0):
            ret = fastboot('DontAutoRun')

        ret = self.reboot()
        if (ret == 0):
            ret = fastboot('flash app %s' % (fileName))
        if (ret == 99):
            ret = self.runApp()
        return ret
Exemplo n.º 7
0
    def setLogo(self, fileName):
        self.displayTitle('set logo %s, plz waiting...' % (fileName))
        if (os.path.isfile(fileName) == False):
            return -1
        ret = self.shakeHands(SDMEnabled)
        if (ret == 0):
            ret = sdmclient('stop')
        if (ret != 0):
            ret = self.shakeHands(SDMDisabled)
        if (ret == 0):
            ret = fastboot('DontAutoRun')

        ret = self.reboot()
        if (ret == 0):
            ret = fastboot('setLogo %s 0 0 0' % (fileName))
        if (ret == 0):
            ret = fastboot('autoRun')
        if (ret == 0 or ret == 99):
            ret = self.runApp()
        return ret
Exemplo n.º 8
0
    def pushFile(self, sdmEnable, localpath, fileName):
        self.displayTitle('download file %s, plz waiting...' % (fileName))
        if (os.path.isfile(localpath) == False):
            return -1

        ret = self.shakeHands(sdmEnable)
        if (ret != 0):
            ret = self.reboot()
            if (ret == 0):
                ret = self.runApp()
            if (ret == 0):
                sTimer = timer(5 * 1000)
                while (sTimer.check() > 0):
                    ret = self.shakeHands(sdmEnable)
                    if (ret == 0):
                        break

        if (ret == 0):
            if (sdmEnable == SDMEnabled):
                ret = sdmclient('push %s %s' % (localpath, fileName))
            else:
                ret = fastboot('fileSystem push %s e:\%s' %
                               (localpath, fileName))
        return ret