示例#1
0
 def flash_ifwi(self):
     ifwi_tool_path = '/opt/ias/programming_tools/'
     path = os.path.join(self.dir, self.command_list[0])
     passwd = self._get_passwd()
     print "Path=======:", path
     cmd = 'echo ' + passwd + '|sudo -S ' + ifwi_tool_path + 'ias-spi-programmer --write ' + path
     print "CMD=======:", cmd
     count = 0
     while count < 5:
         print "Traceback info:"
         print "========================================"
         try:
             time.sleep(2)
             create_relay08_cmd(3)
             time.sleep(10)
             create_relay08_cmd(1, 0.5)
             s = os.system(cmd)
             print "========================================"
             if s == 0:
                 print "Flash ifwi successfully"
                 return True
             else:
                 print "Flash ifwi Failed!!!"
                 count += 1
                 print "count is {0}".format(count)
                 time.sleep(10)
         except Exception, e:
             print e
示例#2
0
    def flash_cwp(self):
        print "******Del all html files******"
        print "self.test_tag", self.test_tag
        passwd = self._get_passwd()
        time.sleep(2)
        os.system("rm *.html")
        if self.get_weekly() and self.get_latest():
            print "====================Flash ifwi==================="

            if self.flash_ifwi():
                time.sleep(10)
                print "========wait for ttyusb3 init========"
                time.sleep(1)
                cmd = "echo '" + passwd + "' | sudo -S python ~/slave_server/runner/flash/lib/serial_com.py -p /dev/ttyUSB2 -c n2#"
                print "test_cmd:", cmd
                time.sleep(1)
                os.system(cmd)
                time.sleep(60)
                print "==========Enable Fastboot Mode=========="
                time.sleep(10)
                try:
                    # os.system("adb reboot bootloader")
                    # time.sleep(10)
                    if len((os.popen("fastboot devices")).read()) != 0:
                        time.sleep(2)
                        for i in self.commands:
                            print "******Flash images {0}******".format(i)
                            os.system("fastboot %s" % i)
                            time.sleep(2)
                        time.sleep(10)
                        create_relay08_cmd(1)
                except Exception, e:
                    print "******Flash image Failed******:", e
                    return False
    def flash_ifwi(self):
        """
        download_ifwi
        """
        path = os.path.join("runner/flash", self.imagePath,
                            self.command_list[0])
        cmd = 'echo ' + conf.host.PASSWD + '|sudo -S ' + self.platform_path + 'ias-spi-programmer --write ' + path
        logger.debug("flash ifwi: " + cmd)
        count = 0
        while count < 10:
            time.sleep(2)
            create_relay08_cmd(3)
            time.sleep(3)
            create_relay08_cmd(1, 0.2)

            time.sleep(0.2 + count * 0.02)
            ret = os.system(cmd)
            if ret == 0:
                logger.debug("Flash ifwi successfully")
                return True
            else:
                logger.debug("Flash ifwi Failed!!!")
                count += 1
                logger.debug("count is {0}".format(count))
        if count == 10:
            sys.stderr.write("ifwi_flash_error:image_flash_failed")
            time.sleep(2)
            sys.exit(1)
 def create_relaycmd(self):
     create_relay08_cmd(self.line)