mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-04-27 09:31:30 +00:00
Merge remote-tracking branch 'origin/develop' into xap
This commit is contained in:
commit
e0de07773d
33
.github/workflows/regen.yml
vendored
Normal file
33
.github/workflows/regen.yml
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
name: PR Regenerate Files
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'data/constants/**'
|
||||||
|
- 'lib/python/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
regen:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
container: qmkfm/qmk_cli
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Run qmk generators
|
||||||
|
run: |
|
||||||
|
util/regen.sh
|
||||||
|
git diff
|
||||||
|
|
||||||
|
- name: Fail when regeneration required
|
||||||
|
run: |
|
||||||
|
git diff
|
||||||
|
for file in $(git diff --name-only); do
|
||||||
|
echo "File '${file}' Requires Regeneration"
|
||||||
|
echo "::error file=${file}::Requires Regeneration"
|
||||||
|
done
|
||||||
|
test -z "$(git diff --name-only)"
|
43
.github/workflows/regen_push.yml
vendored
Normal file
43
.github/workflows/regen_push.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
name: Regenerate Files
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
regen:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
container: qmkfm/qmk_cli
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Run qmk generators
|
||||||
|
run: |
|
||||||
|
util/regen.sh
|
||||||
|
git diff
|
||||||
|
|
||||||
|
- uses: rlespinasse/github-slug-action@v3.x
|
||||||
|
|
||||||
|
- name: Become QMK Bot
|
||||||
|
run: |
|
||||||
|
git config user.name 'QMK Bot'
|
||||||
|
git config user.email 'hello@qmk.fm'
|
||||||
|
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v4
|
||||||
|
if: ${{ github.repository == 'qmk/qmk_firmware'}}
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.QMK_BOT_TOKEN }}
|
||||||
|
delete-branch: true
|
||||||
|
branch: bugfix/format_${{ env.GITHUB_REF_SLUG }}
|
||||||
|
author: QMK Bot <hello@qmk.fm>
|
||||||
|
committer: QMK Bot <hello@qmk.fm>
|
||||||
|
commit-message: Regenerate Files
|
||||||
|
title: '[CI] Regenerate Files'
|
@ -1,3 +1,4 @@
|
|||||||
|
import platform
|
||||||
import shutil
|
import shutil
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
@ -56,6 +57,20 @@ def _check_dfu_programmer_version():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def _find_usb_device(vid_hex, pid_hex):
|
||||||
|
# WSL doesnt have access to USB - use powershell instead...?
|
||||||
|
if 'microsoft' in platform.uname().release.lower():
|
||||||
|
ret = cli.run(['powershell.exe', '-command', 'Get-PnpDevice -PresentOnly | Select-Object -Property InstanceId'])
|
||||||
|
if f'USB\\VID_{vid_hex:04X}&PID_{pid_hex:04X}' in ret.stdout:
|
||||||
|
return (vid_hex, pid_hex)
|
||||||
|
else:
|
||||||
|
with DelayedKeyboardInterrupt():
|
||||||
|
# PyUSB does not like to be interrupted by Ctrl-C
|
||||||
|
# therefore we catch the interrupt with a custom handler
|
||||||
|
# and only process it once pyusb finished
|
||||||
|
return usb.core.find(idVendor=vid_hex, idProduct=pid_hex)
|
||||||
|
|
||||||
|
|
||||||
def _find_bootloader():
|
def _find_bootloader():
|
||||||
# To avoid running forever in the background, only look for bootloaders for 10min
|
# To avoid running forever in the background, only look for bootloaders for 10min
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
@ -64,11 +79,7 @@ def _find_bootloader():
|
|||||||
for vid, pid in BOOTLOADER_VIDS_PIDS[bl]:
|
for vid, pid in BOOTLOADER_VIDS_PIDS[bl]:
|
||||||
vid_hex = int(f'0x{vid}', 0)
|
vid_hex = int(f'0x{vid}', 0)
|
||||||
pid_hex = int(f'0x{pid}', 0)
|
pid_hex = int(f'0x{pid}', 0)
|
||||||
with DelayedKeyboardInterrupt():
|
dev = _find_usb_device(vid_hex, pid_hex)
|
||||||
# PyUSB does not like to be interrupted by Ctrl-C
|
|
||||||
# therefore we catch the interrupt with a custom handler
|
|
||||||
# and only process it once pyusb finished
|
|
||||||
dev = usb.core.find(idVendor=vid_hex, idProduct=pid_hex)
|
|
||||||
if dev:
|
if dev:
|
||||||
if bl == 'atmel-dfu':
|
if bl == 'atmel-dfu':
|
||||||
details = _PID_TO_MCU[pid]
|
details = _PID_TO_MCU[pid]
|
||||||
@ -178,25 +189,25 @@ def flasher(mcu, file):
|
|||||||
# Add a small sleep to avoid race conditions
|
# Add a small sleep to avoid race conditions
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if bl == 'atmel-dfu':
|
if bl == 'atmel-dfu':
|
||||||
_flash_atmel_dfu(details, file.name)
|
_flash_atmel_dfu(details, file)
|
||||||
elif bl == 'caterina':
|
elif bl == 'caterina':
|
||||||
if _flash_caterina(details, file.name):
|
if _flash_caterina(details, file):
|
||||||
return (True, "The Caterina bootloader was found but is not writable. Check 'qmk doctor' output for advice.")
|
return (True, "The Caterina bootloader was found but is not writable. Check 'qmk doctor' output for advice.")
|
||||||
elif bl == 'hid-bootloader':
|
elif bl == 'hid-bootloader':
|
||||||
if mcu:
|
if mcu:
|
||||||
if _flash_hid_bootloader(mcu, details, file.name):
|
if _flash_hid_bootloader(mcu, details, file):
|
||||||
return (True, "Please make sure 'teensy_loader_cli' or 'hid_bootloader_cli' is available on your system.")
|
return (True, "Please make sure 'teensy_loader_cli' or 'hid_bootloader_cli' is available on your system.")
|
||||||
else:
|
else:
|
||||||
return (True, "Specifying the MCU with '-m' is necessary for HalfKay/HID bootloaders!")
|
return (True, "Specifying the MCU with '-m' is necessary for HalfKay/HID bootloaders!")
|
||||||
elif bl == 'stm32-dfu' or bl == 'apm32-dfu' or bl == 'gd32v-dfu' or bl == 'kiibohd':
|
elif bl == 'stm32-dfu' or bl == 'apm32-dfu' or bl == 'gd32v-dfu' or bl == 'kiibohd':
|
||||||
_flash_dfu_util(details, file.name)
|
_flash_dfu_util(details, file)
|
||||||
elif bl == 'usbasploader' or bl == 'usbtinyisp':
|
elif bl == 'usbasploader' or bl == 'usbtinyisp':
|
||||||
if mcu:
|
if mcu:
|
||||||
_flash_isp(mcu, bl, file.name)
|
_flash_isp(mcu, bl, file)
|
||||||
else:
|
else:
|
||||||
return (True, "Specifying the MCU with '-m' is necessary for ISP flashing!")
|
return (True, "Specifying the MCU with '-m' is necessary for ISP flashing!")
|
||||||
elif bl == 'md-boot':
|
elif bl == 'md-boot':
|
||||||
_flash_mdloader(file.name)
|
_flash_mdloader(file)
|
||||||
else:
|
else:
|
||||||
return (True, "Known bootloader found but flashing not currently supported!")
|
return (True, "Known bootloader found but flashing not currently supported!")
|
||||||
|
|
||||||
|
@ -1,65 +0,0 @@
|
|||||||
from pathlib import Path
|
|
||||||
|
|
||||||
langs = set()
|
|
||||||
files = Path('quantum/keymap_extras/').glob('keymap_*.h')
|
|
||||||
for file in files:
|
|
||||||
langs.add(file.stem.replace('keymap_', ''))
|
|
||||||
|
|
||||||
for lang in langs:
|
|
||||||
try:
|
|
||||||
file = Path(f'quantum/keymap_extras/keymap_{lang}.h')
|
|
||||||
print(f'Reading:{file}')
|
|
||||||
collect = None
|
|
||||||
out = []
|
|
||||||
out += ['{']
|
|
||||||
out += [' "aliases": {']
|
|
||||||
lines = file.read_text(encoding='utf-8').split('\n')
|
|
||||||
for line in lines:
|
|
||||||
|
|
||||||
if line.startswith("// Row"):
|
|
||||||
# print(line)
|
|
||||||
continue
|
|
||||||
elif line.startswith("/*******************************************************************************"):
|
|
||||||
raise Exception(f'Skipping:{file}')
|
|
||||||
elif '/*' in line:
|
|
||||||
collect = [line]
|
|
||||||
elif '*/' in line:
|
|
||||||
collect += [line]
|
|
||||||
if 'copyright' in collect[0].lower():
|
|
||||||
collect = None
|
|
||||||
continue
|
|
||||||
out += collect
|
|
||||||
collect = None
|
|
||||||
elif collect:
|
|
||||||
collect += [line]
|
|
||||||
|
|
||||||
elif '#define' in line:
|
|
||||||
define = line.split()
|
|
||||||
while len(define) < 5:
|
|
||||||
define.append("")
|
|
||||||
|
|
||||||
if define[4] == "(backslash)":
|
|
||||||
define[4] = '\\\\'
|
|
||||||
|
|
||||||
define[4] = " ".join(define[4:]).strip()
|
|
||||||
define[4] = define[4].replace('"', '\\"')
|
|
||||||
|
|
||||||
if define[4]:
|
|
||||||
out += [f' "{define[2]}": {{']
|
|
||||||
out += [f' "key": "{define[1]}",']
|
|
||||||
out += [f' "label": "{define[4]}",']
|
|
||||||
out += [f' }}']
|
|
||||||
else:
|
|
||||||
out += [f' "{define[2]}": {{']
|
|
||||||
out += [f' "key": "{define[1]}"']
|
|
||||||
out += [f' }}']
|
|
||||||
|
|
||||||
out += [' }']
|
|
||||||
out += ['}']
|
|
||||||
|
|
||||||
dump = Path(f'data/constants/keycodes/extras/keycodes_{lang}_0.0.1.hjson')
|
|
||||||
print(f'Writing:{dump}')
|
|
||||||
dump.write_text("\n".join(out), encoding='utf-8')
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
for lang in $(find data/constants/keycodes/extras/ -type f -printf "%f\n" | sed "s/keycodes_//g" | sed "s/_[0-9].*//"); do
|
|
||||||
data=$(qmk generate-keycode-extras --version latest --lang $lang)
|
|
||||||
if [ "$?" == "0" ]; then
|
|
||||||
echo "$data" > quantum/keymap_extras/keymap_$lang.h
|
|
||||||
fi
|
|
||||||
done
|
|
9
util/regen.sh
Executable file
9
util/regen.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
qmk generate-rgb-breathe-table -o quantum/rgblight/rgblight_breathe_table.h
|
||||||
|
qmk generate-keycodes --version latest -o quantum/keycodes.h
|
||||||
|
|
||||||
|
for lang in $(find data/constants/keycodes/extras/ -type f -printf "%f\n" | sed "s/keycodes_\(.*\)_[0-9].*/\1/"); do
|
||||||
|
qmk generate-keycode-extras --version latest --lang $lang -o quantum/keymap_extras/keymap_$lang.h
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user