Minor tidy up of cli

This commit is contained in:
zvecr 2022-07-09 00:21:34 +01:00
parent 4d6336ccab
commit c155b16ec9
2 changed files with 3 additions and 3 deletions

View File

@ -191,7 +191,7 @@ class XAPShell(cmd.Cmd):
@cli.argument('-d', '--device', help='device to select - uses format <pid>:<vid>.') @cli.argument('-d', '--device', help='device to select - uses format <pid>:<vid>.')
@cli.argument('-l', '--list', arg_only=True, action='store_true', help='List available devices.') @cli.argument('-l', '--list', arg_only=True, action='store_true', help='List available devices.')
@cli.argument('-i', '--interactive', arg_only=True, action='store_true', help='Start interactive shell.') @cli.argument('-i', '--interactive', arg_only=True, action='store_true', help='Start interactive shell.')
@cli.argument('action', nargs='*', default=['listen'], arg_only=True) @cli.argument('action', nargs='*', arg_only=True, default=['listen'], help='Shell command and any arguments to run standalone')
@cli.subcommand('Acquire debugging information from usb XAP devices.', hidden=False if cli.config.user.developer else True) @cli.subcommand('Acquire debugging information from usb XAP devices.', hidden=False if cli.config.user.developer else True)
def xap(cli): def xap(cli):
"""Acquire debugging information from XAP devices """Acquire debugging information from XAP devices
@ -206,7 +206,7 @@ def xap(cli):
return False return False
dev = devices[0] dev = devices[0]
cli.log.info('Connecting to:%04x:%04x %s %s', dev['vendor_id'], dev['product_id'], dev['manufacturer_string'], dev['product_string']) cli.log.info('Connecting to: %04x:%04x %s %s', dev['vendor_id'], dev['product_id'], dev['manufacturer_string'], dev['product_string'])
device = XAPClient().connect(dev) device = XAPClient().connect(dev)
# shell? # shell?

View File

@ -67,7 +67,7 @@ class XAPDevice:
"""Background thread to signal waiting transactions """Background thread to signal waiting transactions
""" """
while 1: while 1:
array_alpha = self.dev.read(64, 100) array_alpha = self.dev.read(ResponseStruct.size, 100)
if array_alpha: if array_alpha:
token = int.from_bytes(array_alpha[:2], 'little') token = int.from_bytes(array_alpha[:2], 'little')
event = self.responses.get(token) event = self.responses.get(token)