예제 #1
0
 def __call__(self,
              image_bundle=None,
              images=None,
              bootargs=None,
              connect=True):
     self.target.hard_reset()
     with open_serial_connection(port=self.target.platform.serial_port,
                                 baudrate=self.target.platform.baudrate,
                                 timeout=self.timeout,
                                 init_dtr=0) as tty:
         # pylint: disable=no-member
         i = tty.expect(
             [self.mcc_prompt, AUTOSTART_MESSAGE, OLD_AUTOSTART_MESSAGE])
         if i:
             tty.sendline('')  # pylint: disable=no-member
         wait_for_vemsd(self.vemsd_mount, tty, self.mcc_prompt,
                        self.short_delay)
     try:
         if image_bundle:
             self._deploy_image_bundle(image_bundle)
         if images:
             self._overlay_images(images)
         os.system('sync')
     except (IOError, OSError) as e:
         msg = 'Could not deploy images to {}; got: {}'
         raise TargetStableError(msg.format(self.vemsd_mount, e))
     self.target.boot()
     if connect:
         self.target.connect(timeout=30)
예제 #2
0
    def _get_target_ip_address(self, target):
        with open_serial_connection(port=self.serial_port,
                                    baudrate=self.baudrate,
                                    timeout=30,
                                    init_dtr=0) as tty:
            tty.sendline('su')  # this is, apprently, required to query network device
                                # info by name on recent Juno builds...
            self.logger.debug('Waiting for the Android shell prompt.')
            tty.expect(target.shell_prompt)

            self.logger.debug('Waiting for IP address...')
            wait_start_time = time.time()
            try:
                while True:
                    tty.sendline('ip addr list eth0')
                    time.sleep(1)
                    try:
                        tty.expect(r'inet ([1-9]\d*.\d+.\d+.\d+)', timeout=10)
                        return tty.match.group(1)
                    except pexpect.TIMEOUT:
                        pass  # We have our own timeout -- see below.
                    if (time.time() - wait_start_time) > self.ready_timeout:
                        raise TargetTransientError('Could not acquire IP address.')
            finally:
                tty.sendline('exit')  # exit shell created by "su" call at the start
예제 #3
0
 def __call__(self):
     with open_serial_connection(port=self.port,
                                 baudrate=self.baudrate,
                                 timeout=self.timeout,
                                 init_dtr=0) as tty:
         self.get_through_early_boot(tty)
         self.perform_boot_sequence(tty)
         self.wait_for_android_prompt(tty)
예제 #4
0
파일: vexpress.py 프로젝트: BayLibre/devlib
 def __call__(self):
     with open_serial_connection(port=self.port,
                                 baudrate=self.baudrate,
                                 timeout=self.timeout,
                                 init_dtr=0) as tty:
         self.get_through_early_boot(tty)
         self.perform_boot_sequence(tty)
         self.wait_for_android_prompt(tty)
예제 #5
0
파일: vexpress.py 프로젝트: BayLibre/devlib
 def __call__(self):
     try:
         if self.target.is_connected:
             self.target.execute('sync')
     except TargetError:
         pass
     with open_serial_connection(port=self.port,
                                 baudrate=self.baudrate,
                                 timeout=self.timeout,
                                 init_dtr=0,
                                 get_conn=True) as (_, conn):
         pulse_dtr(conn, state=True, duration=0.1)  # TRM specifies a pulse of >=100ms
예제 #6
0
 def __call__(self):
     try:
         if self.target.is_connected:
             self.target.execute('sync')
     except TargetError:
         pass
     with open_serial_connection(port=self.port,
                                 baudrate=self.baudrate,
                                 timeout=self.timeout,
                                 init_dtr=0,
                                 get_conn=True) as (_, conn):
         pulse_dtr(conn, state=True,
                   duration=0.1)  # TRM specifies a pulse of >=100ms
예제 #7
0
    def perform_boot_sequence(self, tty):
        if self.uses_bootscript:
            return  # Will boot automatically

        time.sleep(self.short_delay)
        tty.expect(self.bootmon_prompt, timeout=self.timeout)
        with open_serial_connection(port=self.port,
                                    baudrate=self.baudrate,
                                    timeout=self.timeout,
                                    init_dtr=0) as tty:
            write_characters(tty, 'fl linux fdt {}'.format(self.fdt))
            write_characters(tty, 'fl linux initrd {}'.format(self.initrd))
            write_characters(
                tty, 'fl linux boot {} {}'.format(self.image, self.bootargs))
예제 #8
0
파일: vexpress.py 프로젝트: BayLibre/devlib
    def perform_boot_sequence(self, tty):
        if self.uses_bootscript:
            return  # Will boot automatically

        time.sleep(self.short_delay)
        tty.expect(self.bootmon_prompt, timeout=self.timeout)
        with open_serial_connection(port=self.port,
                                    baudrate=self.baudrate,
                                    timeout=self.timeout,
                                    init_dtr=0) as tty:
            write_characters(tty, 'fl linux fdt {}'.format(self.fdt))
            write_characters(tty, 'fl linux initrd {}'.format(self.initrd))
            write_characters(tty, 'fl linux boot {} {}'.format(self.image,
                                                               self.bootargs))
