From fc0d51384d7772d9e26594f4cbc276d7fcfe0a49 Mon Sep 17 00:00:00 2001 From: Zach White Date: Tue, 1 Dec 2020 12:52:02 -0800 Subject: [PATCH 01/14] validate keyboard data with jsonschema --- lib/python/qmk/cli/generate/info_json.py | 2 +- lib/python/qmk/cli/generate/rules_mk.py | 13 ++ lib/python/qmk/info.py | 151 +++++++++++++++++++++-- requirements.txt | 1 + 4 files changed, 155 insertions(+), 12 deletions(-) diff --git a/lib/python/qmk/cli/generate/info_json.py b/lib/python/qmk/cli/generate/info_json.py index 7e6654e45d47..fba4b1c01400 100755 --- a/lib/python/qmk/cli/generate/info_json.py +++ b/lib/python/qmk/cli/generate/info_json.py @@ -39,7 +39,7 @@ def generate_info_json(cli): pared_down_json[key] = kb_info_json[key] pared_down_json['layouts'] = {} - if 'layouts' in pared_down_json: + if 'layouts' in kb_info_json: for layout_name, layout in kb_info_json['layouts'].items(): pared_down_json['layouts'][layout_name] = {} pared_down_json['layouts'][layout_name]['key_count'] = layout.get('key_count', len(layout['layout'])) diff --git a/lib/python/qmk/cli/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py index 4268ae047b41..72ed3c45fa47 100755 --- a/lib/python/qmk/cli/generate/rules_mk.py +++ b/lib/python/qmk/cli/generate/rules_mk.py @@ -6,6 +6,10 @@ from qmk.info import info_json from qmk.path import is_keyboard, normpath +info_to_rules = { + 'bootloader': 'BOOTLOADER', + 'processor': 'MCU' +} @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") @@ -30,6 +34,10 @@ def generate_rules_mk(cli): kb_info_json = info_json(cli.config.generate_rules_mk.keyboard) rules_mk_lines = ['# This file was generated by `qmk generate-rules-mk`. Do not edit or copy.', ''] + # Bring in settings + for info_key, rule_key in info_to_rules.items(): + rules_mk_lines.append(f'{rule_key} := {kb_info_json[info_key]}') + # Find features that should be enabled if 'features' in kb_info_json: for feature, enabled in kb_info_json['features'].items(): @@ -37,6 +45,11 @@ def generate_rules_mk(cli): enabled = 'yes' if enabled else 'no' rules_mk_lines.append(f'{feature}_ENABLE := {enabled}') + # Set the LED driver + if 'led_matrix' in kb_info_json and 'driver' in kb_info_json['led_matrix']: + driver = kb_info_json['led_matrix']['driver'] + rules_mk_lines.append(f'LED_MATRIX_DRIVER = {driver}') + # Add community layouts if 'community_layouts' in kb_info_json: rules_mk_lines.append(f'LAYOUTS = {" ".join(kb_info_json["community_layouts"])}') diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 4611874e85ce..1cf12190d6cb 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -4,6 +4,7 @@ from glob import glob from pathlib import Path +import jsonschema from milc import cli from qmk.constants import CHIBIOS_PROCESSORS, LUFA_PROCESSORS, VUSB_PROCESSORS, LED_INDICATORS @@ -13,6 +14,17 @@ from qmk.makefile import parse_rules_mk_file from qmk.math import compute +led_matrix_properties = { + 'driver_count': 'LED_DRIVER_COUNT', + 'driver_addr1': 'LED_DRIVER_ADDR_1', + 'driver_addr2': 'LED_DRIVER_ADDR_2', + 'driver_addr3': 'LED_DRIVER_ADDR_3', + 'driver_addr4': 'LED_DRIVER_ADDR_4', + 'led_count': 'LED_DRIVER_LED_COUNT', + 'timeout': 'ISSI_TIMEOUT', + 'persistence': 'ISSI_PERSISTENCE' +} + rgblight_properties = { 'led_count': 'RGBLED_NUM', 'pin': 'RGB_DI_PIN', @@ -80,6 +92,15 @@ def info_json(keyboard): info_data = _extract_config_h(info_data) info_data = _extract_rules_mk(info_data) + # Validate against the jsonschema + try: + keyboard_api_validate(info_data) + + except jsonschema.ValidationError as e: + cli.log.error('Invalid info.json data: %s', e.message) + print(dir(e)) + exit() + # Make sure we have at least one layout if not info_data.get('layouts'): _log_error(info_data, 'No LAYOUTs defined! Need at least one layout defined in the keyboard.h or info.json.') @@ -102,6 +123,50 @@ def info_json(keyboard): return info_data +def _json_load(json_file): + """Load a json file from disk. + + Note: file must be a Path object. + """ + try: + return json.load(json_file.open()) + + except json.decoder.JSONDecodeError as e: + cli.log.error('Invalid JSON encountered attempting to load {fg_cyan}%s{fg_reset}:\n\t{fg_red}%s', json_file, e) + exit(1) + + +def _jsonschema(schema_name): + """Read a jsonschema file from disk. + """ + schema_path = Path(f'data/schemas/{schema_name}.jsonschema') + + if not schema_path.exists(): + schema_path = Path('data/schemas/false.jsonschema') + + return _json_load(schema_path) + + +def keyboard_validate(data): + """Validates data against the keyboard jsonschema. + """ + schema = _jsonschema('keyboard') + validator = jsonschema.Draft7Validator(schema).validate + + return validator(data) + + +def keyboard_api_validate(data): + """Validates data against the api_keyboard jsonschema. + """ + base = _jsonschema('keyboard') + relative = _jsonschema('api_keyboard') + resolver = jsonschema.RefResolver.from_schema(base) + validator = jsonschema.Draft7Validator(relative, resolver=resolver).validate + + return validator(data) + + def _extract_debounce(info_data, config_c): """Handle debounce. """ @@ -109,7 +174,7 @@ def _extract_debounce(info_data, config_c): _log_warning(info_data, 'Debounce is specified in both info.json and config.h, the config.h value wins.') if 'DEBOUNCE' in config_c: - info_data['debounce'] = config_c.get('DEBOUNCE') + info_data['debounce'] = int(config_c['DEBOUNCE']) return info_data @@ -181,8 +246,36 @@ def _extract_features(info_data, rules): return info_data +def _extract_led_drivers(info_data, rules): + """Find all the LED drivers set in rules.mk. + """ + if 'LED_MATRIX_DRIVER' in rules: + if 'led_matrix' not in info_data: + info_data['led_matrix'] = {} + + if info_data['led_matrix'].get('driver'): + _log_warning(info_data, 'LED Matrix driver is specified in both info.json and rules.mk, the rules.mk value wins.') + + info_data['led_matrix']['driver'] = rules['LED_MATRIX_DRIVER'] + + return info_data + + +def _extract_led_matrix(info_data, config_c): + """Handle the led_matrix configuration. + """ + led_matrix = info_data.get('led_matrix', {}) + + for json_key, config_key in led_matrix_properties.items(): + if config_key in config_c: + if json_key in led_matrix: + _log_warning(info_data, 'LED Matrix: %s is specified in both info.json and config.h, the config.h value wins.' % (json_key,)) + + led_matrix[json_key] = config_c[config_key] + + def _extract_rgblight(info_data, config_c): - """Handle the rgblight configuration + """Handle the rgblight configuration. """ rgblight = info_data.get('rgblight', {}) animations = rgblight.get('animations', {}) @@ -303,6 +396,7 @@ def _extract_config_h(info_data): _extract_indicators(info_data, config_c) _extract_matrix_info(info_data, config_c) _extract_usb_info(info_data, config_c) + _extract_led_matrix(info_data, config_c) _extract_rgblight(info_data, config_c) return info_data @@ -326,6 +420,7 @@ def _extract_rules_mk(info_data): _extract_community_layouts(info_data, rules) _extract_features(info_data, rules) + _extract_led_drivers(info_data, rules) return info_data @@ -412,13 +507,28 @@ def arm_processor_rules(info_data, rules): """Setup the default info for an ARM board. """ info_data['processor_type'] = 'arm' - info_data['bootloader'] = rules['BOOTLOADER'] if 'BOOTLOADER' in rules else 'unknown' - info_data['processor'] = rules['MCU'] if 'MCU' in rules else 'unknown' info_data['protocol'] = 'ChibiOS' - if info_data['bootloader'] == 'unknown': + if 'MCU' in rules: + if 'processor' in info_data: + _log_warning(info_data, 'Processor/MCU is specified in both info.json and rules.mk, the rules.mk value wins.') + + info_data['processor'] = rules['MCU'] + + elif 'processor' not in info_data: + info_data['processor'] = 'unknown' + + if 'BOOTLOADER' in rules: + if 'bootloader' in info_data: + _log_warning(info_data, 'Bootloader is specified in both info.json and rules.mk, the rules.mk value wins.') + + info_data['bootloader'] = rules['BOOTLOADER'] + + else: if 'STM32' in info_data['processor']: info_data['bootloader'] = 'stm32-dfu' + else: + info_data['bootloader'] = 'unknown' if 'STM32' in info_data['processor']: info_data['platform'] = 'STM32' @@ -436,9 +546,25 @@ def avr_processor_rules(info_data, rules): info_data['processor_type'] = 'avr' info_data['bootloader'] = rules['BOOTLOADER'] if 'BOOTLOADER' in rules else 'atmel-dfu' info_data['platform'] = rules['ARCH'] if 'ARCH' in rules else 'unknown' - info_data['processor'] = rules['MCU'] if 'MCU' in rules else 'unknown' info_data['protocol'] = 'V-USB' if rules.get('MCU') in VUSB_PROCESSORS else 'LUFA' + if 'MCU' in rules: + if 'processor' in info_data: + _log_warning(info_data, 'Processor/MCU is specified in both info.json and rules.mk, the rules.mk value wins.') + + info_data['processor'] = rules['MCU'] + + elif 'processor' not in info_data: + info_data['processor'] = 'unknown' + + if 'BOOTLOADER' in rules: + if 'bootloader' in info_data: + _log_warning(info_data, 'Bootloader is specified in both info.json and rules.mk, the rules.mk value wins.') + + info_data['bootloader'] = rules['BOOTLOADER'] + else: + info_data['bootloader'] = 'atmel-dfu' + # FIXME(fauxpark/anyone): Eventually we should detect the protocol by looking at PROTOCOL inherited from mcu_selection.mk: # info_data['protocol'] = 'V-USB' if rules.get('PROTOCOL') == 'VUSB' else 'LUFA' @@ -463,10 +589,13 @@ def merge_info_jsons(keyboard, info_data): for info_file in find_info_json(keyboard): # Load and validate the JSON data try: - new_info_data = json.load(info_file.open('r')) - except Exception as e: - _log_error(info_data, "Invalid JSON in file %s: %s: %s" % (str(info_file), e.__class__.__name__, e)) - new_info_data = {} + new_info_data = _json_load(info_file) + keyboard_validate(new_info_data) + + except jsonschema.ValidationError as e: + cli.log.error('Invalid info.json data: %s', e.message) + cli.log.error('Not including file %s', info_file) + continue if not isinstance(new_info_data, dict): _log_error(info_data, "Invalid file %s, root object should be a dictionary." % (str(info_file),)) @@ -479,7 +608,7 @@ def merge_info_jsons(keyboard, info_data): # Deep merge certain keys # FIXME(skullydazed/anyone): this should be generalized more so that we can inteligently merge more than one level deep. It would be nice if we could filter on valid keys too. That may have to wait for a future where we use openapi or something. - for key in ('features', 'layout_aliases', 'matrix_pins', 'rgblight', 'usb'): + for key in ('features', 'layout_aliases', 'led_matrix', 'matrix_pins', 'rgblight', 'usb'): if key in new_info_data: if key not in info_data: info_data[key] = {} diff --git a/requirements.txt b/requirements.txt index 6e907cf8e83c..f4d43da8d63b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,6 @@ appdirs argcomplete colorama hjson +jsonschema milc pygments From 04f702ea435afb0696e623d3af47a44c63acb1e0 Mon Sep 17 00:00:00 2001 From: Zach White Date: Tue, 1 Dec 2020 12:52:26 -0800 Subject: [PATCH 02/14] cleanup clueboard based on latest validation work --- keyboards/clueboard/17/info.json | 9 +++++---- keyboards/clueboard/17/rules.mk | 13 ------------- keyboards/clueboard/2x1800/2018/info.json | 16 +++++++++------- keyboards/clueboard/2x1800/2018/rules.mk | 13 +------------ keyboards/clueboard/2x1800/2019/info.json | 4 +++- keyboards/clueboard/2x1800/2019/rules.mk | 13 +------------ keyboards/clueboard/60/info.json | 3 ++- keyboards/clueboard/60/rules.mk | 2 -- keyboards/clueboard/66/rev1/info.json | 15 ++++++++------- keyboards/clueboard/66/rev1/rules.mk | 13 +------------ keyboards/clueboard/66/rev2/info.json | 15 ++++++++------- keyboards/clueboard/66/rev2/rules.mk | 13 ------------- keyboards/clueboard/66/rev3/info.json | 15 ++++++++------- keyboards/clueboard/66/rev3/rules.mk | 13 ------------- keyboards/clueboard/66/rev4/info.json | 15 ++++++++------- keyboards/clueboard/66/rev4/rules.mk | 3 +-- keyboards/clueboard/66_hotswap/gen1/info.json | 12 ++++++++---- keyboards/clueboard/66_hotswap/gen1/rules.mk | 2 -- .../clueboard/66_hotswap/prototype/info.json | 15 ++++++++------- .../clueboard/66_hotswap/prototype/rules.mk | 13 ------------- keyboards/clueboard/california/info.json | 8 ++++++++ keyboards/clueboard/california/rules.mk | 12 +----------- keyboards/clueboard/card/info.json | 15 ++++++++------- keyboards/clueboard/card/rules.mk | 13 ------------- 24 files changed, 88 insertions(+), 177 deletions(-) diff --git a/keyboards/clueboard/17/info.json b/keyboards/clueboard/17/info.json index 46510c48c0c1..47260572e641 100644 --- a/keyboards/clueboard/17/info.json +++ b/keyboards/clueboard/17/info.json @@ -5,6 +5,7 @@ "height": 5, "width": 4, "diode_direction": "COL2ROW", + "processor": "atmega32u4", "features": { "backlight": true, "bootmagic": false, @@ -25,11 +26,11 @@ "animations": { "all": true }, - "brightness_steps": "17", - "hue_steps": "10", - "led_count": "4", + "brightness_steps": 17, + "hue_steps": 10, + "led_count": 4, "pin": "F6", - "saturation_steps": "17" + "saturation_steps": 17 }, "url": "", "usb": { diff --git a/keyboards/clueboard/17/rules.mk b/keyboards/clueboard/17/rules.mk index 75fb718e33de..d2e52d56b5b9 100644 --- a/keyboards/clueboard/17/rules.mk +++ b/keyboards/clueboard/17/rules.mk @@ -1,15 +1,2 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp -BOOTLOADER = atmel-dfu - # Build Options BACKLIGHT_DRIVER = custom diff --git a/keyboards/clueboard/2x1800/2018/info.json b/keyboards/clueboard/2x1800/2018/info.json index b671174076bc..878b24ce178d 100644 --- a/keyboards/clueboard/2x1800/2018/info.json +++ b/keyboards/clueboard/2x1800/2018/info.json @@ -4,7 +4,9 @@ "maintainer": "skullydazed", "height": 6.5, "width": 24, - "debounce": "5", + "processor": "at90usb1286", + "bootloader": "halfkay", + "debounce": 5, "diode_direction": "ROW2COL", "features": { "audio": true, @@ -24,18 +26,18 @@ "scroll_lock": "B6" }, "matrix_pins": { - "cols": ["D2", " D3", " D4", " D5", " D7", " E0", " E1", " B0", " E6", " B3", " B2"], - "rows": ["C0", " C1", " C2", " C3", " C7", " F7", " B1", " F2", " F3", " F4", " F5", " F6"] + "cols": ["D2", "D3", "D4", "D5", "D7", "E0", "E1", "B0", "E6", "B3", "B2"], + "rows": ["C0", "C1", "C2", "C3", "C7", "F7", "B1", "F2", "F3", "F4", "F5", "F6"] }, "rgblight": { "animations": { "all": true }, - "brightness_steps": "8", - "hue_steps": "8", - "led_count": "16", + "brightness_steps": 8, + "hue_steps": 8, + "led_count": 16, "pin": "C6", - "saturation_steps": "8" + "saturation_steps": 8 }, "usb": { "pid": "0x23A0" diff --git a/keyboards/clueboard/2x1800/2018/rules.mk b/keyboards/clueboard/2x1800/2018/rules.mk index c421eb862e9c..6e7633bfe015 100644 --- a/keyboards/clueboard/2x1800/2018/rules.mk +++ b/keyboards/clueboard/2x1800/2018/rules.mk @@ -1,12 +1 @@ -# MCU name -MCU = at90usb1286 - -# Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp -BOOTLOADER = halfkay +# This file intentionally left blank diff --git a/keyboards/clueboard/2x1800/2019/info.json b/keyboards/clueboard/2x1800/2019/info.json index 96af671a8bb0..26185b7a4822 100644 --- a/keyboards/clueboard/2x1800/2019/info.json +++ b/keyboards/clueboard/2x1800/2019/info.json @@ -4,7 +4,9 @@ "maintainer": "skullydazed", "height": 8, "width": 24, - "debounce": "5", + "debounce": 5, + "processor": "at90usb1286", + "bootloader": "halfkay", "diode_direction": "ROW2COL", "features": { "audio": true, diff --git a/keyboards/clueboard/2x1800/2019/rules.mk b/keyboards/clueboard/2x1800/2019/rules.mk index c421eb862e9c..6e7633bfe015 100644 --- a/keyboards/clueboard/2x1800/2019/rules.mk +++ b/keyboards/clueboard/2x1800/2019/rules.mk @@ -1,12 +1 @@ -# MCU name -MCU = at90usb1286 - -# Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp -BOOTLOADER = halfkay +# This file intentionally left blank diff --git a/keyboards/clueboard/60/info.json b/keyboards/clueboard/60/info.json index 1df0512ad3dd..2da993437c48 100644 --- a/keyboards/clueboard/60/info.json +++ b/keyboards/clueboard/60/info.json @@ -4,7 +4,8 @@ "maintainer": "skullydazed", "height": 5, "width": 15, - "debounce": "6", + "debounce": 6, + "processor": "STM32F303", "diode_direction": "COL2ROW", "features": { "audio": true, diff --git a/keyboards/clueboard/60/rules.mk b/keyboards/clueboard/60/rules.mk index 7e85acec6552..6bc7eb7619f8 100644 --- a/keyboards/clueboard/60/rules.mk +++ b/keyboards/clueboard/60/rules.mk @@ -1,5 +1,3 @@ -# MCU name -MCU = STM32F303 BOARD = QMK_PROTON_C # project specific files diff --git a/keyboards/clueboard/66/rev1/info.json b/keyboards/clueboard/66/rev1/info.json index f67e5baf75e8..beb83b5e654e 100644 --- a/keyboards/clueboard/66/rev1/info.json +++ b/keyboards/clueboard/66/rev1/info.json @@ -4,7 +4,8 @@ "maintainer": "skullydazed", "height": 5, "width": 16.5, - "debounce": "5", + "processor": "atmega32u4", + "debounce": 5, "diode_direction": "COL2ROW", "features": { "audio": false, @@ -24,18 +25,18 @@ "caps_lock": "F0" }, "matrix_pins": { - "cols": ["B3", " F1", " F4", " F5", " F6", " C7", " C6", " B6", " B5", " B4", " D7", " D6", " D4", " F7", " B0", " B1"], - "rows": ["D1", " D0", " D2", " D5", " D3"] + "cols": ["B3", "F1", "F4", "F5", "F6", "C7", "C6", "B6", "B5", "B4", "D7", "D6", "D4", "F7", "B0", "B1"], + "rows": ["D1", "D0", "D2", "D5", "D3"] }, "rgblight": { "animations": { "all": true }, - "brightness_steps": "17", - "hue_steps": "10", - "led_count": "14", + "brightness_steps": 17, + "hue_steps": 10, + "led_count": 14, "pin": "B2", - "saturation_steps": "17" + "saturation_steps": 17 }, "usb": { "device_ver": "0x0001", diff --git a/keyboards/clueboard/66/rev1/rules.mk b/keyboards/clueboard/66/rev1/rules.mk index 2f20507d4ddd..6e7633bfe015 100644 --- a/keyboards/clueboard/66/rev1/rules.mk +++ b/keyboards/clueboard/66/rev1/rules.mk @@ -1,12 +1 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp -BOOTLOADER = atmel-dfu +# This file intentionally left blank diff --git a/keyboards/clueboard/66/rev2/info.json b/keyboards/clueboard/66/rev2/info.json index 4560ec7e8d00..603558de829d 100644 --- a/keyboards/clueboard/66/rev2/info.json +++ b/keyboards/clueboard/66/rev2/info.json @@ -4,7 +4,8 @@ "maintainer": "skullydazed", "height": 5, "width": 16.5, - "debounce": "5", + "processor": "atmega32u4", + "debounce": 5, "diode_direction": "COL2ROW", "features": { "audio": false, @@ -24,18 +25,18 @@ "caps_lock": "B4" }, "matrix_pins": { - "cols": ["F0", " F1", " F4", " F5", " F6", " F7", " E6", " B1"], - "rows": ["B2", " C7", " C6", " B6", " B5", " B0", " B3", " D5", " D3", " D2"] + "cols": ["F0", "F1", "F4", "F5", "F6", "F7", "E6", "B1"], + "rows": ["B2", "C7", "C6", "B6", "B5", "B0", "B3", "D5", "D3", "D2"] }, "rgblight": { "animations": { "all": true }, - "brightness_steps": "17", - "hue_steps": "32", - "led_count": "14", + "brightness_steps": 17, + "hue_steps": 32, + "led_count": 14, "pin": "D7", - "saturation_steps": "17" + "saturation_steps": 17 }, "usb": { "device_ver": "0x0001", diff --git a/keyboards/clueboard/66/rev2/rules.mk b/keyboards/clueboard/66/rev2/rules.mk index 75fb718e33de..d2e52d56b5b9 100644 --- a/keyboards/clueboard/66/rev2/rules.mk +++ b/keyboards/clueboard/66/rev2/rules.mk @@ -1,15 +1,2 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp -BOOTLOADER = atmel-dfu - # Build Options BACKLIGHT_DRIVER = custom diff --git a/keyboards/clueboard/66/rev3/info.json b/keyboards/clueboard/66/rev3/info.json index 4b9694a2bfb3..d3b13bed7ad6 100644 --- a/keyboards/clueboard/66/rev3/info.json +++ b/keyboards/clueboard/66/rev3/info.json @@ -4,7 +4,8 @@ "maintainer": "skullydazed", "height": 5, "width": 16.5, - "debounce": "5", + "processor": "atmega32u4", + "debounce": 5, "diode_direction": "COL2ROW", "features": { "audio": false, @@ -24,18 +25,18 @@ "caps_lock": "B4" }, "matrix_pins": { - "cols": ["F0", " F1", " F4", " F5", " F6", " F7", " E6", " B1"], - "rows": ["B2", " C7", " C6", " B6", " B5", " B0", " B3", " D5", " D3", " D2"] + "cols": ["F0", "F1", "F4", "F5", "F6", "F7", "E6", "B1"], + "rows": ["B2", "C7", "C6", "B6", "B5", "B0", "B3", "D5", "D3", "D2"] }, "rgblight": { "animations": { "all": true }, - "brightness_steps": "17", - "hue_steps": "32", - "led_count": "18", + "brightness_steps": 17, + "hue_steps": 32, + "led_count": 18, "pin": "D7", - "saturation_steps": "17" + "saturation_steps": 17 }, "usb": { "device_ver": "0x0001", diff --git a/keyboards/clueboard/66/rev3/rules.mk b/keyboards/clueboard/66/rev3/rules.mk index 76e161e36b2d..56d1ab011fab 100644 --- a/keyboards/clueboard/66/rev3/rules.mk +++ b/keyboards/clueboard/66/rev3/rules.mk @@ -1,16 +1,3 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp -BOOTLOADER = atmel-dfu - # Build Options # comment out to disable the options. # diff --git a/keyboards/clueboard/66/rev4/info.json b/keyboards/clueboard/66/rev4/info.json index 90c721e31fcb..aef1dee7aa79 100644 --- a/keyboards/clueboard/66/rev4/info.json +++ b/keyboards/clueboard/66/rev4/info.json @@ -4,7 +4,8 @@ "maintainer": "skullydazed", "height": 5, "width": 16.5, - "debounce": "5", + "debounce": 5, + "processor": "STM32F303", "diode_direction": "COL2ROW", "features": { "audio": true, @@ -21,18 +22,18 @@ "unicode": false }, "matrix_pins": { - "cols": ["B10", " B2", " B1", " B0", " A7", " B4", " B3", " B5"], - "rows": ["B11", " A6", " A3", " A2", " A1", " B7", " B6", " C15", " C14", " C13"] + "cols": ["B10", "B2", "B1", "B0", "A7", "B4", "B3", "B5"], + "rows": ["B11", "A6", "A3", "A2", "A1", "B7", "B6", "C15", "C14", "C13"] }, "rgblight": { "animations": { "all": true }, - "brightness_steps": "17", - "hue_steps": "32", - "led_count": "18", + "brightness_steps": 17, + "hue_steps": 32, + "led_count": 18, "pin": "D7", - "saturation_steps": "17" + "saturation_steps": 17 }, "usb": { "device_ver": "0x0001", diff --git a/keyboards/clueboard/66/rev4/rules.mk b/keyboards/clueboard/66/rev4/rules.mk index 4e157baeda12..14a7fa7b715d 100644 --- a/keyboards/clueboard/66/rev4/rules.mk +++ b/keyboards/clueboard/66/rev4/rules.mk @@ -1,3 +1,2 @@ -# MCU name -MCU = STM32F303 BOARD = QMK_PROTON_C +# This file intentionally left blank diff --git a/keyboards/clueboard/66_hotswap/gen1/info.json b/keyboards/clueboard/66_hotswap/gen1/info.json index 76352b0771c6..18afe541268f 100644 --- a/keyboards/clueboard/66_hotswap/gen1/info.json +++ b/keyboards/clueboard/66_hotswap/gen1/info.json @@ -4,7 +4,8 @@ "maintainer": "skullydazed", "height": 5, "width": 16.5, - "debounce": "5", + "debounce": 5, + "processor": "STM32F303", "diode_direction": "COL2ROW", "features": { "audio": true, @@ -12,13 +13,16 @@ "command": true, "console": true, "extrakey": true, - "led_matrix": "IS31FL3731", + "led_matrix": true, "mousekey": true, "nkro": true }, + "led_matrix": { + "driver": "IS31FL3731" + }, "matrix_pins": { - "cols": ["B10", " B2", " B1", " B0", " A7", " B4", " B3", " B7"], - "rows": ["B11", " A6", " A3", " A2", " A1", " B5", " B6", " C15", " C14", " C13"] + "cols": ["B10", "B2", "B1", "B0", "A7", "B4", "B3", "B7"], + "rows": ["B11", "A6", "A3", "A2", "A1", "B5", "B6", "C15", "C14", "C13"] }, "usb": { "device_ver": "0x0001", diff --git a/keyboards/clueboard/66_hotswap/gen1/rules.mk b/keyboards/clueboard/66_hotswap/gen1/rules.mk index f298df1677ca..e23f9a4b3ce8 100644 --- a/keyboards/clueboard/66_hotswap/gen1/rules.mk +++ b/keyboards/clueboard/66_hotswap/gen1/rules.mk @@ -1,5 +1,3 @@ -# MCU name -MCU = STM32F303 BOARD = QMK_PROTON_C LED_MATRIX_DRIVER = IS31FL3731 diff --git a/keyboards/clueboard/66_hotswap/prototype/info.json b/keyboards/clueboard/66_hotswap/prototype/info.json index 1572223592a9..0b55b3b638e4 100644 --- a/keyboards/clueboard/66_hotswap/prototype/info.json +++ b/keyboards/clueboard/66_hotswap/prototype/info.json @@ -4,8 +4,9 @@ "maintainer": "skullydazed", "height": 5, "width": 16.5, - "debounce": "5", + "debounce": 5, "diode_direction": "COL2ROW", + "processor": "atmega32u4", "features": { "audio": true, "backlight": true, @@ -24,18 +25,18 @@ "caps_lock": "B4" }, "matrix_pins": { - "cols": ["F0", " F1", " F4", " F5", " F6", " F7", " E6", " B1"], - "rows": ["B2", " C7", " C6", " B6", " B5", " B0", " B3", " D5", " D3", " D2"] + "cols": ["F0", "F1", "F4", "F5", "F6", "F7", "E6", "B1"], + "rows": ["B2", "C7", "C6", "B6", "B5", "B0", "B3", "D5", "D3", "D2"] }, "rgblight": { "animations": { "all": true }, - "brightness_steps": "17", - "hue_steps": "32", - "led_count": "26", + "brightness_steps": 17, + "hue_steps": 32, + "led_count": 26, "pin": "D7", - "saturation_steps": "17" + "saturation_steps": 17 }, "usb": { "device_ver": "0x0001", diff --git a/keyboards/clueboard/66_hotswap/prototype/rules.mk b/keyboards/clueboard/66_hotswap/prototype/rules.mk index 63dd64f7c188..f144042edd22 100644 --- a/keyboards/clueboard/66_hotswap/prototype/rules.mk +++ b/keyboards/clueboard/66_hotswap/prototype/rules.mk @@ -1,16 +1,3 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp -BOOTLOADER = atmel-dfu - # Build Options # comment out to disable the options. # diff --git a/keyboards/clueboard/california/info.json b/keyboards/clueboard/california/info.json index f376643cdd71..02c06ce51388 100644 --- a/keyboards/clueboard/california/info.json +++ b/keyboards/clueboard/california/info.json @@ -2,6 +2,7 @@ "keyboard_name": "Clueboard California", "url": "", "maintainer": "skullydazed", + "processor": "STM32F303", "matrix_pins": { "direct": [ ["A10", "A9"], @@ -12,6 +13,13 @@ [null, "B2"] ] }, + "features": { + "mousekey": true, + "extrakey": true, + "console": true, + "command": true, + "audio": true + }, "usb": {"pid": "0x23B0"}, "layouts": { "LAYOUT": { diff --git a/keyboards/clueboard/california/rules.mk b/keyboards/clueboard/california/rules.mk index 11719015e9a6..14a7fa7b715d 100644 --- a/keyboards/clueboard/california/rules.mk +++ b/keyboards/clueboard/california/rules.mk @@ -1,12 +1,2 @@ -# MCU name -MCU = STM32F303 BOARD = QMK_PROTON_C - -## Features -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -NKRO_ENABLE = yes # USB Nkey Rollover -RGBLIGHT_ENABLE = no -AUDIO_ENABLE = yes +# This file intentionally left blank diff --git a/keyboards/clueboard/card/info.json b/keyboards/clueboard/card/info.json index e46237175a7c..67830c423531 100644 --- a/keyboards/clueboard/card/info.json +++ b/keyboards/clueboard/card/info.json @@ -4,7 +4,8 @@ "maintainer": "skullydazed", "height": 8, "width": 10, - "debounce": "20", + "debounce": 20, + "processor": "atmega32u4", "diode_direction": "ROW2COL", "features": { "audio": true, @@ -22,15 +23,15 @@ "unicode": false }, "matrix_pins": { - "cols": ["F1", " F7", " F6"], - "rows": ["F0", " F5", " F4", " B4"] + "cols": ["F1", "F7", "F6"], + "rows": ["F0", "F5", "F4", "B4"] }, "rgblight": { - "brightness_steps": "17", - "hue_steps": "10", - "led_count": "4", + "brightness_steps": 17, + "hue_steps": 10, + "led_count": 4, "pin": "E6", - "saturation_steps": "17" + "saturation_steps": 17 }, "usb": { "device_ver": "0x0001", diff --git a/keyboards/clueboard/card/rules.mk b/keyboards/clueboard/card/rules.mk index 75fb718e33de..d2e52d56b5b9 100644 --- a/keyboards/clueboard/card/rules.mk +++ b/keyboards/clueboard/card/rules.mk @@ -1,15 +1,2 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp -BOOTLOADER = atmel-dfu - # Build Options BACKLIGHT_DRIVER = custom From 0a7ffb7fdd57feb1afd529ccce7c2b357f2541dc Mon Sep 17 00:00:00 2001 From: Zach White Date: Tue, 1 Dec 2020 12:58:00 -0800 Subject: [PATCH 03/14] add missing schemas --- data/schemas/api_keyboard.jsonschema | 35 ++++ data/schemas/false.jsonschema | 1 + data/schemas/keyboard.jsonschema | 232 +++++++++++++++++++++++++++ data/schemas/true.jsonschema | 1 + 4 files changed, 269 insertions(+) create mode 100644 data/schemas/api_keyboard.jsonschema create mode 100644 data/schemas/false.jsonschema create mode 100644 data/schemas/keyboard.jsonschema create mode 100644 data/schemas/true.jsonschema diff --git a/data/schemas/api_keyboard.jsonschema b/data/schemas/api_keyboard.jsonschema new file mode 100644 index 000000000000..d570ee99908d --- /dev/null +++ b/data/schemas/api_keyboard.jsonschema @@ -0,0 +1,35 @@ +{ + "allOf": [ + { "$ref": "qmk.keyboard.v1" }, + { + "$id": "qmk.api.keyboard.v1", + "keymaps": { + "type": "string" + }, + "parse_errors": { + "type": "array", + "items": { + "type": "string" + } + }, + "parse_warnings": { + "type": "array", + "items": { + "type": "string" + } + }, + "processor_type": { + "type": "string" + }, + "protocol": { + "type": "string" + }, + "keyboard_folder": { + "type": "string" + }, + "platform": { + "type": "string" + } + } + ] +} diff --git a/data/schemas/false.jsonschema b/data/schemas/false.jsonschema new file mode 100644 index 000000000000..c508d5366f70 --- /dev/null +++ b/data/schemas/false.jsonschema @@ -0,0 +1 @@ +false diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema new file mode 100644 index 000000000000..75e792b646fe --- /dev/null +++ b/data/schemas/keyboard.jsonschema @@ -0,0 +1,232 @@ +{ + "$schema": "http://json-schema.org/schema#", + "$id": "qmk.keyboard.v1", + "title": "Keyboard Information", + "type": "object", + "properties": { + "keyboard_name": { + "type": "string", + "minLength": 2, + "maxLength": 250 + }, + "maintainer": { + "type": "string", + "minLength": 2, + "maxLength": 250 + }, + "manufacturer": { + "type": "string", + "minLength": 2, + "maxLength": 250 + }, + "url": { + "type": "string", + "format": "uri" + }, + "processor": { + "type": "string", + "enum": ["MK20DX128", "MK20DX256", "MKL26Z64", "STM32F042", "STM32F072", "STM32F103", "STM32F303", "STM32F401", "STM32F411", "at90usb1286", "at90usb646", "atmega16u2", "atmega328p", "atmega32a", "atmega32u2", "atmega32u4", "attiny85", "cortex-m4"] + }, + "bootloader": { + "type": "string", + "enum": ["atmel-dfu", "bootloadHID", "caterina", "halfkay", "kiibohd", "lufa-dfu", "lufa-ms", "micronucleus", "qmk-dfu", "stm32-dfu", "stm32duino", "unknown", "USBasp"] + }, + "diode_direction": { + "type": "string", + "enum": ["COL2ROW", "ROW2COL"] + }, + "debounce": { + "type": "number", + "min": 0, + "multipleOf": 1 + }, + "height": { + "type": "number", + "min": 0.25 + }, + "width": { + "type": "number", + "min": 0.25 + }, + "community_layouts": { + "type": "array", + "items": { + "type": "string", + "minLength": 2, + "pattern": "^[0-9a-z_]*$" + } + }, + "features": { + "type": "object", + "additionalProperties": {"type": "boolean"} + }, + "indicators": { + "type": "object", + "properties": { + "caps_lock": { + "type": "string", + "pattern": "^[A-K]\\d{1,2}$" + }, + "num_lock": { + "type": "string", + "pattern": "^[A-K]\\d{1,2}$" + }, + "scroll_lock": { + "type": "string", + "pattern": "^[A-K]\\d{1,2}$" + } + } + }, + "layout_aliases": { + "type": "object", + "additionalProperties": { + "type": "string", + "pattern": "^LAYOUT_[0-9a-z_]*$" + } + }, + "layouts": { + "type": "object", + "additionalProperties": { + "type": "object", + "additionalProperties": false, + "properties": { + "c_macro": { + "type": "boolean" + }, + "key_count": { + "type": "number", + "min": 0, + "multipleOf": 1 + }, + "layout": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "properties": { + "label": {"type": "string"}, + "matrix": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "items": { + "type": "number", + "min": 0, + "multipleOf": 1 + } + }, + "h": { + "type": "number", + "min": 0.25 + }, + "w": { + "type": "number", + "min": 0.25 + }, + "x": { + "type": "number", + "min": 0 + }, + "y": { + "type": "number", + "min": 0 + } + } + } + } + } + } + }, + "matrix_pins": { + "type": "object", + "additionalProperties": false, + "properties": { + "direct": { + "type": "array", + "items": { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string", + "pattern": "^[A-K]\\d{1,2}$" + }, + { + "type": "null" + } + ] + } + } + }, + "cols": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[A-K]\\d{1,2}$" + } + }, + "rows": { + "type": "array", + "items": { + "type": "string", + "pattern": "^[A-K]\\d{1,2}$" + } + } + } + }, + "rgblight": { + "type": "object", + "additionalProperties": false, + "properties": { + "animations": { + "type": "object", + "additionalProperties": { + "type": "boolean" + } + }, + "brightness_steps": { + "type": "number", + "min": 0, + "multipleOf": 1 + }, + "hue_steps": { + "type": "number", + "min": 0, + "multipleOf": 1 + }, + "led_count": { + "type": "number", + "min": 0, + "multipleOf": 1 + }, + "pin": { + "type": "string", + "pattern": "^[A-K]\\d{1,2}$" + }, + "saturation_steps": { + "type": "number", + "min": 0, + "multipleOf": 1 + } + } + }, + "usb": { + "type": "object", + "additionalProperties": false, + "properties": { + "device_ver": { + "type": "string", + "pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]" + }, + "pid": { + "type": "string", + "pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]" + }, + "vid": { + "type": "string", + "pattern": "^[0-9A-F]x[0-9A-F][0-9A-F][0-9A-F][0-9A-F]" + } + } + } + } +} diff --git a/data/schemas/true.jsonschema b/data/schemas/true.jsonschema new file mode 100644 index 000000000000..27ba77ddaf61 --- /dev/null +++ b/data/schemas/true.jsonschema @@ -0,0 +1 @@ +true From e79a8b50e940d473932d05eb1b717e2364b49a3e Mon Sep 17 00:00:00 2001 From: Zach White Date: Tue, 1 Dec 2020 16:04:22 -0800 Subject: [PATCH 04/14] get qmk generate-api into a good state --- data/schemas/keyboard.jsonschema | 33 ++++++++++ lib/python/qmk/c_parse.py | 26 ++++++-- lib/python/qmk/cli/generate/api.py | 2 +- lib/python/qmk/cli/generate/rules_mk.py | 9 ++- lib/python/qmk/info.py | 82 +++++++++++++++++-------- 5 files changed, 117 insertions(+), 35 deletions(-) diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index 75e792b646fe..9355ee49bd3c 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -90,6 +90,9 @@ "type": "object", "additionalProperties": false, "properties": { + "filename": { + "type": "string" + }, "c_macro": { "type": "boolean" }, @@ -119,6 +122,18 @@ "type": "number", "min": 0.25 }, + "r": { + "type": "number", + "min": 0 + }, + "rx": { + "type": "number", + "min": 0 + }, + "ry": { + "type": "number", + "min": 0 + }, "w": { "type": "number", "min": 0.25 @@ -199,6 +214,12 @@ "min": 0, "multipleOf": 1 }, + "max_brightness": { + "type": "number", + "min": 0, + "max": 255, + "multipleOf": 1 + }, "pin": { "type": "string", "pattern": "^[A-K]\\d{1,2}$" @@ -207,6 +228,18 @@ "type": "number", "min": 0, "multipleOf": 1 + }, + "sleep": {"type": "boolean"}, + "split": {"type": "boolean"}, + "split_count": { + "type": "array", + "minLength": 2, + "maxLength": 2, + "items": { + "type": "number", + "min": 0, + "multipleOf": 1 + } } } }, diff --git a/lib/python/qmk/c_parse.py b/lib/python/qmk/c_parse.py index e41e271a4355..67e196f0eaa5 100644 --- a/lib/python/qmk/c_parse.py +++ b/lib/python/qmk/c_parse.py @@ -1,12 +1,27 @@ """Functions for working with config.h files. """ from pathlib import Path +import re from milc import cli from qmk.comment_remover import comment_remover default_key_entry = {'x': -1, 'y': 0, 'w': 1} +single_comment_regex = re.compile(r' */[/*].*$') +multi_comment_regex = re.compile(r'/\*(.|\n)*\*/', re.MULTILINE) + + +def strip_line_comment(string): + """Removes comments from a single line string. + """ + return single_comment_regex.sub('', string) + + +def strip_multiline_comment(string): + """Removes comments from a single line string. + """ + return multi_comment_regex.sub('', string) def c_source_files(dir_names): @@ -53,7 +68,8 @@ def find_layouts(file): parsed_layout = [_default_key(key) for key in layout.split(',')] for key in parsed_layout: - key['matrix'] = matrix_locations.get(key['label']) + if key['label'] in matrix_locations: + key['matrix'] = matrix_locations[key['label']] parsed_layouts[macro_name] = { 'key_count': len(parsed_layout), @@ -88,12 +104,10 @@ def parse_config_h_file(config_h_file, config_h=None): if config_h_file.exists(): config_h_text = config_h_file.read_text() config_h_text = config_h_text.replace('\\\n', '') + config_h_text = strip_multiline_comment(config_h_text) for linenum, line in enumerate(config_h_text.split('\n')): - line = line.strip() - - if '//' in line: - line = line[:line.index('//')].strip() + line = strip_line_comment(line).strip() if not line: continue @@ -156,6 +170,6 @@ def _parse_matrix_locations(matrix, file, macro_name): row = row.replace('{', '').replace('}', '') for col_num, identifier in enumerate(row.split(',')): if identifier != 'KC_NO': - matrix_locations[identifier] = (row_num, col_num) + matrix_locations[identifier] = [row_num, col_num] return matrix_locations diff --git a/lib/python/qmk/cli/generate/api.py b/lib/python/qmk/cli/generate/api.py index 6d111f244cdc..2fda38fc9ae4 100755 --- a/lib/python/qmk/cli/generate/api.py +++ b/lib/python/qmk/cli/generate/api.py @@ -48,7 +48,7 @@ def generate_api(cli): if 'vid' in usb and usb['vid'] not in usb_list['devices']: usb_list['devices'][usb['vid']] = {} - if 'pid' in usb and usb['pid'] not in usb_list['devices'][usb['vid']]: + if 'vid' in usb and usb['pid'] not in usb_list['devices'][usb['vid']]: usb_list['devices'][usb['vid']][usb['pid']] = {} if 'vid' in usb and 'pid' in usb: diff --git a/lib/python/qmk/cli/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py index 72ed3c45fa47..570ef5a0d6f7 100755 --- a/lib/python/qmk/cli/generate/rules_mk.py +++ b/lib/python/qmk/cli/generate/rules_mk.py @@ -41,9 +41,12 @@ def generate_rules_mk(cli): # Find features that should be enabled if 'features' in kb_info_json: for feature, enabled in kb_info_json['features'].items(): - feature = feature.upper() - enabled = 'yes' if enabled else 'no' - rules_mk_lines.append(f'{feature}_ENABLE := {enabled}') + if feature == 'bootmagic_lite' and enabled: + rules_mk_lines.append(f'BOOTMAGIC_ENABLE := lite') + else: + feature = feature.upper() + enabled = 'yes' if enabled else 'no' + rules_mk_lines.append(f'{feature}_ENABLE := {enabled}') # Set the LED driver if 'led_matrix' in kb_info_json and 'driver' in kb_info_json['led_matrix']: diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 1cf12190d6cb..39af88f790ab 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -26,13 +26,12 @@ } rgblight_properties = { - 'led_count': 'RGBLED_NUM', - 'pin': 'RGB_DI_PIN', - 'split_count': 'RGBLED_SPLIT', - 'max_brightness': 'RGBLIGHT_LIMIT_VAL', - 'hue_steps': 'RGBLIGHT_HUE_STEP', - 'saturation_steps': 'RGBLIGHT_SAT_STEP', - 'brightness_steps': 'RGBLIGHT_VAL_STEP' + 'led_count': ('RGBLED_NUM', int), + 'pin': ('RGB_DI_PIN', str), + 'max_brightness': ('RGBLIGHT_LIMIT_VAL', int), + 'hue_steps': ('RGBLIGHT_HUE_STEP', int), + 'saturation_steps': ('RGBLIGHT_SAT_STEP', int), + 'brightness_steps': ('RGBLIGHT_VAL_STEP', int) } rgblight_toggles = { @@ -54,6 +53,8 @@ 'twinkle': 'RGBLIGHT_EFFECT_TWINKLE' } +usb_properties = {'vid': 'VENDOR_ID', 'pid': 'PRODUCT_ID', 'device_ver': 'DEVICE_VER'} + true_values = ['1', 'on', 'yes'] false_values = ['0', 'off', 'no'] @@ -97,7 +98,8 @@ def info_json(keyboard): keyboard_api_validate(info_data) except jsonschema.ValidationError as e: - cli.log.error('Invalid info.json data: %s', e.message) + json_path = '.'.join([str(p) for p in e.absolute_path]) + cli.log.error('Invalid API data: %s: %s: %s', keyboard, json_path, e.message) print(dir(e)) exit() @@ -198,6 +200,9 @@ def _extract_indicators(info_data, config_c): if json_key in info_data.get('indicators', []) and config_key in config_c: _log_warning(info_data, f'Indicator {json_key} is specified in both info.json and config.h, the config.h value wins.') + if 'indicators' not in info_data: + info_data['indicators'] = {} + if config_key in config_c: if 'indicators' not in info_data: info_data['indicators'] = {} @@ -226,10 +231,23 @@ def _extract_community_layouts(info_data, rules): def _extract_features(info_data, rules): """Find all the features enabled in rules.mk. """ + # Special handling for bootmagic which also supports a "lite" mode. + if rules.get('BOOTMAGIC_ENABLE') == 'lite': + rules['BOOTMAGIC_LITE_ENABLE'] = 'on' + del(rules['BOOTMAGIC_ENABLE']) + if rules.get('BOOTMAGIC_ENABLE') == 'full': + rules['BOOTMAGIC_ENABLE'] = 'on' + + # Skip non-boolean features we haven't implemented special handling for + for feature in 'HAPTIC_ENABLE', 'QWIIC_ENABLE': + if rules.get(feature): + del(rules[feature]) + + # Process the rest of the rules as booleans for key, value in rules.items(): if key.endswith('_ENABLE'): key = '_'.join(key.split('_')[:-1]).lower() - value = True if value in true_values else False if value in false_values else value + value = True if value.lower() in true_values else False if value.lower() in false_values else value if 'config_h_features' not in info_data: info_data['config_h_features'] = {} @@ -280,12 +298,21 @@ def _extract_rgblight(info_data, config_c): rgblight = info_data.get('rgblight', {}) animations = rgblight.get('animations', {}) - for json_key, config_key in rgblight_properties.items(): + if 'RGBLED_SPLIT' in config_c: + raw_split = config_c.get('RGBLED_SPLIT', '').replace('{', '').replace('}', '').strip() + rgblight['split_count'] = [int(i) for i in raw_split.split(',')] + + for json_key, config_key_type in rgblight_properties.items(): + config_key, config_type = config_key_type + if config_key in config_c: if json_key in rgblight: _log_warning(info_data, 'RGB Light: %s is specified in both info.json and config.h, the config.h value wins.' % (json_key,)) - rgblight[json_key] = config_c[config_key] + try: + rgblight[json_key] = config_type(config_c[config_key]) + except ValueError as e: + cli.log.error('%s: config.h: Could not convert "%s" to %s: %s', info_data['keyboard_folder'], config_c[config_key], config_type.__name__, e) for json_key, config_key in rgblight_toggles.items(): if config_key in config_c: @@ -332,11 +359,16 @@ def _extract_matrix_info(info_data, config_c): info_data['matrix_pins'] = {} + # FIXME(skullydazed/anyone): Should really check every pin, not just the first if row_pins: - info_data['matrix_pins']['rows'] = row_pins.split(',') + row_pins = [pin.strip() for pin in row_pins.split(',') if pin] + if row_pins[0][0] in 'ABCDEFGHIJK' and row_pins[0][1].isdigit(): + info_data['matrix_pins']['rows'] = row_pins if col_pins: - info_data['matrix_pins']['cols'] = col_pins.split(',') + col_pins = [pin.strip() for pin in col_pins.split(',') if pin] + if col_pins[0][0] in 'ABCDEFGHIJK' and col_pins[0][1].isdigit(): + info_data['matrix_pins']['cols'] = col_pins if direct_pins: if 'matrix_pins' in info_data: @@ -345,6 +377,9 @@ def _extract_matrix_info(info_data, config_c): info_data['matrix_pins'] = {} direct_pin_array = [] + while direct_pins[-1] != '}': + direct_pins = direct_pins[:-1] + for row in direct_pins.split('},{'): if row.startswith('{'): row = row[1:] @@ -368,8 +403,6 @@ def _extract_matrix_info(info_data, config_c): def _extract_usb_info(info_data, config_c): """Populate the USB information. """ - usb_properties = {'vid': 'VENDOR_ID', 'pid': 'PRODUCT_ID', 'device_ver': 'DEVICE_VER'} - if 'usb' not in info_data: info_data['usb'] = {} @@ -378,10 +411,7 @@ def _extract_usb_info(info_data, config_c): if info_name in info_data['usb']: _log_warning(info_data, '%s in config.h is overwriting usb.%s in info.json' % (config_name, info_name)) - info_data['usb'][info_name] = config_c[config_name] - - elif info_name not in info_data['usb']: - _log_error(info_data, '%s not specified in config.h, and %s not specified in info.json. One is required.' % (config_name, info_name)) + info_data['usb'][info_name] = '0x' + config_c[config_name][2:].upper() return info_data @@ -519,8 +549,9 @@ def arm_processor_rules(info_data, rules): info_data['processor'] = 'unknown' if 'BOOTLOADER' in rules: - if 'bootloader' in info_data: - _log_warning(info_data, 'Bootloader is specified in both info.json and rules.mk, the rules.mk value wins.') + # FIXME(skullydazed/anyone): need to remove the massive amounts of duplication first + # if 'bootloader' in info_data: + # _log_warning(info_data, 'Bootloader is specified in both info.json and rules.mk, the rules.mk value wins.') info_data['bootloader'] = rules['BOOTLOADER'] @@ -558,8 +589,9 @@ def avr_processor_rules(info_data, rules): info_data['processor'] = 'unknown' if 'BOOTLOADER' in rules: - if 'bootloader' in info_data: - _log_warning(info_data, 'Bootloader is specified in both info.json and rules.mk, the rules.mk value wins.') + # FIXME(skullydazed/anyone): need to remove the massive amounts of duplication first + # if 'bootloader' in info_data: + # _log_warning(info_data, 'Bootloader is specified in both info.json and rules.mk, the rules.mk value wins.') info_data['bootloader'] = rules['BOOTLOADER'] else: @@ -593,8 +625,8 @@ def merge_info_jsons(keyboard, info_data): keyboard_validate(new_info_data) except jsonschema.ValidationError as e: - cli.log.error('Invalid info.json data: %s', e.message) - cli.log.error('Not including file %s', info_file) + json_path = '.'.join([str(p) for p in e.absolute_path]) + cli.log.error('Invalid info.json data: %s: %s: %s', info_file, json_path, e.message) continue if not isinstance(new_info_data, dict): From cb6892890a183f493638d604c675448b2fd052f7 Mon Sep 17 00:00:00 2001 From: Zach White Date: Tue, 1 Dec 2020 16:04:38 -0800 Subject: [PATCH 05/14] clean up generate-api errors --- keyboards/40percentclub/foobar/info.json | 2 -- keyboards/40percentclub/tomato/info.json | 1 - keyboards/4by3/info.json | 6 ------ keyboards/ai03/lunar/info.json | 3 +-- keyboards/alf/dc60/info.json | 4 +--- keyboards/alpha/info.json | 2 -- keyboards/amj40/info.json | 2 -- keyboards/atomic/info.json | 2 -- keyboards/bpiphany/unloved_bastard/info.json | 2 -- keyboards/chidori/info.json | 1 - keyboards/converter/adb_usb/info.json | 2 -- keyboards/converter/hp_46010a/config.h | 2 +- keyboards/converter/ibm_5291/config.h | 2 +- keyboards/doro67/regular/info.json | 4 +--- keyboards/ep/40/info.json | 1 - keyboards/ergodox_stm32/config.h | 2 +- keyboards/ergotravel/info.json | 1 + keyboards/ergotravel/rules.mk | 15 +-------------- keyboards/exclusive/e6v2/le_bmc/info.json | 2 -- keyboards/exclusive/e6v2/oe_bmc/info.json | 2 -- keyboards/flehrad/bigswitch/info.json | 2 -- keyboards/flehrad/downbubble/info.json | 3 +-- keyboards/fleuron/info.json | 4 +--- keyboards/handwired/frenchdev/info.json | 3 --- keyboards/handwired/ibm122m/info.json | 2 -- keyboards/keebio/nyquist/info.json | 2 -- keyboards/kmac/info.json | 2 -- keyboards/matrix/noah/info.json | 6 +++--- keyboards/mechmini/v2/info.json | 1 - keyboards/pabile/p40_ortho/info.json | 2 -- keyboards/pearl/info.json | 2 -- keyboards/qwertyydox/info.json | 1 + keyboards/qwertyydox/rules.mk | 13 ------------- keyboards/redscarf_i/info.json | 4 ---- keyboards/waldo/info.json | 4 +--- keyboards/xd004/info.json | 2 +- keyboards/ymdk_np21/info.json | 9 ++------- 37 files changed, 18 insertions(+), 102 deletions(-) diff --git a/keyboards/40percentclub/foobar/info.json b/keyboards/40percentclub/foobar/info.json index 6d722ae6ee86..c9bbda67c93b 100644 --- a/keyboards/40percentclub/foobar/info.json +++ b/keyboards/40percentclub/foobar/info.json @@ -6,8 +6,6 @@ "height": 3, "layouts": { "LAYOUT_macro": { - "width": 5, - "height": 3, "key_count": 15, "layout": [ {"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, diff --git a/keyboards/40percentclub/tomato/info.json b/keyboards/40percentclub/tomato/info.json index f01f5e7e0b75..b24f97bcd962 100644 --- a/keyboards/40percentclub/tomato/info.json +++ b/keyboards/40percentclub/tomato/info.json @@ -2,7 +2,6 @@ "keyboard_name": "Tomato", "url": "", "maintainer": "qmk", - "bootloader": "", "width": 10, "height": 3, "layouts": { diff --git a/keyboards/4by3/info.json b/keyboards/4by3/info.json index 9cc07a9240f9..fb78f05d51f4 100644 --- a/keyboards/4by3/info.json +++ b/keyboards/4by3/info.json @@ -7,8 +7,6 @@ "layouts": { "LAYOUT_horizontal": { "key_count": 12, - "width": 4, - "height": 3, "layout": [ { "x": 0, "y": 0 }, { "x": 1, "y": 0 }, { "x": 2, "y": 0 }, { "x": 3, "y": 0 }, { "x": 0, "y": 1 }, { "x": 1, "y": 1 }, { "x": 2, "y": 1 }, { "x": 3, "y": 1 }, @@ -17,8 +15,6 @@ }, "LAYOUT_vertical_right": { "key_count": 12, - "width": 3, - "height": 4, "layout": [ { "x": 0, "y": 0 }, { "x": 1, "y": 0 }, { "x": 2, "y": 0 }, { "x": 0, "y": 1 }, { "x": 1, "y": 1 }, { "x": 2, "y": 1 }, @@ -28,8 +24,6 @@ }, "LAYOUT_vertical_left": { "key_count": 12, - "width": 3, - "height": 4, "layout": [ { "x": 0, "y": 0 }, { "x": 1, "y": 0 }, { "x": 2, "y": 0 }, { "x": 0, "y": 1 }, { "x": 1, "y": 1 }, { "x": 2, "y": 1 }, diff --git a/keyboards/ai03/lunar/info.json b/keyboards/ai03/lunar/info.json index e18a10bde0ed..f3024be43152 100644 --- a/keyboards/ai03/lunar/info.json +++ b/keyboards/ai03/lunar/info.json @@ -2,7 +2,6 @@ "keyboard_name": "Lunar", "url": "https://geekhack.org/index.php?topic=96112.0", "maintainer": "ai03", - "bootloader": "", "width": 16, "height": 5, "layouts": { @@ -81,4 +80,4 @@ ] } } -} \ No newline at end of file +} diff --git a/keyboards/alf/dc60/info.json b/keyboards/alf/dc60/info.json index 1c3ebf4f0ab6..9482e0b40010 100644 --- a/keyboards/alf/dc60/info.json +++ b/keyboards/alf/dc60/info.json @@ -1,8 +1,6 @@ { "keyboard_name": "dc60", - "url": "", "maintainer": "qmk", - "bootloader": "", "width": 15, "height": 5, "layouts": { @@ -10,4 +8,4 @@ "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.5, "y":1, "w":1.5}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2, "w":2.25}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3}, {"x":6, "y":3}, {"x":7, "y":3}, {"x":8, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}, {"x":12, "y":3}, {"x":13, "y":3}, {"x":14, "y":3}, {"x":0, "y":4, "w":1.25}, {"x":1.25, "y":4, "w":1.25}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":2.75}, {"x":6.5, "y":4, "w":1.25}, {"x":7.75, "y":4, "w":2.25}, {"x":10, "y":4}, {"x":11, "y":4}, {"x":12, "y":4}, {"x":13, "y":4}, {"x":14, "y":4}] } } -} \ No newline at end of file +} diff --git a/keyboards/alpha/info.json b/keyboards/alpha/info.json index b08e6d9a4198..0c03a51aa61c 100644 --- a/keyboards/alpha/info.json +++ b/keyboards/alpha/info.json @@ -1,8 +1,6 @@ { "keyboard_name": "Alpha", - "url": "", "maintainer": "qmk", - "bootloader": "", "width": 10, "height": 3, "layouts": { diff --git a/keyboards/amj40/info.json b/keyboards/amj40/info.json index ddbd34a7c4f9..1b25106e0c04 100644 --- a/keyboards/amj40/info.json +++ b/keyboards/amj40/info.json @@ -1,8 +1,6 @@ { "keyboard_name": "AMJ40", - "url": "", "maintainer": "qmk", - "bootloader": "", "width": 12, "height": 4, "layouts": { diff --git a/keyboards/atomic/info.json b/keyboards/atomic/info.json index b07a070253aa..6e543b7b5531 100644 --- a/keyboards/atomic/info.json +++ b/keyboards/atomic/info.json @@ -1,8 +1,6 @@ { "keyboard_name": "Atomic", - "url": "", "maintainer": "qmk", - "bootloader": "", "width": 15, "height": 5, "layouts": { diff --git a/keyboards/bpiphany/unloved_bastard/info.json b/keyboards/bpiphany/unloved_bastard/info.json index b0e3346e070a..ff8c52d9c290 100644 --- a/keyboards/bpiphany/unloved_bastard/info.json +++ b/keyboards/bpiphany/unloved_bastard/info.json @@ -1,8 +1,6 @@ { "keyboard_name": "unloved_bastard", - "url": "", "maintainer": "qmk", - "bootloader": "", "width": 18.25, "height": 6.5, "layouts": { diff --git a/keyboards/chidori/info.json b/keyboards/chidori/info.json index 8a24d1a92687..0c892aa084f8 100644 --- a/keyboards/chidori/info.json +++ b/keyboards/chidori/info.json @@ -14,7 +14,6 @@ ] }, "LAYOUT_extended": { - "width": 20, "layout": [ {"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":14, "y":0}, {"x":15, "y":0}, {"x":16, "y":0}, {"x":17, "y":0}, {"x":18, "y":0}, {"x":19, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":7, "y":1}, {"x":8, "y":1}, {"x":9, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":12, "y":1}, {"x":14, "y":1}, {"x":15, "y":1}, {"x":16, "y":1}, {"x":17, "y":1}, {"x":18, "y":1}, {"x":19, "y":1}, diff --git a/keyboards/converter/adb_usb/info.json b/keyboards/converter/adb_usb/info.json index e06f9c1adb6d..e00b3b05f96d 100644 --- a/keyboards/converter/adb_usb/info.json +++ b/keyboards/converter/adb_usb/info.json @@ -114,8 +114,6 @@ ] }, "LAYOUT_m0116_ansi": { - "width": 19.5, - "height": 6.25, "layout": [ {"label":"Power", "x":5, "y":0, "w":2}, {"label":"Esc", "x":0, "y":1.25}, diff --git a/keyboards/converter/hp_46010a/config.h b/keyboards/converter/hp_46010a/config.h index b7297ab884a4..a1345c66dc6d 100644 --- a/keyboards/converter/hp_46010a/config.h +++ b/keyboards/converter/hp_46010a/config.h @@ -21,7 +21,7 @@ along with this program. If not, see . #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6060 -#define DEVICE_VER 1 +#define DEVICE_VER 0x0001 #define MANUFACTURER QMK #define PRODUCT 46010A keyboard converter #define DESCRIPTION 46010A keyboard converter diff --git a/keyboards/converter/ibm_5291/config.h b/keyboards/converter/ibm_5291/config.h index 9701bdfe9736..f4c41d070672 100644 --- a/keyboards/converter/ibm_5291/config.h +++ b/keyboards/converter/ibm_5291/config.h @@ -21,7 +21,7 @@ along with this program. If not, see . #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x6060 -#define DEVICE_VER 1 +#define DEVICE_VER 0x0001 #define MANUFACTURER QMK #define PRODUCT 5291 keyboard converter #define DESCRIPTION 5291 keyboard converter diff --git a/keyboards/doro67/regular/info.json b/keyboards/doro67/regular/info.json index ebdfa4db6878..e5ea4c16a64d 100644 --- a/keyboards/doro67/regular/info.json +++ b/keyboards/doro67/regular/info.json @@ -1,6 +1,4 @@ { - "keyboard_name": "", - "url": "", "maintainer": "qmk", "width": 16, "height": 5, @@ -79,4 +77,4 @@ } } } - \ No newline at end of file + diff --git a/keyboards/ep/40/info.json b/keyboards/ep/40/info.json index 1c57ac674999..51c000e7403d 100644 --- a/keyboards/ep/40/info.json +++ b/keyboards/ep/40/info.json @@ -1,6 +1,5 @@ { "keyboard_name":"ep40", - "url":null, "maintainer":"e11i0t23", "width":12, "hight":4, diff --git a/keyboards/ergodox_stm32/config.h b/keyboards/ergodox_stm32/config.h index e1b3d7b14e64..e0255875a19a 100644 --- a/keyboards/ergodox_stm32/config.h +++ b/keyboards/ergodox_stm32/config.h @@ -20,7 +20,7 @@ along with this program. If not, see . #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x1308 -#define DEVICE_VER 0x101 +#define DEVICE_VER 0x0101 #define MANUFACTURER ErgoDox #define PRODUCT ErgoDox STM #define DESCRIPTION ErgoDox STM32 Keyboard diff --git a/keyboards/ergotravel/info.json b/keyboards/ergotravel/info.json index c0e5cc636893..5cd19ced535e 100644 --- a/keyboards/ergotravel/info.json +++ b/keyboards/ergotravel/info.json @@ -4,6 +4,7 @@ "identifier": "0x1256", "url": "https://github.com/jpconstantineau/ErgoTravel", "maintainer": "qmk", + "bootloader": "caterina", "processor": "atmega32u4", "width": 16, "height": 5, diff --git a/keyboards/ergotravel/rules.mk b/keyboards/ergotravel/rules.mk index 5fd2a23dafbb..ab0ae83c14f7 100644 --- a/keyboards/ergotravel/rules.mk +++ b/keyboards/ergotravel/rules.mk @@ -1,16 +1,3 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp -BOOTLOADER = caterina - # Build Options # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically @@ -32,4 +19,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend SPLIT_KEYBOARD = yes -DEFAULT_FOLDER = ergotravel/rev1 \ No newline at end of file +DEFAULT_FOLDER = ergotravel/rev1 diff --git a/keyboards/exclusive/e6v2/le_bmc/info.json b/keyboards/exclusive/e6v2/le_bmc/info.json index 413db8abcaa1..4604f5756536 100644 --- a/keyboards/exclusive/e6v2/le_bmc/info.json +++ b/keyboards/exclusive/e6v2/le_bmc/info.json @@ -1,6 +1,4 @@ { - "keyboard_name": "", - "url": "", "maintainer": "qmk", "width": 15, "height": 5, diff --git a/keyboards/exclusive/e6v2/oe_bmc/info.json b/keyboards/exclusive/e6v2/oe_bmc/info.json index 413db8abcaa1..4604f5756536 100644 --- a/keyboards/exclusive/e6v2/oe_bmc/info.json +++ b/keyboards/exclusive/e6v2/oe_bmc/info.json @@ -1,6 +1,4 @@ { - "keyboard_name": "", - "url": "", "maintainer": "qmk", "width": 15, "height": 5, diff --git a/keyboards/flehrad/bigswitch/info.json b/keyboards/flehrad/bigswitch/info.json index 8d3d746f5771..37095ade3c74 100644 --- a/keyboards/flehrad/bigswitch/info.json +++ b/keyboards/flehrad/bigswitch/info.json @@ -1,8 +1,6 @@ { "keyboard_name": "Bigswitch PCB", - "url": "", "maintainer": "qmk", - "bootloader": "", "width": 4, "height": 4, "layouts": { diff --git a/keyboards/flehrad/downbubble/info.json b/keyboards/flehrad/downbubble/info.json index c5cd97de5483..a7e68e7f61b9 100644 --- a/keyboards/flehrad/downbubble/info.json +++ b/keyboards/flehrad/downbubble/info.json @@ -1,6 +1,5 @@ { "keyboard_name": "downbubble", - "url": "", "maintainer": "flehrad", "width": 22.75, "height": 6, @@ -429,7 +428,7 @@ {"label":"K53", "x":3.75, "y":5, "w":1.25}, {"label":"K54", "x":5, "y":5, "w":2.25}, {"label":"K56", "x":7.75, "y":5}, - {"Label":"K57", "x":8.75, "y":5}, + {"label":"K57", "x":8.75, "y":5}, {"label":"K58", "x":9.75, "y":5}, {"label":"K59", "x":10.75, "y":5}, {"label":"K510", "x":13, "y":5, "w":2}, diff --git a/keyboards/fleuron/info.json b/keyboards/fleuron/info.json index 2f357d3bf092..78fe64e3a1bc 100644 --- a/keyboards/fleuron/info.json +++ b/keyboards/fleuron/info.json @@ -1,8 +1,6 @@ { "keyboard_name": "Fleuron v1.0", - "url": "", "maintainer": "qmk", - "bootloader": "", "width": 16, "height": 6, "layouts": { @@ -106,4 +104,4 @@ {"label":"Enter", "x":15, "y":5}] } } -} \ No newline at end of file +} diff --git a/keyboards/handwired/frenchdev/info.json b/keyboards/handwired/frenchdev/info.json index 28f09a3aa112..2477302becf2 100644 --- a/keyboards/handwired/frenchdev/info.json +++ b/keyboards/handwired/frenchdev/info.json @@ -1,8 +1,5 @@ { - "keyboard_name": "", - "url": "", "maintainer": "qmk", - "bootloader": "", "width": 20, "height": 9.5, "layouts": { diff --git a/keyboards/handwired/ibm122m/info.json b/keyboards/handwired/ibm122m/info.json index b9ce9e8f83e9..46db3c0d7565 100644 --- a/keyboards/handwired/ibm122m/info.json +++ b/keyboards/handwired/ibm122m/info.json @@ -1,8 +1,6 @@ { "keyboard_name": "IBM Model M 122-key", - "url": "", "maintainer": "qmk", - "bootloader": "", "width": 24.75, "height": 8, "layouts": { diff --git a/keyboards/keebio/nyquist/info.json b/keyboards/keebio/nyquist/info.json index 6e44d98a1b97..d948baaa1863 100644 --- a/keyboards/keebio/nyquist/info.json +++ b/keyboards/keebio/nyquist/info.json @@ -1,6 +1,5 @@ { "keyboard_name": "Nyquist", - "url": "", "maintainer": "qmk", "width": 13, "height": 5, @@ -12,7 +11,6 @@ "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":7, "y":1}, {"x":8, "y":1}, {"x":9, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":12, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":7, "y":2}, {"x":8, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":12, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3}, {"x":7, "y":3}, {"x":8, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}, {"x":12, "y":3}, {"x":0, "y":4}, {"x":1, "y":4}, {"x":2, "y":4}, {"x":3, "y":4}, {"x":4, "y":4}, {"x":5, "y":4}, {"x":7, "y":4}, {"x":8, "y":4}, {"x":9, "y":4}, {"x":10, "y":4}, {"x":11, "y":4}, {"x":12, "y":4}] }, "LAYOUT_ortho_4x12": { - "height": 4, "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":0, "y":1}, {"x":1, "y":1}, {"x":2, "y":1}, {"x":3, "y":1}, {"x":4, "y":1}, {"x":5, "y":1}, {"x":7, "y":1}, {"x":8, "y":1}, {"x":9, "y":1}, {"x":10, "y":1}, {"x":11, "y":1}, {"x":12, "y":1}, {"x":0, "y":2}, {"x":1, "y":2}, {"x":2, "y":2}, {"x":3, "y":2}, {"x":4, "y":2}, {"x":5, "y":2}, {"x":7, "y":2}, {"x":8, "y":2}, {"x":9, "y":2}, {"x":10, "y":2}, {"x":11, "y":2}, {"x":12, "y":2}, {"x":0, "y":3}, {"x":1, "y":3}, {"x":2, "y":3}, {"x":3, "y":3}, {"x":4, "y":3}, {"x":5, "y":3}, {"x":7, "y":3}, {"x":8, "y":3}, {"x":9, "y":3}, {"x":10, "y":3}, {"x":11, "y":3}, {"x":12, "y":3}] } } diff --git a/keyboards/kmac/info.json b/keyboards/kmac/info.json index 2fe0ef2697a3..6a98fab0a447 100644 --- a/keyboards/kmac/info.json +++ b/keyboards/kmac/info.json @@ -1,8 +1,6 @@ { "keyboard_name": "kmac", - "url": "", "maintainer": "qmk", - "bootloader": "", "width": 18.25, "height": 6.5, "layouts": { diff --git a/keyboards/matrix/noah/info.json b/keyboards/matrix/noah/info.json index 69fc0fccfcb3..bb06a16d7cb8 100644 --- a/keyboards/matrix/noah/info.json +++ b/keyboards/matrix/noah/info.json @@ -84,7 +84,7 @@ "y": 0 }, { - "Label": "Ins", + "label": "Ins", "x": 15, "y": 0 }, @@ -440,7 +440,7 @@ "y": 0 }, { - "Label": "Ins", + "label": "Ins", "x": 15, "y": 0 }, @@ -807,7 +807,7 @@ "y": 0 }, { - "Label": "Ins", + "label": "Ins", "x": 15, "y": 0 }, diff --git a/keyboards/mechmini/v2/info.json b/keyboards/mechmini/v2/info.json index c69771c1f85e..f24b8648cbbe 100644 --- a/keyboards/mechmini/v2/info.json +++ b/keyboards/mechmini/v2/info.json @@ -2,7 +2,6 @@ "keyboard_name": "MechMini 2", "url": "https://mechkeys.ca/pages/mechmini-2-guide", "maintainer": "qmk", - "bootloader": "", "width": 12, "height": 4, "layouts": { diff --git a/keyboards/pabile/p40_ortho/info.json b/keyboards/pabile/p40_ortho/info.json index a4d757be9276..fb64234e5889 100644 --- a/keyboards/pabile/p40_ortho/info.json +++ b/keyboards/pabile/p40_ortho/info.json @@ -1,6 +1,4 @@ { - "keyboard_name": "", - "url": "", "maintainer": "qmk", "width": 10, "height": 4, diff --git a/keyboards/pearl/info.json b/keyboards/pearl/info.json index 5bc4e0494020..c86fcb9dfa7e 100644 --- a/keyboards/pearl/info.json +++ b/keyboards/pearl/info.json @@ -1,8 +1,6 @@ { "keyboard_name": "Pearl", - "url": "", "maintainer": "qmk", - "bootloader": "", "width": 13, "height": 4, "layouts": { diff --git a/keyboards/qwertyydox/info.json b/keyboards/qwertyydox/info.json index 8616f274ea38..2a7efc199d62 100644 --- a/keyboards/qwertyydox/info.json +++ b/keyboards/qwertyydox/info.json @@ -4,6 +4,7 @@ "identifier": "0x1256", "url": "", "maintainer": "qmk", + "bootloader": "caterina", "processor": "atmega32u4", "width": 16.25, "height": 5, diff --git a/keyboards/qwertyydox/rules.mk b/keyboards/qwertyydox/rules.mk index bad5a268afe1..3e66c233ac4a 100644 --- a/keyboards/qwertyydox/rules.mk +++ b/keyboards/qwertyydox/rules.mk @@ -1,16 +1,3 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -# Teensy halfkay -# Pro Micro caterina -# Atmel DFU atmel-dfu -# LUFA DFU lufa-dfu -# QMK DFU qmk-dfu -# ATmega32A bootloadHID -# ATmega328P USBasp -BOOTLOADER = caterina - # Build Options # change to "no" to disable the options, or define them in the Makefile in # the appropriate keymap folder that will get included automatically diff --git a/keyboards/redscarf_i/info.json b/keyboards/redscarf_i/info.json index a2ea71f3a2d3..3bf1ae6934ba 100644 --- a/keyboards/redscarf_i/info.json +++ b/keyboards/redscarf_i/info.json @@ -5,7 +5,6 @@ "width": 4, "layouts": { "LAYOUT_ortho_5x4": { - "height": 5, "key_count": 20, "layout": [ {"x":0, "y":0}, @@ -31,7 +30,6 @@ ] }, "LAYOUT_ortho_6x4": { - "height": 6, "key_count": 24, "layout": [ {"x":0, "y":0}, @@ -61,7 +59,6 @@ ] }, "LAYOUT_numpad_5x4": { - "height": 5, "key_count": 17, "layout": [ {"x":0, "y":0}, @@ -84,7 +81,6 @@ ] }, "LAYOUT_numpad_6x4": { - "height": 6, "key_count": 21, "layout": [ {"x":0, "y":0}, diff --git a/keyboards/waldo/info.json b/keyboards/waldo/info.json index 5cdc12d5ef53..11fa5182ed58 100644 --- a/keyboards/waldo/info.json +++ b/keyboards/waldo/info.json @@ -1,6 +1,4 @@ { - "keyboard_name": "", - "url": "", "maintainer": "qmk", "width": 15, "height": 5, @@ -21,4 +19,4 @@ "layout": [{"x":0, "y":0}, {"x":1, "y":0}, {"x":2, "y":0}, {"x":3, "y":0}, {"x":4, "y":0}, {"x":5, "y":0}, {"x":6, "y":0}, {"x":7, "y":0}, {"x":8, "y":0}, {"x":9, "y":0}, {"x":10, "y":0}, {"x":11, "y":0}, {"x":12, "y":0}, {"x":13, "y":0}, {"x":14, "y":0}, {"x":0, "y":1, "w":1.5}, {"x":1.5, "y":1}, {"x":2.5, "y":1}, {"x":3.5, "y":1}, {"x":4.5, "y":1}, {"x":5.5, "y":1}, {"x":6.5, "y":1}, {"x":7.5, "y":1}, {"x":8.5, "y":1}, {"x":9.5, "y":1}, {"x":10.5, "y":1}, {"x":11.5, "y":1}, {"x":12.5, "y":1}, {"x":13.5, "y":1, "w":1.5}, {"x":0, "y":2, "w":1.75}, {"x":1.75, "y":2}, {"x":2.75, "y":2}, {"x":3.75, "y":2}, {"x":4.75, "y":2}, {"x":5.75, "y":2}, {"x":6.75, "y":2}, {"x":7.75, "y":2}, {"x":8.75, "y":2}, {"x":9.75, "y":2}, {"x":10.75, "y":2}, {"x":11.75, "y":2}, {"x":12.75, "y":2, "w":2.25}, {"x":0, "y":3, "w":2.25}, {"x":2.25, "y":3}, {"x":3.25, "y":3}, {"x":4.25, "y":3}, {"x":5.25, "y":3}, {"x":6.25, "y":3}, {"x":7.25, "y":3}, {"x":8.25, "y":3}, {"x":9.25, "y":3}, {"x":10.25, "y":3}, {"x":11.25, "y":3}, {"x":12.25, "y":3, "w":1.75}, {"x":14, "y":3}, {"x":0, "y":4, "w":1.25}, {"x":1.25, "y":4, "w":1.25}, {"x":2.5, "y":4, "w":1.25}, {"x":3.75, "y":4, "w":6.25}, {"x":10, "y":4, "w":1.25}, {"x":11.25, "y":4, "w":1.25}, {"x":12.5, "y":4, "w":1.25}, {"x":13.75, "y":4, "w":1.25}] } } -} \ No newline at end of file +} diff --git a/keyboards/xd004/info.json b/keyboards/xd004/info.json index 72c15da7f8ab..6f7082a14b01 100644 --- a/keyboards/xd004/info.json +++ b/keyboards/xd004/info.json @@ -1,6 +1,6 @@ { "keyboard_name": "XD004", - "maintainer": "", + "maintainer": "qmk", "width": 4, "height": 1, "layouts": { diff --git a/keyboards/ymdk_np21/info.json b/keyboards/ymdk_np21/info.json index bc5b101c9a41..845c0bb81ee6 100644 --- a/keyboards/ymdk_np21/info.json +++ b/keyboards/ymdk_np21/info.json @@ -1,11 +1,10 @@ { "keyboard_name": "YMDK NP21", - "url": "", "maintainer": "qmk", + "width": 4, + "height": 6.25, "layouts": { "LAYOUT_ortho_6x4": { - "width": 4, - "height": 6.25, "layout": [ {"x": 0, "y": 0}, {"x": 1, "y": 0}, @@ -39,8 +38,6 @@ ] }, "LAYOUT_ortho_4x6": { - "width": 6.25, - "height": 4, "layout": [ {"x": 0, "y": 0}, {"x": 1, "y": 0}, @@ -72,8 +69,6 @@ ] }, "LAYOUT_numpad_6x4": { - "width": 4, - "height": 6.25, "layout": [ {"x": 0, "y": 0}, {"x": 1, "y": 0}, From bff942ff392f21bdd27ee87166b0ec3529b71da5 Mon Sep 17 00:00:00 2001 From: Zach White Date: Wed, 30 Dec 2020 11:21:18 -0800 Subject: [PATCH 06/14] make flake8 happy --- lib/python/qmk/cli/generate/rules_mk.py | 5 +- lib/python/qmk/info.py | 84 ++++++++++++++----------- 2 files changed, 50 insertions(+), 39 deletions(-) diff --git a/lib/python/qmk/cli/generate/rules_mk.py b/lib/python/qmk/cli/generate/rules_mk.py index 570ef5a0d6f7..2a7e9185692f 100755 --- a/lib/python/qmk/cli/generate/rules_mk.py +++ b/lib/python/qmk/cli/generate/rules_mk.py @@ -8,9 +8,10 @@ info_to_rules = { 'bootloader': 'BOOTLOADER', - 'processor': 'MCU' + 'processor': 'MCU', } + @cli.argument('-o', '--output', arg_only=True, type=normpath, help='File to write to') @cli.argument('-q', '--quiet', arg_only=True, action='store_true', help="Quiet mode, only output error messages") @cli.argument('-kb', '--keyboard', help='Keyboard to generate config.h for.') @@ -42,7 +43,7 @@ def generate_rules_mk(cli): if 'features' in kb_info_json: for feature, enabled in kb_info_json['features'].items(): if feature == 'bootmagic_lite' and enabled: - rules_mk_lines.append(f'BOOTMAGIC_ENABLE := lite') + rules_mk_lines.append('BOOTMAGIC_ENABLE := lite') else: feature = feature.upper() enabled = 'yes' if enabled else 'no' diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 39af88f790ab..efd339115b06 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -234,14 +234,14 @@ def _extract_features(info_data, rules): # Special handling for bootmagic which also supports a "lite" mode. if rules.get('BOOTMAGIC_ENABLE') == 'lite': rules['BOOTMAGIC_LITE_ENABLE'] = 'on' - del(rules['BOOTMAGIC_ENABLE']) + del rules['BOOTMAGIC_ENABLE'] if rules.get('BOOTMAGIC_ENABLE') == 'full': rules['BOOTMAGIC_ENABLE'] = 'on' # Skip non-boolean features we haven't implemented special handling for for feature in 'HAPTIC_ENABLE', 'QWIIC_ENABLE': if rules.get(feature): - del(rules[feature]) + del rules[feature] # Process the rest of the rules as booleans for key, value in rules.items(): @@ -337,6 +337,45 @@ def _extract_rgblight(info_data, config_c): return info_data +def _extract_pins(pins): + """Returns a list of pins from a comma separated string of pins. + """ + pins = [pin.strip() for pin in pins.split(',') if pin] + + for pin in pins: + if pin[0] not in 'ABCDEFGHIJK' or not pin[1].isdigit(): + raise ValueError(f'Invalid pin: {pin}') + + return pins + + +def _extract_direct_matrix(info_data, direct_pins): + """ + """ + info_data['matrix_pins'] = {} + direct_pin_array = [] + + while direct_pins[-1] != '}': + direct_pins = direct_pins[:-1] + + for row in direct_pins.split('},{'): + if row.startswith('{'): + row = row[1:] + + if row.endswith('}'): + row = row[:-1] + + direct_pin_array.append([]) + + for pin in row.split(','): + if pin == 'NO_PIN': + pin = None + + direct_pin_array[-1].append(pin) + + return direct_pin_array + + def _extract_matrix_info(info_data, config_c): """Populate the matrix information. """ @@ -349,53 +388,24 @@ def _extract_matrix_info(info_data, config_c): _log_warning(info_data, 'Matrix size is specified in both info.json and config.h, the config.h values win.') info_data['matrix_size'] = { - 'rows': compute(config_c.get('MATRIX_ROWS', '0')), 'cols': compute(config_c.get('MATRIX_COLS', '0')), + 'rows': compute(config_c.get('MATRIX_ROWS', '0')), } if row_pins and col_pins: if 'matrix_pins' in info_data: _log_warning(info_data, 'Matrix pins are specified in both info.json and config.h, the config.h values win.') - info_data['matrix_pins'] = {} - - # FIXME(skullydazed/anyone): Should really check every pin, not just the first - if row_pins: - row_pins = [pin.strip() for pin in row_pins.split(',') if pin] - if row_pins[0][0] in 'ABCDEFGHIJK' and row_pins[0][1].isdigit(): - info_data['matrix_pins']['rows'] = row_pins - - if col_pins: - col_pins = [pin.strip() for pin in col_pins.split(',') if pin] - if col_pins[0][0] in 'ABCDEFGHIJK' and col_pins[0][1].isdigit(): - info_data['matrix_pins']['cols'] = col_pins + info_data['matrix_pins'] = { + 'cols': _extract_pins(col_pins), + 'rows': _extract_pins(row_pins), + } if direct_pins: if 'matrix_pins' in info_data: _log_warning(info_data, 'Direct pins are specified in both info.json and config.h, the config.h values win.') - info_data['matrix_pins'] = {} - direct_pin_array = [] - - while direct_pins[-1] != '}': - direct_pins = direct_pins[:-1] - - for row in direct_pins.split('},{'): - if row.startswith('{'): - row = row[1:] - - if row.endswith('}'): - row = row[:-1] - - direct_pin_array.append([]) - - for pin in row.split(','): - if pin == 'NO_PIN': - pin = None - - direct_pin_array[-1].append(pin) - - info_data['matrix_pins']['direct'] = direct_pin_array + info_data['matrix_pins']['direct'] = _extract_direct_matrix(info_data, direct_pins) return info_data From b749953fa758fac5bd971d27f3e5d8225bf3744e Mon Sep 17 00:00:00 2001 From: Zach White Date: Wed, 6 Jan 2021 10:13:25 -0800 Subject: [PATCH 07/14] fix rgblight properties --- lib/python/qmk/cli/generate/config_h.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/python/qmk/cli/generate/config_h.py b/lib/python/qmk/cli/generate/config_h.py index 09aa0041f4df..15d4fbf2dd0f 100755 --- a/lib/python/qmk/cli/generate/config_h.py +++ b/lib/python/qmk/cli/generate/config_h.py @@ -173,9 +173,9 @@ def rgblight(config): for json_key, config_key in rgblight_properties.items(): if json_key in config: rgblight_config.append('') - rgblight_config.append('#ifndef %s' % (config_key,)) - rgblight_config.append('# define %s %s' % (config_key, config[json_key])) - rgblight_config.append('#endif // %s' % (config_key,)) + rgblight_config.append('#ifndef %s' % (config_key[0],)) + rgblight_config.append('# define %s %s' % (config_key[0], config[json_key])) + rgblight_config.append('#endif // %s' % (config_key[0],)) for json_key, config_key in rgblight_toggles.items(): if config.get(json_key): From 68da9cd19658071f0c2f22e97956303281703176 Mon Sep 17 00:00:00 2001 From: Zach White Date: Wed, 6 Jan 2021 10:28:58 -0800 Subject: [PATCH 08/14] change invalid pin from error to warning --- lib/python/qmk/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index efd339115b06..89c08809bae9 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -344,7 +344,7 @@ def _extract_pins(pins): for pin in pins: if pin[0] not in 'ABCDEFGHIJK' or not pin[1].isdigit(): - raise ValueError(f'Invalid pin: {pin}') + cli.log.warning(f'Nonstandard pin format: {pin}') return pins From e41762be64c170f42ab3f8aa6b7e3078e5895e92 Mon Sep 17 00:00:00 2001 From: Zach White Date: Wed, 6 Jan 2021 10:33:30 -0800 Subject: [PATCH 09/14] loosen up the schema to allow any pin format --- data/schemas/keyboard.jsonschema | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index 9355ee49bd3c..f250ffd8a9a4 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -163,8 +163,7 @@ "items": { "oneOf": [ { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" + "type": "string" }, { "type": "null" @@ -176,15 +175,13 @@ "cols": { "type": "array", "items": { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" + "type": "string" } }, "rows": { "type": "array", "items": { - "type": "string", - "pattern": "^[A-K]\\d{1,2}$" + "type": "string" } } } From 96d88316da49c3d007298cdd9555966e91fdc64c Mon Sep 17 00:00:00 2001 From: Zach White Date: Wed, 6 Jan 2021 10:37:31 -0800 Subject: [PATCH 10/14] Revert "change invalid pin from error to warning" This reverts commit 68da9cd19658071f0c2f22e97956303281703176. --- lib/python/qmk/info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/python/qmk/info.py b/lib/python/qmk/info.py index 89c08809bae9..efd339115b06 100644 --- a/lib/python/qmk/info.py +++ b/lib/python/qmk/info.py @@ -344,7 +344,7 @@ def _extract_pins(pins): for pin in pins: if pin[0] not in 'ABCDEFGHIJK' or not pin[1].isdigit(): - cli.log.warning(f'Nonstandard pin format: {pin}') + raise ValueError(f'Invalid pin: {pin}') return pins From 9f818ffbd85c1fda9598a50c9b06a0fe1c281133 Mon Sep 17 00:00:00 2001 From: Zach White Date: Wed, 6 Jan 2021 10:37:53 -0800 Subject: [PATCH 11/14] Revert "loosen up the schema to allow any pin format" This reverts commit e41762be64c170f42ab3f8aa6b7e3078e5895e92. --- data/schemas/keyboard.jsonschema | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/data/schemas/keyboard.jsonschema b/data/schemas/keyboard.jsonschema index f250ffd8a9a4..9355ee49bd3c 100644 --- a/data/schemas/keyboard.jsonschema +++ b/data/schemas/keyboard.jsonschema @@ -163,7 +163,8 @@ "items": { "oneOf": [ { - "type": "string" + "type": "string", + "pattern": "^[A-K]\\d{1,2}$" }, { "type": "null" @@ -175,13 +176,15 @@ "cols": { "type": "array", "items": { - "type": "string" + "type": "string", + "pattern": "^[A-K]\\d{1,2}$" } }, "rows": { "type": "array", "items": { - "type": "string" + "type": "string", + "pattern": "^[A-K]\\d{1,2}$" } } } From bce9e55edea6726a24bddda24d7540a6afeaef68 Mon Sep 17 00:00:00 2001 From: Zach White Date: Wed, 6 Jan 2021 10:42:37 -0800 Subject: [PATCH 12/14] change matrix/m20add to use non-standard names for non-standard pins --- keyboards/matrix/m20add/config.h | 6 ++++-- keyboards/matrix/m20add/matrix.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/keyboards/matrix/m20add/config.h b/keyboards/matrix/m20add/config.h index 8c3f922ab91e..316434649515 100644 --- a/keyboards/matrix/m20add/config.h +++ b/keyboards/matrix/m20add/config.h @@ -45,7 +45,8 @@ #define COL15_MASK 0x04 #define COL16_MASK 0x02 -#define MATRIX_ROW_PINS { \ +// Note: MATRIX_ROW_PINS only works with standard pin names. +#define MATRIX_M20_ROW_PINS { \ DEF_PIN(TCA6424_PORT2, 7), \ DEF_PIN(TCA6424_PORT2, 6), \ DEF_PIN(TCA6424_PORT2, 0), \ @@ -53,7 +54,8 @@ DEF_PIN(TCA6424_PORT2, 4), \ DEF_PIN(TCA6424_PORT2, 5) } -#define MATRIX_COL_PINS { \ +// Note: MATRIX_COL_PINS only works with standard pin names. +#define MATRIX_M20_COL_PINS { \ DEF_PIN(TCA6424_PORT2, 1), \ DEF_PIN(TCA6424_PORT1, 7), \ DEF_PIN(TCA6424_PORT1, 6), \ diff --git a/keyboards/matrix/m20add/matrix.c b/keyboards/matrix/m20add/matrix.c index b17643fea82e..e9ddbdff62b4 100644 --- a/keyboards/matrix/m20add/matrix.c +++ b/keyboards/matrix/m20add/matrix.c @@ -10,7 +10,7 @@ #include "tca6424.h" #include "m20add.h" -static const uint16_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; +static const uint16_t col_pins[MATRIX_COLS] = MATRIX_M20_COL_PINS; void matrix_init_custom(void) { From ae31ea5e1a6138a95278c61c498d1dd68a3c1b49 Mon Sep 17 00:00:00 2001 From: Zach White Date: Thu, 7 Jan 2021 11:58:18 -0800 Subject: [PATCH 13/14] fix travis --- util/travis_utils.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/util/travis_utils.sh b/util/travis_utils.sh index e949946e222b..1aaab812caea 100755 --- a/util/travis_utils.sh +++ b/util/travis_utils.sh @@ -23,3 +23,6 @@ if command -v docker >/dev/null; then docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container bin/qmk "$@" } fi + +# Install updated python deps +python3 -m pip install -U -r requirements.txt From 7e36c52c7bf2fad9d568f3238f5a5d44898e6cf2 Mon Sep 17 00:00:00 2001 From: Zach White Date: Thu, 7 Jan 2021 21:03:36 -0800 Subject: [PATCH 14/14] remove the python dep update --- util/travis_utils.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/util/travis_utils.sh b/util/travis_utils.sh index 1aaab812caea..e949946e222b 100755 --- a/util/travis_utils.sh +++ b/util/travis_utils.sh @@ -23,6 +23,3 @@ if command -v docker >/dev/null; then docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container bin/qmk "$@" } fi - -# Install updated python deps -python3 -m pip install -U -r requirements.txt