mirror of
https://github.com/Keychron/qmk_firmware.git
synced 2024-11-21 16:06:35 +06:00
Fix WAIT_FOR_USB handling (#23598)
This commit is contained in:
parent
c8ceda461a
commit
16cca527a6
|
@ -44,7 +44,7 @@
|
||||||
"SPLIT_TRANSPORT": {"info_key": "split.transport.protocol", "to_c": false},
|
"SPLIT_TRANSPORT": {"info_key": "split.transport.protocol", "to_c": false},
|
||||||
"STENO_ENABLE": {"info_key": "stenography.enabled", "value_type": "bool"},
|
"STENO_ENABLE": {"info_key": "stenography.enabled", "value_type": "bool"},
|
||||||
"STENO_PROTOCOL": {"info_key": "stenography.protocol"},
|
"STENO_PROTOCOL": {"info_key": "stenography.protocol"},
|
||||||
"WAIT_FOR_USB": {"info_key": "usb.wait_for", "value_type": "bool"},
|
"USB_WAIT_FOR_ENUMERATION": {"info_key": "usb.wait_for_enumeration", "value_type": "bool"},
|
||||||
"WEAR_LEVELING_DRIVER": {"info_key": "eeprom.wear_leveling.driver"},
|
"WEAR_LEVELING_DRIVER": {"info_key": "eeprom.wear_leveling.driver"},
|
||||||
"WS2812_DRIVER": {"info_key": "ws2812.driver"},
|
"WS2812_DRIVER": {"info_key": "ws2812.driver"},
|
||||||
|
|
||||||
|
|
|
@ -894,7 +894,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"suspend_wakeup_delay": {"$ref": "qmk.definitions.v1#/unsigned_int"},
|
"suspend_wakeup_delay": {"$ref": "qmk.definitions.v1#/unsigned_int"},
|
||||||
"wait_for": {"type": "boolean"}
|
"wait_for_enumeration": {"type": "boolean"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"qmk": {
|
"qmk": {
|
||||||
|
|
|
@ -446,7 +446,7 @@ Use these to enable or disable building certain features. The more you have enab
|
||||||
* Allows replacing the standard matrix scanning routine with a custom one.
|
* Allows replacing the standard matrix scanning routine with a custom one.
|
||||||
* `DEBOUNCE_TYPE`
|
* `DEBOUNCE_TYPE`
|
||||||
* Allows replacing the standard key debouncing routine with an alternative or custom one.
|
* Allows replacing the standard key debouncing routine with an alternative or custom one.
|
||||||
* `WAIT_FOR_USB`
|
* `USB_WAIT_FOR_ENUMERATION`
|
||||||
* Forces the keyboard to wait for a USB connection to be established before it starts up
|
* Forces the keyboard to wait for a USB connection to be established before it starts up
|
||||||
* `NO_USB_STARTUP_CHECK`
|
* `NO_USB_STARTUP_CHECK`
|
||||||
* Disables usb suspend check after keyboard startup. Usually the keyboard waits for the host to wake it up before any tasks are performed. This is useful for split keyboards as one half will not get a wakeup call but must send commands to the master.
|
* Disables usb suspend check after keyboard startup. Usually the keyboard waits for the host to wake it up before any tasks are performed. This is useful for split keyboards as one half will not get a wakeup call but must send commands to the master.
|
||||||
|
|
|
@ -378,7 +378,7 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||||
* 標準マトリックス走査ルーチンを独自のものに置き換えることができます。
|
* 標準マトリックス走査ルーチンを独自のものに置き換えることができます。
|
||||||
* `DEBOUNCE_TYPE`
|
* `DEBOUNCE_TYPE`
|
||||||
* 標準キーデバウンスルーチンを代替または独自のものに置き換えることができます。
|
* 標準キーデバウンスルーチンを代替または独自のものに置き換えることができます。
|
||||||
* `WAIT_FOR_USB`
|
* `USB_WAIT_FOR_ENUMERATION`
|
||||||
* キーボードが起動する前に、USB 接続が確立されるのをキーボードに待機させます
|
* キーボードが起動する前に、USB 接続が確立されるのをキーボードに待機させます
|
||||||
* `NO_USB_STARTUP_CHECK`
|
* `NO_USB_STARTUP_CHECK`
|
||||||
* キーボードの起動後の usb サスペンドチェックを無効にします。通常、キーボードはタスクが実行される前にホストがウェイク アップするのを待ちます。分割キーボードは半分はウェイクアップコールを取得できませんが、マスタにコマンドを送信する必要があるため、役に立ちます。
|
* キーボードの起動後の usb サスペンドチェックを無効にします。通常、キーボードはタスクが実行される前にホストがウェイク アップするのを待ちます。分割キーボードは半分はウェイクアップコールを取得できませんが、マスタにコマンドを送信する必要があるため、役に立ちます。
|
||||||
|
|
|
@ -833,7 +833,7 @@ Configures the [Stenography](feature_stenography.md) feature.
|
||||||
* `suspend_wakeup_delay`
|
* `suspend_wakeup_delay`
|
||||||
* The amount of time to wait after sending a wakeup packet, in milliseconds.
|
* The amount of time to wait after sending a wakeup packet, in milliseconds.
|
||||||
* Default: `0` (disabled)
|
* Default: `0` (disabled)
|
||||||
* `wait_for`
|
* `wait_for_enumeration`
|
||||||
* Force the keyboard to wait for USB enumeration before starting up.
|
* Force the keyboard to wait for USB enumeration before starting up.
|
||||||
* Default: `false`
|
* Default: `false`
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
"usb": {
|
"usb": {
|
||||||
"vid": "0xFEED",
|
"vid": "0xFEED",
|
||||||
"pid": "0x6060",
|
"pid": "0x6060",
|
||||||
"device_version": "0.0.1"
|
"device_version": "0.0.1",
|
||||||
|
"wait_for_enumeration": true
|
||||||
},
|
},
|
||||||
"processor": "atmega32u4",
|
"processor": "atmega32u4",
|
||||||
"bootloader": "halfkay",
|
"bootloader": "halfkay",
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
WAIT_FOR_USB = yes
|
|
||||||
CUSTOM_MATRIX = yes
|
CUSTOM_MATRIX = yes
|
||||||
|
|
||||||
SRC = matrix.c
|
SRC = matrix.c
|
||||||
|
|
|
@ -21,5 +21,3 @@
|
||||||
#define WS2812_PWM_PAL_MODE 1
|
#define WS2812_PWM_PAL_MODE 1
|
||||||
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM3
|
#define WS2812_PWM_DMA_STREAM STM32_DMA1_STREAM3
|
||||||
#define WS2812_PWM_DMA_CHANNEL 3
|
#define WS2812_PWM_DMA_CHANNEL 3
|
||||||
|
|
||||||
#define WAIT_FOR_USB
|
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
"usb": {
|
"usb": {
|
||||||
"vid": "0x0483",
|
"vid": "0x0483",
|
||||||
"pid": "0xA372",
|
"pid": "0xA372",
|
||||||
"device_version": "0.0.2"
|
"device_version": "0.0.2",
|
||||||
|
"wait_for_enumeration": true
|
||||||
},
|
},
|
||||||
"qmk": {
|
"qmk": {
|
||||||
"tap_keycode_delay": 10
|
"tap_keycode_delay": 10
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
"usb": {
|
"usb": {
|
||||||
"vid": "0x666B",
|
"vid": "0x666B",
|
||||||
"pid": "0x7273",
|
"pid": "0x7273",
|
||||||
"device_version": "0.0.1"
|
"device_version": "0.0.1",
|
||||||
|
"wait_for_enumeration": true
|
||||||
},
|
},
|
||||||
"features": {
|
"features": {
|
||||||
"bootmagic": false,
|
"bootmagic": false,
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
WAIT_FOR_USB = yes
|
|
|
@ -66,6 +66,10 @@ ifeq ($(strip $(NO_USB_STARTUP_CHECK)), yes)
|
||||||
OPT_DEFS += -DNO_USB_STARTUP_CHECK
|
OPT_DEFS += -DNO_USB_STARTUP_CHECK
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(USB_WAIT_FOR_ENUMERATION)), yes)
|
||||||
|
OPT_DEFS += -DUSB_WAIT_FOR_ENUMERATION
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(JOYSTICK_SHARED_EP)), yes)
|
ifeq ($(strip $(JOYSTICK_SHARED_EP)), yes)
|
||||||
OPT_DEFS += -DJOYSTICK_SHARED_EP
|
OPT_DEFS += -DJOYSTICK_SHARED_EP
|
||||||
SHARED_EP_ENABLE = yes
|
SHARED_EP_ENABLE = yes
|
||||||
|
|
|
@ -51,6 +51,11 @@
|
||||||
|
|
||||||
#define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED (2U)
|
#define USB_GETSTATUS_REMOTE_WAKEUP_ENABLED (2U)
|
||||||
|
|
||||||
|
#ifdef WAIT_FOR_USB
|
||||||
|
// TODO: Remove backwards compatibility with old define
|
||||||
|
# define USB_WAIT_FOR_ENUMERATION
|
||||||
|
#endif
|
||||||
|
|
||||||
/* -------------------------
|
/* -------------------------
|
||||||
* TMK host driver defs
|
* TMK host driver defs
|
||||||
* -------------------------
|
* -------------------------
|
||||||
|
@ -143,7 +148,7 @@ void protocol_pre_init(void) {
|
||||||
|
|
||||||
/* Wait until USB is active */
|
/* Wait until USB is active */
|
||||||
while (true) {
|
while (true) {
|
||||||
#if defined(WAIT_FOR_USB)
|
#if defined(USB_WAIT_FOR_ENUMERATION)
|
||||||
if (USB_DRIVER.state == USB_ACTIVE) {
|
if (USB_DRIVER.state == USB_ACTIVE) {
|
||||||
driver = &chibios_driver;
|
driver = &chibios_driver;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -67,6 +67,11 @@
|
||||||
# include "raw_hid.h"
|
# include "raw_hid.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WAIT_FOR_USB
|
||||||
|
// TODO: Remove backwards compatibility with old define
|
||||||
|
# define USB_WAIT_FOR_ENUMERATION
|
||||||
|
#endif
|
||||||
|
|
||||||
uint8_t keyboard_idle = 0;
|
uint8_t keyboard_idle = 0;
|
||||||
/* 0: Boot Protocol, 1: Report Protocol(default) */
|
/* 0: Boot Protocol, 1: Report Protocol(default) */
|
||||||
uint8_t keyboard_protocol = 1;
|
uint8_t keyboard_protocol = 1;
|
||||||
|
@ -807,7 +812,7 @@ void protocol_pre_init(void) {
|
||||||
|
|
||||||
/* wait for USB startup & debug output */
|
/* wait for USB startup & debug output */
|
||||||
|
|
||||||
#ifdef WAIT_FOR_USB
|
#ifdef USB_WAIT_FOR_ENUMERATION
|
||||||
while (USB_DeviceState != DEVICE_STATE_Configured) {
|
while (USB_DeviceState != DEVICE_STATE_Configured) {
|
||||||
# if defined(INTERRUPT_CONTROL_ENDPOINT)
|
# if defined(INTERRUPT_CONTROL_ENDPOINT)
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user