Beispiel #1
0
    def _check_flash_tool_availability(self):
        """
        Check if Flash Tool is installed over current ACS bench

        :rtype: str
        :return: string containing flash tool name to use for flash execution
        """
        if str(platform.system()) in ["Windows", "Linux"]:
            cmd_name = "cflasher"
        else:
            error_msg = "SED_FT: Unknown platform (Only Windows and Linux supported)"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR,
                                     error_msg)

        # Check the phone flash tool installation over ACS bench
        phone_flash_tool_cmd_path = CommandLine.which(cmd_name)
        if phone_flash_tool_cmd_path is None:
            error_msg = "SED_FT: Check if PhoneFlashTool software is installed on ACS bench (Command %s not found !)" % cmd_name
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR,
                                     error_msg)

        # Check the JLink tool installation over ACS bench
        jlink_tool_cmd_path = CommandLine.which("JLinkExe")
        if jlink_tool_cmd_path is None:
            error_msg = "SED_FT: Check if Segger J-Link software is installed on ACS bench (Command %s not found !)" % cmd_name
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR,
                                     error_msg)

        return cmd_name
Beispiel #2
0
    def _check_flash_tool_availability(self):
        """
        Check if Dediprog Flash Tool is installed over current ACS bench

        :rtype: str
        :return: string containing flash tool name to use for flash execution
        """
        cmd_name = ""

        # Check the dediprog flash tool installation over ACS bench
        if platform.system() == "Windows":
            cmd_name = "dpcmd"
        else:
            cmd_name = "flashrom"

        flash_tool_cmd_path = CommandLine.which(cmd_name)

        if flash_tool_cmd_path is None:
            error_msg = "DEDIPROG: Check if DEDIPROG is installed on ACS bench (Command %s not found !)" % cmd_name
            if platform.system() == "Windows":
                error_msg += " - Check also if DEDIPROG folder is referenced on ACS bench in PATH environment variable"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR,
                                     error_msg)
        else:
            # DEDIPROG software is installed
            try:
                # Try to launch DEDIPROG flash tool

                # Analyze for LINUX and WINDOWS, return code to see if DEDIPROG flash tool is launchable
                if platform.system() == "Windows":
                    cmd = cmd_name + " -d"
                else:
                    cmd = cmd_name + " --version"

                return_code, return_message = internal_shell_exec(
                    cmd, 1, silent_mode=True)

            except Exception as ex:
                err_msg = "DEDIPROG: Flash tool (%s) execution issue over ACS bench - error: %s" % (
                    cmd, str(ex))
                self._logger.error(err_msg)
                raise AcsConfigException(
                    AcsConfigException.EXTERNAL_LIBRARY_ERROR, err_msg)

            if return_code == 0:
                # DEDIPROG flash tool is installed and available
                # Print the flash tool version
                self._logger.info(
                    "DEDIPROG: Flash tool is installed and running over ACS bench - version : %s"
                    % str(return_message))
            else:
                # DEDIPROG flash tool issue when launching it
                err_msg = "DEDIPROG: Flash tool (command= %s) execution issue over ACS bench - " % (cmd) + \
                          " - error: %s" % (str(return_message))
                self._logger.error(err_msg)
                raise AcsConfigException(
                    AcsConfigException.EXTERNAL_LIBRARY_ERROR, err_msg)

        return cmd_name
Beispiel #3
0
 def __check_flash_script(self):
     # Now check availability of flashing script (mean full cmd with no parameters if any)
     cmd = self._get_cmd().split()[0]
     flash_all_cmd_path = CommandLine.exists(cmd)
     if not flash_all_cmd_path:
         error_msg = "EFT: Check if %s script is packaged with build file (not found !))" % self._flash_tool_cmd
         self._logger.error(error_msg)
         raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR,
                                  error_msg)
     else:
         if platform.system() == "Linux":
             self._logger.debug("Fix file permission on %s" % cmd)
             # Add execution mode to current mode
             mode = os.stat(cmd).st_mode | stat.S_IEXEC
             # fix file permission
             CommandLine.chmod(cmd, mode)
