diff --git a/builddefs/xap.mk b/builddefs/xap.mk index 8fbda7c4488..f08d774297f 100644 --- a/builddefs/xap.mk +++ b/builddefs/xap.mk @@ -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) diff --git a/keyboards/zvecr/zv48/keymaps/xap/xap.hjson b/keyboards/zvecr/zv48/keymaps/xap/xap.hjson new file mode 100644 index 00000000000..c406625ccd9 --- /dev/null +++ b/keyboards/zvecr/zv48/keymaps/xap/xap.hjson @@ -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 + } + } +} \ No newline at end of file diff --git a/keyboards/zvecr/zv48/xap.hjson b/keyboards/zvecr/zv48/xap.hjson new file mode 100644 index 00000000000..5da9efc3ecc --- /dev/null +++ b/keyboards/zvecr/zv48/xap.hjson @@ -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 + } + } +} \ No newline at end of file diff --git a/lib/python/qmk/xap/common.py b/lib/python/qmk/xap/common.py index c28f9bea2be..f3f371cdd8e 100755 --- a/lib/python/qmk/xap/common.py +++ b/lib/python/qmk/xap/common.py @@ -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 """