def stop_dfu(ignore_errors): """Stop U-Boot's dfu shell command from executing. This also waits for the host-side USB de-enumeration process to complete. Args: ignore_errors: Ignore any errors. This is useful if an error has already been detected, and the code is performing best-effort cleanup. In this case, we do not want to mask the original error by "honoring" any new errors. Returns: Nothing. """ try: u_boot_console.log.action( 'Stopping long-running U-Boot dfu shell command') u_boot_console.ctrlc() u_boot_console.log.action( 'Waiting for DFU USB device to disappear') u_boot_utils.wait_until_file_open_fails( env__usb_dev_port['host_usb_dev_node'], ignore_errors) except: if not ignore_errors: raise
def start_dfu(): """Start U-Boot's dfu shell command. This also waits for the host-side USB enumeration process to complete. Args: None. Returns: Nothing. """ u_boot_utils.wait_until_file_open_fails( env__usb_dev_port['host_usb_dev_node'], True) fh = u_boot_utils.attempt_to_open_file( env__usb_dev_port['host_usb_dev_node']) if fh: fh.close() raise Exception('USB device present before dfu command invoked') u_boot_console.log.action( 'Starting long-running U-Boot dfu shell command') cmd = 'setenv dfu_alt_info "%s"' % env__dfu_config['alt_info'] u_boot_console.run_command(cmd) cmd = 'dfu 0 ' + env__dfu_config['cmd_params'] u_boot_console.run_command(cmd, wait_for_prompt=False) u_boot_console.log.action('Waiting for DFU USB device to appear') fh = u_boot_utils.wait_until_open_succeeds( env__usb_dev_port['host_usb_dev_node']) fh.close()
def stop_ums(ignore_errors): """Stop U-Boot's ums shell command from executing. This also waits for the host-side USB de-enumeration process to complete. Args: ignore_errors: Ignore any errors. This is useful if an error has already been detected, and the code is performing best-effort cleanup. In this case, we do not want to mask the original error by "honoring" any new errors. Returns: Nothing. """ u_boot_console.log.action( 'Stopping long-running U-Boot ums shell command') u_boot_console.ctrlc() u_boot_utils.wait_until_file_open_fails(host_ums_part_node, ignore_errors)
def start_dfu(): """Start U-Boot's dfu shell command. This also waits for the host-side USB enumeration process to complete. Args: None. Returns: Nothing. """ u_boot_utils.wait_until_file_open_fails( env__usb_dev_port['host_usb_dev_node'], True) fh = u_boot_utils.attempt_to_open_file( env__usb_dev_port['host_usb_dev_node']) if fh: fh.close() raise Exception('USB device present before dfu command invoked') u_boot_console.log.action( 'Starting long-running U-Boot dfu shell command') dfu_alt_info_env = env__dfu_config.get('alt_info_env_name', \ 'dfu_alt_info') cmd = 'setenv "%s" "%s"' % (dfu_alt_info_env, env__dfu_config['alt_info']) u_boot_console.run_command(cmd) cmd = 'dfu 0 ' + env__dfu_config['cmd_params'] u_boot_console.run_command(cmd, wait_for_prompt=False) u_boot_console.log.action('Waiting for DFU USB device to appear') fh = u_boot_utils.wait_until_open_succeeds( env__usb_dev_port['host_usb_dev_node']) fh.close()