예제 #9
0
파일: vexpress.py 프로젝트: BayLibre/devlib
    def __call__(self):
        try:
            if self.target.is_connected:
                self.target.execute('sync')
        except TargetError:
            pass

        if not os.path.exists(self.path):
            self.logger.debug('{} does not exisit; attempting to mount...'.format(self.path))
            with open_serial_connection(port=self.port,
                                        baudrate=self.baudrate,
                                        timeout=self.timeout,
                                        init_dtr=0) as tty:
                wait_for_vemsd(self.path, tty, self.mcc_prompt, self.short_delay)
        with open(self.filepath, 'w'):
            pass
예제 #10
0
    def __call__(self):
        try:
            if self.target.is_connected:
                self.target.execute('sync')
        except TargetError:
            pass

        if not os.path.exists(self.path):
            self.logger.debug(
                '{} does not exisit; attempting to mount...'.format(self.path))
            with open_serial_connection(port=self.port,
                                        baudrate=self.baudrate,
                                        timeout=self.timeout,
                                        init_dtr=0) as tty:
                wait_for_vemsd(self.path, tty, self.mcc_prompt,
                               self.short_delay)
        with open(self.filepath, 'w'):
            pass
예제 #11
0
파일: vexpress.py 프로젝트: BayLibre/devlib
 def __call__(self, image_bundle=None, images=None, bootargs=None):
     self.target.hard_reset()
     with open_serial_connection(port=self.target.platform.serial_port,
                                 baudrate=self.target.platform.baudrate,
                                 timeout=self.timeout,
                                 init_dtr=0) as tty:
         i = tty.expect([self.mcc_prompt, AUTOSTART_MESSAGE])
         if i:
             tty.sendline('')
         wait_for_vemsd(self.vemsd_mount, tty, self.mcc_prompt, self.short_delay)
     try:
         if image_bundle:
             self._deploy_image_bundle(image_bundle)
         if images:
             self._overlay_images(images)
         os.system('sync')
     except (IOError, OSError), e:
         msg = 'Could not deploy images to {}; got: {}'
         raise TargetError(msg.format(self.vemsd_mount, e))
예제 #12
0
파일: arm.py 프로젝트: nuxeh/devlib
    def _get_target_ip_address(self, target):
        with open_serial_connection(port=self.serial_port,
                                    baudrate=self.baudrate,
                                    timeout=30,
                                    init_dtr=0) as tty:
            tty.sendline('')
            self.logger.debug('Waiting for the Android shell prompt.')
            tty.expect(target.shell_prompt)

            self.logger.debug('Waiting for IP address...')
            wait_start_time = time.time()
            while True:
                tty.sendline('ip addr list eth0')
                time.sleep(1)
                try:
                    tty.expect(r'inet ([1-9]\d*.\d+.\d+.\d+)', timeout=10)
                    return tty.match.group(1)
                except pexpect.TIMEOUT:
                    pass  # We have our own timeout -- see below.
                if (time.time() - wait_start_time) > self.ready_timeout:
                    raise TargetError('Could not acquire IP address.')
예제 #13
0
파일: arm.py 프로젝트: BayLibre/devlib
    def _get_target_ip_address(self, target):
        with open_serial_connection(port=self.serial_port,
                                    baudrate=self.baudrate,
                                    timeout=30,
                                    init_dtr=0) as tty:
            tty.sendline('')
            self.logger.debug('Waiting for the Android shell prompt.')
            tty.expect(target.shell_prompt)

            self.logger.debug('Waiting for IP address...')
            wait_start_time = time.time()
            while True:
                tty.sendline('ip addr list eth0')
                time.sleep(1)
                try:
                    tty.expect(r'inet ([1-9]\d*.\d+.\d+.\d+)', timeout=10)
                    return tty.match.group(1)
                except pexpect.TIMEOUT:
                    pass  # We have our own timeout -- see below.
                if (time.time() - wait_start_time) > self.ready_timeout:
                    raise TargetError('Could not acquire IP address.')
 def stop(self):
     with open_serial_connection(timeout=self.timeout,
                                 port=self.port,
                                 baudrate=self.baud) as target:
         target.sendline('motor_{}_0'.format(self.fan_pin))
예제 #15
0
파일: cooling.py 프로젝트: BayLibre/devlib
 def stop(self):
     with open_serial_connection(timeout=self.timeout,
                                 port=self.port,
                                 baudrate=self.baud) as target:
         target.sendline('motor_{}_0'.format(self.fan_pin))
예제 #16
0
 def start(self):
     with open_serial_connection(timeout=self.timeout,
                                 port=self.port,
                                 baudrate=self.baud) as target:
         # pylint: disable=no-member
         target.sendline('motor_{}_1'.format(self.fan_pin))