Example #1
0
 def check_reboot_and_enter_installui(self, sn):
     '''
     :param sn:
     :param flag:
     :return:
     '''
     try:
         # co.reboot_device(sn)
         co.reboot_device(sn)
         # co.wait_hu_recovery(sn)
         time.sleep(5)
         if co.wait_hu_recovery(sn) == 0:
             if co.alway_send_signal(sn, SL.ActiveUpgrade) == 0:
                 return 0
             else:
                 pcan = SC.PCAN()
                 pcan.poweron_and_clean()
                 return 1
         else:
             logger.log_error("wait hu recovery fail", \
                              sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                              sys._getframe().f_lineno)
             return 1
     except Exception as e:
         logger.log_error("%s" % (e), \
                          sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                          sys._getframe().f_lineno)
         return 1
Example #2
0
 def check_reboot_and_enter_installui_and_cancle(self, sn):
     '''
     :param sn:
     :param flag:
     :return:
     '''
     try:
         co.reboot_device(sn)
         time.sleep(5)
         if co.wait_hu_recovery(sn) == 0:
             if co.alway_send_signal(sn, SL.ActiveUpgrade) == 0:
                 if co.cancle_install_through_ui(sn) == 0:
                     return 0
                 else :
                     return 1
             else:
                 logger.log_error("can not find install ui", \
                             sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,sys._getframe().f_lineno)
                 return 1
         else:
             logger.log_error("wait hu recovery fail",\
                              sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
             return 1
     except Exception as e:
         logger.log_error("%s" %(e),\
                          sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
         return 1
Example #3
0
 def check_install_and_sendsignal(self, sn, flag):
     '''
     function: check active upgrade
     :param sn:
     :return:
     '''
     co.delete_file(sn)
     time.sleep(5)
     # package.flash_through_system(sn)
     try:
         if package.update_system_through_fastboot(retry_times) == 0 and co.start_fota_daemon(sn) == 0:
         # if co.start_fota_daemon(sn) == 0:
             time.sleep(5)
             if self.get_requestdata_to_file(sn) == 1:
                 logger.log_error("maybe has no network",\
                                  sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
                 return 1
             if co.check_package_exist(sn,flag) == 0:
                 try:
                     expect_size = int(co.get_packagesize_from_json_file(sn,flag))
                     while True:
                         actual_size = co.check_package_size(sn,flag,30)
                         if int(actual_size) == expect_size:
                             break
                     if co.send_signal(sn, SL.ActiveUpgrade) == 0:
                         time.sleep(20)
                         if co.wait_hu_recovery(sn) == 0:
                             if self.check_system_version(sn) == 0:
                                 if co.alway_send_signal(sn,SL.ActiveUpgrade) == 1:
                                     return 0
                                 else:
                                     logger.log_error("expect no ui show,but ui has show",\
                                                      sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
                                     return 1
                             else:
                                 return 1
                         else:
                             logger.log_error("can not enter system",\
                                              sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
                             return 1
                     else:
                         return 1
                 except Exception as e:
                     logger.log_error("%s" %(e),\
                                      sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
                     return 1
             else:
                 logger.log_error("can not find pakcage",\
                                  sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
                 return 1
         else:
             return 1
     except Exception as e:
         logger.log_error("%s" %(e),\
                          sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
         return 1
Example #4
0
 def check_install_and_sendsignal(self, sn, flag_mcu, flag_mpu):
     '''
     function: check active upgrade
     :param sn:
     :return:
     '''
     co.delete_file(sn)
     co.reboot_device(sn)
     co.wait_hu_recovery(sn)
     self.check_hu_network(sn)
     # time.sleep(5)
     # package.flash_through_system(sn)
     try:
         if self.get_requestdata_to_file(sn) == 1:
             logger.log_error("maybe has no network",\
                              sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
             return 1
         pcan = SC.PCAN()
         pcan.poweron_and_clean()
         if self.mcu_mpu_download_status(
                 sn, flag_mpu) == 0 and self.mcu_mpu_download_status(
                     sn, flag_mcu) == 0:
             try:
                 if co.check_md5_status(sn) == 0:
                     if co.send_signal(sn, SL.ActiveUpgrade,
                                       tbox_flag) == 0:
                         time.sleep(20)
                         if co.wait_hu_recovery(sn) == 0:
                             while True:
                                 if Tbox_Information.check_ping_value(
                                         sn) == 0:
                                     co.open_tbox_adb()
                                     time.sleep(5)
                                     break
                             Tbox_Information.copy_version_to_hu(sn)
                             if Tbox_Information.check_system_version(
                                     sn) == 0:
                                 if co.alway_send_signal(
                                         sn, SL.ActiveUpgrade) == 1:
                                     Tbox_Information.modify_tbox_config(sn)
                                     return 0
                                 else:
                                     logger.log_error("expect no ui show,but ui has show",\
                                                      sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
                                     Tbox_Information.modify_tbox_config(sn)
                                     return 1
                             else:
                                 return 1
                         else:
                             logger.log_error("can not enter system",\
                                              sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
                             return 1
                     else:
                         return 1
                 else:
                     logger.log_error("check md5 value failed", \
                                      sys._getframe().f_code.co_filename, sys._getframe().f_code.co_name,
                                      sys._getframe().f_lineno)
                     return 1
             except Exception as e:
                 logger.log_error("%s" %(e),\
                                  sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
                 return 1
         else:
             logger.log_error("can not find pakcage",\
                              sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
             return 1
     except Exception as e:
         logger.log_error("%s" %(e),\
                          sys._getframe().f_code.co_filename,sys._getframe().f_code.co_name,sys._getframe().f_lineno)
         return 1