def main(argv): parser = get_parser() opts = parser.parse_args(argv) result = True # Let's make sure there's a tigertail # If nothing found in 5 seconds, fail. c.wait_for_usb(STM_VIDPID, 5.) pty = c.setup_tinyservod(STM_VIDPID, 0, serialno=opts.serialno) if opts.setserialno: try: c.do_serialno(opts.setserialno, pty) except Exception: result = False elif opts.mux: result &= do_mux(opts.mux, pty) elif opts.sysjump: result &= do_sysjump(opts.sysjump, pty) elif opts.reboot: result &= do_reboot(pty) if result: c.log('PASS') else: c.log('FAIL') exit(-1)
def main(argv): parser = get_parser() opts = parser.parse_args(argv) result = True # Let's make sure there's a tigertail # If nothing found in 5 seconds, fail. c.wait_for_usb(STM_VIDPID, timeout=5., serialname=opts.serialno) pty = c.setup_tinyservod(STM_VIDPID, 0, serialname=opts.serialno) if opts.bus not in ('vbus', 'cc1', 'cc2'): c.log('Try --bus [vbus|cc1|cc2]') result = False elif opts.setserialno: try: c.do_serialno(opts.setserialno, pty) except Exception: result = False elif opts.mux: result &= do_mux(opts.mux, pty) elif opts.sysjump: result &= do_sysjump(opts.sysjump, pty) elif opts.reboot: result &= do_reboot(pty) elif opts.check_version: result &= do_version(pty) elif opts.check_serial: result &= do_check_serial(pty) elif opts.power: result &= do_power(1, opts.bus, pty) elif opts.powerlog: result &= do_power(opts.powerlog, opts.bus, pty) if result: c.log('PASS') else: c.log('FAIL') exit(-1)
def connect(vidpid, iface, serialno, debuglog=False): """Connect to console. Args: vidpid: vidpid of desired device. iface: interface to connect. serialno: serial number, to differentiate multiple devices. debuglog: do chatty log. Returns: a connected pty object. """ # Make sure device is up. c.wait_for_usb(vidpid, serialname=serialno) # make a console. pty = c.setup_tinyservod(vidpid, iface, serialname=serialno, debuglog=debuglog) return pty