def connect_to_device(args): global fbc not_connected = True while not_connected: try: fbc = HbootClient(debug=args.debug) not_connected = False except Exception as e: time.sleep(1) return (True, 'OK')
def __init__(self, tty='/dev/ttyUSB0', fastboot_mode=True, debug=False): not_connected = True sys.stderr.write("Waiting for device...") sys.stderr.flush() while not_connected: try: self._client = HbootClient(tty, blocking_io=False, fastboot_mode=fastboot_mode, debug=debug) not_connected = False except Exception as e: time.sleep(1) sys.stderr.write("\r \r")