Align filenames

This commit is contained in:
zvecr 2022-05-23 02:14:42 +01:00
parent e04e31cde7
commit f2d56f5ca1
4 changed files with 68 additions and 34 deletions

View file

@ -8,23 +8,23 @@ $(KEYMAP_OUTPUT)/src/info_json_gz.h: $(INFO_JSON_FILES)
@$(BUILD_CMD)
XAP_FILES := $(shell ls -1 data/xap/* | sort | xargs echo)
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/xap.json)","")
XAP_FILES += $(KEYBOARD_PATH_1)/xap.json
ifneq ("$(wildcard $(KEYBOARD_PATH_1)/xap.hjson)","")
XAP_FILES += $(KEYBOARD_PATH_1)/xap.hjson
endif
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/xap.json)","")
XAP_FILES += $(KEYBOARD_PATH_2)/xap.json
ifneq ("$(wildcard $(KEYBOARD_PATH_2)/xap.hjson)","")
XAP_FILES += $(KEYBOARD_PATH_2)/xap.hjson
endif
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/xap.json)","")
XAP_FILES += $(KEYBOARD_PATH_3)/xap.json
ifneq ("$(wildcard $(KEYBOARD_PATH_3)/xap.hjson)","")
XAP_FILES += $(KEYBOARD_PATH_3)/xap.hjson
endif
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/xap.json)","")
XAP_FILES += $(KEYBOARD_PATH_4)/xap.json
ifneq ("$(wildcard $(KEYBOARD_PATH_4)/xap.hjson)","")
XAP_FILES += $(KEYBOARD_PATH_4)/xap.hjson
endif
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/xap.json)","")
XAP_FILES += $(KEYBOARD_PATH_5)/xap.json
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/xap.hjson)","")
XAP_FILES += $(KEYBOARD_PATH_5)/xap.hjson
endif
ifneq ("$(wildcard $(KEYMAP_PATH)/xap.json)","")
XAP_FILES += $(KEYMAP_PATH)/xap.json
ifneq ("$(wildcard $(KEYMAP_PATH)/xap.hjson)","")
XAP_FILES += $(KEYMAP_PATH)/xap.hjson
endif
$(KEYMAP_OUTPUT)/src/xap_generated.inl: $(XAP_FILES)

View file

@ -0,0 +1,16 @@
{
routes: {
0x01: {
type: command
name: Capabilities Query
define: CAPABILITIES_QUERY_USER
description:
'''
USER subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.
'''
return_type: u32
return_purpose: capabilities
return_constant: XAP_ROUTE_USER_CAPABILITIES
}
}
}

View file

@ -0,0 +1,16 @@
{
routes: {
0x01: {
type: command
name: Capabilities Query
define: CAPABILITIES_QUERY_KB
description:
'''
KB subsystem capabilities query. Each bit should be considered as a "usable" route within this subsystem.
'''
return_type: u32
return_purpose: capabilities
return_constant: XAP_ROUTE_KB_CAPABILITIES
}
}
}

View file

@ -12,6 +12,8 @@ from qmk.decorators import lru_cache
from qmk.keymap import locate_keymap
from qmk.path import keyboard
XAP_SPEC = 'xap.hjson'
def _get_jinja2_env(data_templates_xap_subdir: str):
templates_dir = os.path.join(QMK_FIRMWARE, 'data', 'templates', 'xap', data_templates_xap_subdir)
@ -24,6 +26,28 @@ def render_xap_output(data_templates_xap_subdir, file_to_render, defs):
return j2.get_template(file_to_render).render(xap=defs, xap_str=hjson.dumps(defs))
def _find_kb_spec(kb):
base_path = Path('keyboards')
keyboard_parent = keyboard(kb)
for _ in range(5):
if keyboard_parent == base_path:
break
spec = keyboard_parent / XAP_SPEC
if spec.exists():
return spec
keyboard_parent = keyboard_parent.parent
# Just return something we know doesn't exist
return keyboard(kb) / XAP_SPEC
def _find_km_spec(kb, km):
return locate_keymap(kb, km).parent / XAP_SPEC
def _merge_ordered_dicts(dicts):
"""Merges nested OrderedDict objects resulting from reading a hjson file.
@ -98,28 +122,6 @@ def latest_xap_defs():
return get_xap_defs('latest')
def _find_kb_spec(kb):
base_path = Path('keyboards')
keyboard_parent = keyboard(kb)
for _ in range(5):
if keyboard_parent == base_path:
break
spec = keyboard_parent / 'xap.json'
if spec.exists():
return spec
keyboard_parent = keyboard_parent.parent
# Just return something we know doesn't exist
return keyboard(kb) / 'xap.json'
def _find_km_spec(kb, km):
return locate_keymap(kb, km).parent / 'xap.json'
def merge_xap_defs(kb, km):
"""Gets the latest version of the XAP definitions and merges in optional keyboard/keymap specs
"""