Exemple #1
0
    def __init__(self, config, logger):
        """
        Constructor

        :type  phone_name: string
        :param phone_name: Name of the current phone(e.g. PHONE1)
        """

        IntelDeviceBase.__init__(self, config, logger)
        # Kept for c
        self._cellular_network_interface = self.get_config(
            "cellularNetworkInterface", "rmnet0")
Exemple #2
0
    def __init__(self, config, logger):
        """
        Constructor

        :type  phone_name: str
        :param phone_name: Name of the current phone(e.g. PHONE1)
        """
        IntelDeviceBase.__init__(self, config, logger)

        # Benefit of settle duration to set fastboot settle duration
        self._fastboot_settledown_duration = self._settledown_duration
        self._keyboard_emulator_sleep_between_char = 1
    def __init__(self, config, logger):
        """
        Constructor

        :type  phone_name: str
        :param phone_name: Name of the current phone(e.g. PHONE1)
        """
        IntelDeviceBase.__init__(self, config, logger)

        # Benefit of settle duration to set fastboot settle duration
        self._fastboot_settledown_duration = self._settledown_duration
        self._keyboard_emulator_sleep_between_char = 1
        self._multiple_devices = self.config.get_value("multipleDevices",
                                                       "False", "str_to_bool")
Exemple #4
0
    def __init__(self, config, logger):
        """
        Constructor

        :type  config: dict
        :param config: Device configuration to use

        :type  logger: logger
        :param logger: Logger to use
        """
        IntelDeviceBase.__init__(self, config, logger)

        self._cellular_network_interface = self.get_config(
            "cellularNetworkInterface", "rmnet0")
    def __init__(self, config, logger):
        """
        Constructor

        :type  phone_name: str
        :param phone_name: Name of the current phone(e.g. PHONE1)
        """
        IntelDeviceBase.__init__(self, config, logger)

        # Flashing configuration elements (This device class only supports OS flashing procedure)

        # TODO: in case of Galaxy tab "fastbootKeyCombo" does not make sense because, there is no fastboot command for this device.
        # But to avoid adding other new key which do the same things, we reuse it.
        # Rework of device flashing (in collaboration with pupdr) is planned. This key could be refactored at this time.
        self._pos_keycombo = self.get_config("fastbootKeyCombo")
Exemple #6
0
    def switch_on(self, boot_timeout=None, settledown_duration=None,
                  simple_switch_mode=False):
        """
        Switch ON the device
        This can be done either via the power supply
        or via IO card

        :param boot_timeout: Total time to wait for booting
        :type boot_timeout: int

        :param settledown_duration: Time to wait until start to count \
                                    for timeout,
                                    Period during which the device must \
                                    have started.
        :type settledown_duration: int

        :param simple_switch_mode: a C{boolean} indicating whether we want
        to perform a simple switch on.
        :type simple_switch_mode: bool

        :rtype: list
        :return: Output status and output log
        """
        self.prevent_usb_plug = 5 # Hack to avoid usb plug/unplug on the first get_boot_mode calls

        (return_code, return_message) = IntelDeviceBase.switch_on(self, boot_timeout,
                                                                  settledown_duration,
                                                                  simple_switch_mode)
        if return_code == Global.SUCCESS:
            if self._embedded_log:
                # Initialize embedded log mechanism for MODEM if required
                self._embedded_log.start("MODEM")

        return return_code, return_message
Exemple #7
0
    def __init__(self, config, logger):
        """
        Constructor

        :type  phone_name: string
        :param phone_name: Name of the current phone(e.g. PHONE1)
        """

        IntelDeviceBase.__init__(self, config, logger)

        self._cellular_network_interface = self.get_config("cellularNetworkInterface", "rmnet0")

        self._em = EquipmentManager()
        iocard = self.get_config("IoCard", "IO_CARD", str)
        self._io_card = self._em.get_io_card(iocard)
        self._usb_recovery_ongoing = False
        self.prevent_usb_plug = 5
Exemple #8
0
    def get_boot_mode(self):
        """
        get the boot mode from adb

        :rtype: string
        :return: device state
        """
        if self._android_codeline == "AIA":
            mode = AndroidDeviceBase.get_boot_mode(self)
        else:
            mode = IntelDeviceBase.get_boot_mode(self)

        return mode
