def doit(k): if hasattr(dev.dev, 'pipe'): dev.send_recv(CCProtocolPacker.sim_keypress(k.encode('ascii'))) else: # try to use debug interface to simulate the press # XXX for some reason, picocom must **already** be running for this to work. # - otherwise, this locks up devs = list(glob.glob('/dev/tty.usbmodem*')) if len(devs) == 1: with open(devs[0], 'wb', 0) as fd: fd.write(k.encode('ascii')) else: # need actual user interaction print("NOW, on the Coldcard, press key: %s" % k)
def doit(k): if hasattr(dev.dev, 'pipe'): # simulator has special USB command dev.send_recv(CCProtocolPacker.sim_keypress(k.encode('ascii'))) elif request.config.getoption("--manual"): # need actual user interaction print("==> NOW, on the Coldcard, press key: %r" % k, file=sys.stderr) else: # try to use debug interface to simulate the press # XXX for some reason, picocom must **already** be running for this to work. # - otherwise, this locks up devs = list(glob.glob('/dev/tty.usbmodem*')) if len(devs) == 1: with open(devs[0], 'wb', 0) as fd: fd.write(k.encode('ascii')) else: raise pytest.fail('need to provide keypresses')