diff options
| author | Ryan <fauxpark@gmail.com> | 2021-11-05 08:08:52 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-05 08:08:52 +1100 |
| commit | 94018367278f44fcf3eab8a86525f2b257ecf4ba (patch) | |
| tree | c926797b833b2c51f3b458bd0726944b21fdf0a8 | |
| parent | 45a8176e325130775b51058199e69aa8f06c88cc (diff) | |
| download | qmk_firmware-94018367278f44fcf3eab8a86525f2b257ecf4ba.tar.gz qmk_firmware-94018367278f44fcf3eab8a86525f2b257ecf4ba.zip | |
Map `PRODUCT` define to `keyboard_name` (#14372)
* Map `PRODUCT` define to `keyboard_name`
* Fix tests
* Fix last test
| -rw-r--r-- | data/mappings/info_config.json | 2 | ||||
| -rw-r--r-- | keyboards/handwired/pytest/basic/info.json | 13 | ||||
| -rw-r--r-- | keyboards/handwired/pytest/config.h | 7 | ||||
| -rw-r--r-- | keyboards/handwired/pytest/info.json | 10 | ||||
| -rw-r--r-- | lib/python/qmk/cli/generate/dfu_header.py | 2 | ||||
| -rw-r--r-- | lib/python/qmk/tests/minimal_info.json | 2 | ||||
| -rw-r--r-- | lib/python/qmk/tests/test_cli_commands.py | 10 |
7 files changed, 24 insertions, 22 deletions
diff --git a/data/mappings/info_config.json b/data/mappings/info_config.json index 72bb0f4a1..f1e06dfea 100644 --- a/data/mappings/info_config.json +++ b/data/mappings/info_config.json | |||
| @@ -68,7 +68,7 @@ | |||
| 68 | "RGBLIGHT_SLEEP": {"info_key": "rgblight.sleep", "value_type": "bool"}, | 68 | "RGBLIGHT_SLEEP": {"info_key": "rgblight.sleep", "value_type": "bool"}, |
| 69 | "RGBLIGHT_SPLIT": {"info_key": "rgblight.split", "value_type": "bool"}, | 69 | "RGBLIGHT_SPLIT": {"info_key": "rgblight.split", "value_type": "bool"}, |
| 70 | "RGBW": {"info_key": "rgblight.rgbw", "value_type": "bool"}, | 70 | "RGBW": {"info_key": "rgblight.rgbw", "value_type": "bool"}, |
| 71 | "PRODUCT": {"info_key": "keyboard_folder", "to_json": false}, | 71 | "PRODUCT": {"info_key": "keyboard_name"}, |
| 72 | "PRODUCT_ID": {"info_key": "usb.pid", "value_type": "hex"}, | 72 | "PRODUCT_ID": {"info_key": "usb.pid", "value_type": "hex"}, |
| 73 | "VENDOR_ID": {"info_key": "usb.vid", "value_type": "hex"}, | 73 | "VENDOR_ID": {"info_key": "usb.vid", "value_type": "hex"}, |
| 74 | "QMK_ESC_OUTPUT": {"info_key": "qmk_lufa_bootloader.esc_output"}, | 74 | "QMK_ESC_OUTPUT": {"info_key": "qmk_lufa_bootloader.esc_output"}, |
diff --git a/keyboards/handwired/pytest/basic/info.json b/keyboards/handwired/pytest/basic/info.json index ed052a14a..af57447d3 100644 --- a/keyboards/handwired/pytest/basic/info.json +++ b/keyboards/handwired/pytest/basic/info.json | |||
| @@ -1,10 +1,9 @@ | |||
| 1 | { | 1 | { |
| 2 | "maintainer": "qmk", | 2 | "layouts": { |
| 3 | "layouts": { | 3 | "LAYOUT_custom": { |
| 4 | "LAYOUT_custom": { | 4 | "layout": [ |
| 5 | "layout": [ | 5 | { "label": "KC_Q", "matrix": [0, 0], "w": 1, "x": 0, "y": 0 } |
| 6 | { "label": "KC_Q", "matrix": [0, 0], "w": 1, "x": 0, "y": 0 } | 6 | ] |
| 7 | ] | 7 | } |
| 8 | } | 8 | } |
| 9 | } | ||
| 10 | } | 9 | } |
diff --git a/keyboards/handwired/pytest/config.h b/keyboards/handwired/pytest/config.h index 64cf35312..f03597a7d 100644 --- a/keyboards/handwired/pytest/config.h +++ b/keyboards/handwired/pytest/config.h | |||
| @@ -2,13 +2,6 @@ | |||
| 2 | 2 | ||
| 3 | #include "config_common.h" | 3 | #include "config_common.h" |
| 4 | 4 | ||
| 5 | /* USB Device descriptor parameter */ | ||
| 6 | #define VENDOR_ID 0xFEED | ||
| 7 | #define PRODUCT_ID 0x6465 | ||
| 8 | #define DEVICE_VER 0x0001 | ||
| 9 | #define MANUFACTURER none | ||
| 10 | #define PRODUCT pytest | ||
| 11 | |||
| 12 | /* key matrix size */ | 5 | /* key matrix size */ |
| 13 | #define MATRIX_ROWS 1 | 6 | #define MATRIX_ROWS 1 |
| 14 | #define MATRIX_COLS 1 | 7 | #define MATRIX_COLS 1 |
diff --git a/keyboards/handwired/pytest/info.json b/keyboards/handwired/pytest/info.json new file mode 100644 index 000000000..5c941af9b --- /dev/null +++ b/keyboards/handwired/pytest/info.json | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | { | ||
| 2 | "keyboard_name": "pytest", | ||
| 3 | "manufacturer": "none", | ||
| 4 | "maintainer": "qmk", | ||
| 5 | "usb": { | ||
| 6 | "vid": "0xFEED", | ||
| 7 | "pid": "0x6465", | ||
| 8 | "device_ver": "0x0001" | ||
| 9 | } | ||
| 10 | } | ||
diff --git a/lib/python/qmk/cli/generate/dfu_header.py b/lib/python/qmk/cli/generate/dfu_header.py index 5a1b109f1..7fb585fc7 100644 --- a/lib/python/qmk/cli/generate/dfu_header.py +++ b/lib/python/qmk/cli/generate/dfu_header.py | |||
| @@ -32,7 +32,7 @@ def generate_dfu_header(cli): | |||
| 32 | 32 | ||
| 33 | keyboard_h_lines = ['/* This file was generated by `qmk generate-dfu-header`. Do not edit or copy.', ' */', '', '#pragma once'] | 33 | keyboard_h_lines = ['/* This file was generated by `qmk generate-dfu-header`. Do not edit or copy.', ' */', '', '#pragma once'] |
| 34 | keyboard_h_lines.append(f'#define MANUFACTURER {kb_info_json["manufacturer"]}') | 34 | keyboard_h_lines.append(f'#define MANUFACTURER {kb_info_json["manufacturer"]}') |
| 35 | keyboard_h_lines.append(f'#define PRODUCT {cli.config.generate_dfu_header.keyboard} Bootloader') | 35 | keyboard_h_lines.append(f'#define PRODUCT {kb_info_json["keyboard_name"]} Bootloader') |
| 36 | 36 | ||
| 37 | # Optional | 37 | # Optional |
| 38 | if 'qmk_lufa_bootloader.esc_output' in kb_info_json: | 38 | if 'qmk_lufa_bootloader.esc_output' in kb_info_json: |
diff --git a/lib/python/qmk/tests/minimal_info.json b/lib/python/qmk/tests/minimal_info.json index 11ef12fef..3aae4722b 100644 --- a/lib/python/qmk/tests/minimal_info.json +++ b/lib/python/qmk/tests/minimal_info.json | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | "layouts": { | 4 | "layouts": { |
| 5 | "LAYOUT": { | 5 | "LAYOUT": { |
| 6 | "layout": [ | 6 | "layout": [ |
| 7 | { "label": "KC_A", "x": 0, "y": 0, "matrix": [0, 0] } | 7 | { "label": "KC_A", "matrix": [0, 0], "x": 0, "y": 0 } |
| 8 | ] | 8 | ] |
| 9 | } | 9 | } |
| 10 | } | 10 | } |
diff --git a/lib/python/qmk/tests/test_cli_commands.py b/lib/python/qmk/tests/test_cli_commands.py index e4eaef899..9f2c258ab 100644 --- a/lib/python/qmk/tests/test_cli_commands.py +++ b/lib/python/qmk/tests/test_cli_commands.py | |||
| @@ -151,7 +151,7 @@ def test_json2c_stdin(): | |||
| 151 | def test_info(): | 151 | def test_info(): |
| 152 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic') | 152 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic') |
| 153 | check_returncode(result) | 153 | check_returncode(result) |
| 154 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout | 154 | assert 'Keyboard Name: pytest' in result.stdout |
| 155 | assert 'Processor: atmega32u4' in result.stdout | 155 | assert 'Processor: atmega32u4' in result.stdout |
| 156 | assert 'Layout:' not in result.stdout | 156 | assert 'Layout:' not in result.stdout |
| 157 | assert 'k0' not in result.stdout | 157 | assert 'k0' not in result.stdout |
| @@ -160,7 +160,7 @@ def test_info(): | |||
| 160 | def test_info_keyboard_render(): | 160 | def test_info_keyboard_render(): |
| 161 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-l') | 161 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-l') |
| 162 | check_returncode(result) | 162 | check_returncode(result) |
| 163 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout | 163 | assert 'Keyboard Name: pytest' in result.stdout |
| 164 | assert 'Processor: atmega32u4' in result.stdout | 164 | assert 'Processor: atmega32u4' in result.stdout |
| 165 | assert 'Layouts:' in result.stdout | 165 | assert 'Layouts:' in result.stdout |
| 166 | assert 'k0' in result.stdout | 166 | assert 'k0' in result.stdout |
| @@ -169,7 +169,7 @@ def test_info_keyboard_render(): | |||
| 169 | def test_info_keymap_render(): | 169 | def test_info_keymap_render(): |
| 170 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-km', 'default_json') | 170 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-km', 'default_json') |
| 171 | check_returncode(result) | 171 | check_returncode(result) |
| 172 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout | 172 | assert 'Keyboard Name: pytest' in result.stdout |
| 173 | assert 'Processor: atmega32u4' in result.stdout | 173 | assert 'Processor: atmega32u4' in result.stdout |
| 174 | 174 | ||
| 175 | if is_windows: | 175 | if is_windows: |
| @@ -181,7 +181,7 @@ def test_info_keymap_render(): | |||
| 181 | def test_info_matrix_render(): | 181 | def test_info_matrix_render(): |
| 182 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-m') | 182 | result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-m') |
| 183 | check_returncode(result) | 183 | check_returncode(result) |
| 184 | assert 'Keyboard Name: handwired/pytest/basic' in result.stdout | 184 | assert 'Keyboard Name: pytest' in result.stdout |
| 185 | assert 'Processor: atmega32u4' in result.stdout | 185 | assert 'Processor: atmega32u4' in result.stdout |
| 186 | assert 'LAYOUT_ortho_1x1' in result.stdout | 186 | assert 'LAYOUT_ortho_1x1' in result.stdout |
| 187 | 187 | ||
| @@ -242,7 +242,7 @@ def test_generate_config_h(): | |||
| 242 | assert '# define DESCRIPTION handwired/pytest/basic' in result.stdout | 242 | assert '# define DESCRIPTION handwired/pytest/basic' in result.stdout |
| 243 | assert '# define DIODE_DIRECTION COL2ROW' in result.stdout | 243 | assert '# define DIODE_DIRECTION COL2ROW' in result.stdout |
| 244 | assert '# define MANUFACTURER none' in result.stdout | 244 | assert '# define MANUFACTURER none' in result.stdout |
| 245 | assert '# define PRODUCT handwired/pytest/basic' in result.stdout | 245 | assert '# define PRODUCT pytest' in result.stdout |
| 246 | assert '# define PRODUCT_ID 0x6465' in result.stdout | 246 | assert '# define PRODUCT_ID 0x6465' in result.stdout |
| 247 | assert '# define VENDOR_ID 0xFEED' in result.stdout | 247 | assert '# define VENDOR_ID 0xFEED' in result.stdout |
| 248 | assert '# define MATRIX_COLS 1' in result.stdout | 248 | assert '# define MATRIX_COLS 1' in result.stdout |