Exemple #9
0
    def _connect_adb(self, tcp_connect_retries_nb=None, adb_connect_retries_nb=None):
        """
        Connect ADB though USB or ETHERNET, ensure adb root connection if set
        :param tcp_connection_retry_nb: allow to override retry nb
        :param adb_connection_retry_nb:  allow to override retry nb
        :rtype: bool, str
        :return: status of ADB connection and status message
        """

        usbReplugRetries = self.get_config("usbReplugRetries", 0, int)
        if usbReplugRetries:
            self.recover_usb(usbReplugRetries)

        return IntelDeviceBase._connect_adb(self, tcp_connect_retries_nb, adb_connect_retries_nb)
Exemple #10
0
    def _run_adb_cmd(self, cmd, timeout, silent_mode=False, wait_for_response=True, cancel=None):
        """
        Execute the input adb command and return the result message
        If the timeout is reached, return an exception

        :type  cmd: string
        :param cmd: cmd to be run
        :type  timeout: integer
        :param timeout: Script execution timeout in sec
        :type  cancel: Cancel
        :param cancel: a Cancel object that can be used to stop execution, before completion or timeout(default None)

        :return: Execution status & output string
        :rtype: Integer & String
        """
        result, msg = IntelDeviceBase._run_adb_cmd(self, cmd, timeout, silent_mode, wait_for_response, cancel)

        # if both the command and adb wait-for-device fail, try to unplug/replug usb several times
        # and try the command again if successful
        if result != Global.SUCCESS:
            usbReplugRetries = self.get_config("usbReplugRetries", 0, int)
            if usbReplugRetries and self.recover_usb(usbReplugRetries):
                result, msg = IntelDeviceBase._run_adb_cmd(self, cmd, timeout, silent_mode, wait_for_response, cancel)
        return result, msg
Exemple #11
0
    def get_boot_mode(self):
        """
        get the boot mode from adb

        :rtype: string
        :return: device state : MOS, ROS, POS, DNX, COS or UNKNOWN
        """

        # Hack to avoid usb unplug/replug at the beginning of boot
        if self.prevent_usb_plug > 0:
            self.prevent_usb_plug -= 1
            time.sleep(5)
            return "UNKNOWN"

        return IntelDeviceBase.get_boot_mode(self)
Exemple #12
0
    def reboot(self, mode="MOS", wait_for_transition=True,
               transition_timeout=None, skip_failure=False,
               wait_settledown_duration=False):
        """
        Perform a SOFTWARE reboot on the device.
        By default will bring you to MOS and connect acs once MOS is seen.
        this reboot require that you are in a state where adb or fastboot command can be run.

        :type mode: str or list
        :param mode: mode to reboot in, support MOS, COS, POS, ROS. It can be a list of these modes
               (ie ("COS","MOS"))
               .. warning:: it is not always possible to reboot in a mode from another mode
                eg: not possible to switch from ROS to COS

        :type wait_for_transition: bool
        :param wait_for_transition: if set to true,
                                    it will wait until the wanted mode is reached

        :type transition_timeout: int
        :param transition_timeout: timeout for reaching the wanted mode
                                    by default will be equal to boot timeout set on
                                    device catalog

        :type skip_failure: bool
        :param skip_failure: skip the failure, avoiding raising exception, using
                                this option block the returned value when it is equal to False

        :type wait_settledown_duration: bool
        :param wait_settledown_duration: if set to True, it will wait settleDownDuration seconds
                                          after reboot for Main OS only.

        :rtype: bool
        :return: return True if reboot action succeed depending of the option used, False otherwise
                 - if wait_for_transition not used, it will return True if the reboot action has been seen
                   by the device
                 - if wait_for_transition used , it will return True if the reboot action has been seen
                   by the device and the wanted reboot mode reached.
        """

        # TODO : REMOVEME
        # This is a workaround for BXT because the device is too unstable now
        # So we do not run adb reboot, but we force shutdown with USB unplugged and then press the power button

        if mode == "MOS":
            self.hard_shutdown(wait_for_board_off=False)
            return self.switch_on(simple_switch_mode=True)[0] == Global.SUCCESS
        else:
            return IntelDeviceBase.reboot(self, mode, wait_for_transition, transition_timeout, skip_failure, wait_settledown_duration)
Exemple #13
0
 def init_device_connection(self, skip_boot_required, first_power_cycle, power_cycle_retry_number):
     """
     Always skip initial reboot if necessary
     """
     return IntelDeviceBase.init_device_connection(self, True, first_power_cycle, power_cycle_retry_number)