format
This commit is contained in:
parent
e7d9d6675c
commit
c9eae1d384
3 changed files with 15 additions and 12 deletions
|
@ -174,6 +174,9 @@ def xap(cli):
|
|||
keycode = _xap_transaction(device, 0x04, 0x02, 2, b"\x00\x00\x00")
|
||||
keycode = int.from_bytes(keycode, "little")
|
||||
keycode_map = {
|
||||
# TODO: this should be data driven...
|
||||
0x04: 'KC_A',
|
||||
0x05: 'KC_B',
|
||||
0x29: 'KC_ESCAPE'
|
||||
}
|
||||
print('keycode:' + keycode_map.get(keycode, 'unknown'))
|
||||
|
|
|
@ -114,7 +114,7 @@ def _append_route_capabilities(lines, container, container_id=None, route_stack=
|
|||
|
||||
|
||||
def _append_route_types(lines, container, container_id=None, route_stack=None):
|
||||
"""Handles creating
|
||||
"""Handles creating typedefs used by routes
|
||||
"""
|
||||
if route_stack is None:
|
||||
route_stack = [container]
|
||||
|
@ -126,7 +126,7 @@ def _append_route_types(lines, container, container_id=None, route_stack=None):
|
|||
# Inbound
|
||||
if 'request_struct_members' in container:
|
||||
request_struct_members = container['request_struct_members']
|
||||
lines.append(f'typedef struct {{')
|
||||
lines.append('typedef struct {')
|
||||
for member in request_struct_members:
|
||||
member_type = _get_c_type(member['type'])
|
||||
member_name = to_snake(member['name'])
|
||||
|
@ -141,7 +141,7 @@ def _append_route_types(lines, container, container_id=None, route_stack=None):
|
|||
qualifier = 'const' if 'return_constant' in container else ''
|
||||
if 'return_struct_members' in container:
|
||||
return_struct_members = container['return_struct_members']
|
||||
lines.append(f'typedef struct {{')
|
||||
lines.append('typedef struct {')
|
||||
for member in return_struct_members:
|
||||
member_type = _get_c_type(member['type'])
|
||||
member_name = f'{qualifier} {to_snake(member["name"])}'
|
||||
|
|
|
@ -46,14 +46,14 @@ uint32_t xap_route_qmk_ffffffffffffffff_getter(void) {
|
|||
}
|
||||
|
||||
bool xap_respond_get_info_json_chunk(xap_token_t token, const void *data, size_t length) {
|
||||
if(length != sizeof(uint16_t)){
|
||||
if (length != sizeof(uint16_t)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t offset = *((uint16_t*)data);
|
||||
xap_route_qmk_info_query_t ret = {0};
|
||||
uint16_t offset = *((uint16_t *)data);
|
||||
xap_route_qmk_info_query_t ret = {0};
|
||||
|
||||
bool get_info_json_chunk(uint16_t offset, uint8_t *data, uint8_t data_len);
|
||||
bool get_info_json_chunk(uint16_t offset, uint8_t * data, uint8_t data_len);
|
||||
get_info_json_chunk(offset, (uint8_t *)&ret, sizeof(ret));
|
||||
|
||||
return xap_respond_data(token, &ret, sizeof(ret));
|
||||
|
@ -67,7 +67,7 @@ bool xap_respond_get_info_json_chunk(xap_token_t token, const void *data, size_t
|
|||
#ifdef BOOTLOADER_JUMP_SUPPORTED
|
||||
bool xap_respond_request_bootloader_jump(xap_token_t token, const void *data, size_t length) {
|
||||
extern uint8_t secure_status;
|
||||
uint8_t ret = secure_status == 2;
|
||||
uint8_t ret = secure_status == 2;
|
||||
|
||||
// TODO: post to deferred queue so this request can return?
|
||||
bool res = xap_respond_data(token, &ret, sizeof(ret));
|
||||
|
@ -78,22 +78,22 @@ bool xap_respond_request_bootloader_jump(xap_token_t token, const void *data, si
|
|||
|
||||
#if ((defined(DYNAMIC_KEYMAP_ENABLE)))
|
||||
bool xap_respond_dynamic_keymap_get_keycode(xap_token_t token, const void *data, size_t length) {
|
||||
if(length != sizeof(xap_route_dynamic_keymap_get_keymap_keycode_arg_t)){
|
||||
if (length != sizeof(xap_route_dynamic_keymap_get_keymap_keycode_arg_t)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
xap_route_dynamic_keymap_get_keymap_keycode_arg_t* arg = (xap_route_dynamic_keymap_get_keymap_keycode_arg_t*)data;
|
||||
xap_route_dynamic_keymap_get_keymap_keycode_arg_t *arg = (xap_route_dynamic_keymap_get_keymap_keycode_arg_t *)data;
|
||||
|
||||
uint16_t keycode = dynamic_keymap_get_keycode(arg->layer, arg->row, arg->column);
|
||||
return xap_respond_data(token, &keycode, sizeof(keycode));
|
||||
}
|
||||
|
||||
bool xap_respond_dynamic_keymap_set_keycode(xap_token_t token, const void *data, size_t length) {
|
||||
if(length != sizeof(xap_route_dynamic_keymap_set_keymap_keycode_arg_t)){
|
||||
if (length != sizeof(xap_route_dynamic_keymap_set_keymap_keycode_arg_t)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
xap_route_dynamic_keymap_set_keymap_keycode_arg_t* arg = (xap_route_dynamic_keymap_set_keymap_keycode_arg_t*)data;
|
||||
xap_route_dynamic_keymap_set_keymap_keycode_arg_t *arg = (xap_route_dynamic_keymap_set_keymap_keycode_arg_t *)data;
|
||||
|
||||
dynamic_keymap_set_keycode(arg->layer, arg->row, arg->column, arg->keycode);
|
||||
xap_respond_success(token);
|
||||
|
|
Loading…
Reference in a new issue