Beispiel #4
0
    def _check_flash_tool_availability(self):
        """
        Check if Flash Tool is installed over current ACS bench

        :rtype: str
        :return: string containing flash tool name to use for flash execution
        """
        if platform.system() == "Windows":
            error_msg = "Flashing of Edison devices with ACS actually not supported !"
            raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR,
                                     error_msg)

        cmd_name = "phoneflashtool"

        # Check the phone flash tool installation over ACS bench
        phone_flash_tool_cmd_path = CommandLine.which(cmd_name)

        if phone_flash_tool_cmd_path is None:
            error_msg = "EFT: Check if PHONE FLASH TOOL is installed on ACS bench (Command %s not found !)" % cmd_name
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR,
                                     error_msg)

        cmd_name = "dfu-util"

        # Check the phone flash tool installation over ACS bench
        dfu_cmd_path = CommandLine.which(cmd_name)

        if dfu_cmd_path is None:
            error_msg = "EFT: Check if dfu-util is installed on ACS bench (Command %s not found !)" % cmd_name
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR,
                                     error_msg)

        # Now set cmd_name as script to be used for flash
        cmd_name = "flashall.sh"

        return cmd_name
Beispiel #5
0
    def _check_flash_tool_availability(self):
        """
        Check if PFT Flash Tool is installed over current ACS bench

        :rtype: str
        :return: string containing flash tool name to use for flash execution
        """
        if platform.system() == "Windows":
            cmd_name = "cflasher"
        else:
            cmd_name = "phoneflashtool"

        # Check the phone flash tool installation over ACS bench
        flash_tool_cmd_path = CommandLine.which(cmd_name)

        if flash_tool_cmd_path is None:
            error_msg = "PFT: Check if PHONE FLASH TOOL is installed on ACS bench (Command %s not found !)" % cmd_name
            if platform.system() == "Windows":
                error_msg += " - Check also if PHONE FLASH TOOL folder is referenced on ACS bench in PATH environment variable"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR, error_msg)

        #
        # NOT NEEDED for the moment as PFT gives its version everytime it is launched (uncomment if needed)
        #
        #         else:
        # PFT software is installed
        #             try:
        # Try to launch PFT flash tool
        # Analyze for LINUX and WINDOWS, return code to see if PFT flash tool is launchable
        #                 cmd = cmd_name + " --version"
        #                 return_code, return_message = internal_shell_exec(cmd, 1, silent_mode=True)
        #
        #             except Exception as ex:
        #                 err_msg = "PFT: Flash tool (%s) execution issue over ACS bench - error: %s" % (cmd, str(ex))
        #                 self._logger.error(err_msg)
        #                 raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR, err_msg)
        #
        #             if return_code == 0:
        # PFT flash tool is installed and available
        # Print the flash tool version
        #                 self._logger.info("PFT: Flash tool is installed and running over ACS bench - version : %s" % str(return_message))
        #             else:
        # PFT flash tool issue when launching it
        #                 err_msg = "PFT: Flash tool (command= %s) execution issue over ACS bench - error: %s" % (cmd, str(return_message))
        #                 self._logger.error(err_msg)
        #                 raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR, err_msg)
        #

        return cmd_name
    def __init__(self):
        super(CrashToolUploaderModule, self).__init__()
        self._device_serial_number = None
        self._cache_folder = None
        self._disable_clota = None
        self._server_address = None
        self._server_port = None
        self._retrieve_data = None
        self._json_pattern_expr = None
        self._debug_mode = None

        self.__adb_option = ""
        adb_full_path = CommandLine.which("adb")
        if adb_full_path:
            self.__adb_option = " -adbpath \"{0}\"".format(adb_full_path)

        self._crashtooluploader_cmd = self.CRASHTOOLUPLOADER_CMD.format(
            self.CRASHTOOLUPLOADER_DEFAULT_PATH, self.__adb_option)
Beispiel #7
0
    def _check_flash_tool_availability(self):
        """
        Check if CFlasher Flash Tool is installed over current ACS bench

        :rtype: str
        :return: string containing flash tool name to use for flash execution
        """
        cmd_name = "cflasher"

        # Check the phone flash tool installation over ACS bench
        flash_tool_cmd_path = CommandLine.which(cmd_name)

        if flash_tool_cmd_path is None:
            error_msg = "Cflasher Check if PHONE FLASH TOOL is installed on ACS bench (Command %s not found !)" % cmd_name
            if platform.system() == "Windows":
                error_msg += " - Check also if PHONE FLASH TOOL folder is referenced on ACS bench in PATH environment variable"
            self._logger.error(error_msg)
            raise AcsConfigException(AcsConfigException.EXTERNAL_LIBRARY_ERROR,
                                     error_msg)
        return cmd_name