Add route for hardware_id
This commit is contained in:
parent
81cce42118
commit
1d96fc866d
4 changed files with 26 additions and 2 deletions
|
@ -35,6 +35,9 @@ def print_dotted_output(kb_info_json, prefix=''):
|
|||
continue
|
||||
elif key == 'layouts' and prefix == '':
|
||||
cli.echo(' {fg_blue}layouts{fg_reset}: %s', ', '.join(sorted(kb_info_json['layouts'].keys())))
|
||||
elif isinstance(kb_info_json[key], bytes):
|
||||
conv = "".join(["{:02X}".format(b) for b in kb_info_json[key]])
|
||||
cli.echo(' {fg_blue}%s{fg_reset}: %s', new_prefix, conv)
|
||||
elif isinstance(kb_info_json[key], dict):
|
||||
print_dotted_output(kb_info_json[key], new_prefix)
|
||||
elif isinstance(kb_info_json[key], list):
|
||||
|
@ -105,6 +108,10 @@ def _query_device(device):
|
|||
return {'xap': ver, 'secure': secure}
|
||||
|
||||
|
||||
def _query_device_id(device):
|
||||
return _xap_transaction(device, 0x01, 0x08)
|
||||
|
||||
|
||||
def _query_device_info_len(device):
|
||||
len_data = _xap_transaction(device, 0x01, 0x05)
|
||||
if not len_data:
|
||||
|
@ -146,6 +153,7 @@ def _list_devices():
|
|||
if cli.config.general.verbose:
|
||||
# TODO: better formatting like "lsusb -v"?
|
||||
data = _query_device_info(device)
|
||||
data["_id"] = _query_device_id(device)
|
||||
print_dotted_output(data)
|
||||
|
||||
|
||||
|
|
|
@ -150,8 +150,10 @@ def _append_route_types(lines, container, container_id=None, route_stack=None):
|
|||
|
||||
elif 'return_type' in container:
|
||||
return_type = container['return_type']
|
||||
if return_type == 'u8[32]':
|
||||
lines.append(f'typedef struct {{ uint8_t x[32]; }} {route_name}_t;')
|
||||
found = re.search(r'(u\d+)\[(\d+)\]', return_type)
|
||||
if found:
|
||||
return_type, size = found.groups()
|
||||
lines.append(f'typedef struct {{ {_get_c_type(return_type)} x[{size}]; }} {route_name}_t;')
|
||||
else:
|
||||
lines.append(f'typedef {_get_c_type(return_type)} {route_name}_t;')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue