qmk/quantum
Stefan Kerkmann 3f9d464412
[Core] usb_device_state: consolidate usb state handling across implementations (#24258)
* usb_device_state: add idle_rate, led and protocol

Previously all usb drivers and platform implementations (expect for our
oddball atsam) tracked the same two global variables:

- keyboard_protocol: to indicate if we are in report or boot protocol
- keyboard_idle: for the idle_rate of the keyboard endpoint

And a local variable that was exposed trough some indirection:

- keyboard_led_state: for the currently set indicator leds (caps lock etc.)

These have all been moved into the usb_device_state struct wich is
accessible by getters and setters.

This reduces code duplication and centralizes the state management
across platforms and drivers.

Signed-off-by: Stefan Kerkmann <karlk90@pm.me>

* usb_device_state: reset protocol on reset

The usb hid specification section 7.2.6 states:

When initialized, all devices default to report protocol. However the
host should not make any assumptions about the device’s state and should
set the desired protocol whenever initializing a device.

Thus on reset we should always do exactly that.

Signed-off-by: Stefan Kerkmann <karlk90@pm.me>

* keyboards: fix oversize warnings

Signed-off-by: Stefan Kerkmann <karlk90@pm.me>

---------

Signed-off-by: Stefan Kerkmann <karlk90@pm.me>
2024-10-18 09:57:08 +02:00
..
audio [Audio] Add support for audio shutdown pin (#22731) 2024-03-06 22:02:37 +11:00
backlight Update GPIO macro usages in core (#23093) 2024-02-18 17:08:27 +11:00
bootmagic Removal of bootmagic lite terminology (#22979) 2024-02-17 12:27:34 +00:00
debounce Update asymmetric debounce code comment (#22981) 2024-01-30 19:34:45 -08:00
encoder/tests Rename encoder pins defines (#24003) 2024-07-03 17:18:27 +10:00
keymap_extras add farsi keymap extras (#23650) 2024-06-20 16:12:16 -07:00
led_matrix WS2812 API rework (#24364) 2024-10-06 21:01:07 +13:00
logging Remove arm_atsam platform (#24337) 2024-09-02 03:48:17 +01:00
midi Unify MIDI note calculation with the audio feature's algorithm (#21588) 2023-07-27 16:14:34 -07:00
os_detection/tests [Core] usb_device_state: consolidate usb state handling across implementations (#24258) 2024-10-18 09:57:08 +02:00
painter Add LD7032 support to QP. (#20828) 2024-09-18 21:44:33 +10:00
pointing_device Extended wheel reports (#24422) 2024-10-06 11:26:55 +02:00
process_keycode [Core] usb_device_state: consolidate usb state handling across implementations (#24258) 2024-10-18 09:57:08 +02:00
rgb_matrix Rename RGB and HSV structs (#24471) 2024-10-12 00:10:02 +01:00
rgblight Rename RGB and HSV structs (#24471) 2024-10-12 00:10:02 +01:00
send_string Insert delay between shifted chars in send_string_with_delay for AVR (#23673) 2024-05-18 21:37:33 -07:00
sequencer
split_common Merge remote-tracking branch 'origin/master' into develop 2024-05-17 22:00:13 +00:00
unicode Unicode, Unicodemap and UCIS refactor (#21659) 2023-08-27 13:30:19 +10:00
wear_leveling
action_code.h
action_layer.c
action_layer.h
action_tapping.c Improve test invocation, fix Retro Shift bugs, and add Auto+Retro Shift test cases (#15889) 2023-09-25 12:45:49 +10:00
action_tapping.h
action_util.c [Core] usb_device_state: consolidate usb state handling across implementations (#24258) 2024-10-18 09:57:08 +02:00
action_util.h Separate 6KRO and NKRO report structs (#22267) 2023-10-23 15:43:46 +11:00
action.c Normalise mouse keycodes (#23975) 2024-07-03 18:35:54 +10:00
action.h
basic_profiling.h Remove arm_atsam platform (#24337) 2024-09-02 03:48:17 +01:00
bits.h [Core] quantum: util: add bit and bitmask helpers (#24229) 2024-10-12 18:48:00 +02:00
bitwise.c
bitwise.h
caps_word.c
caps_word.h
color.c Rename RGB and HSV structs (#24471) 2024-10-12 00:10:02 +01:00
color.h Rename RGB and HSV structs (#24471) 2024-10-12 00:10:02 +01:00
command.c [Core] usb_device_state: consolidate usb state handling across implementations (#24258) 2024-10-18 09:57:08 +02:00
command.h
crc.c
crc.h
debounce.h
deferred_exec.c [Bugfix] Manipulate deferred executor slot only if tokens match (#22722) 2023-12-21 09:32:19 +11:00
deferred_exec.h
digitizer.c
digitizer.h
dip_switch.c Update GPIO macro usages in core (#23093) 2024-02-18 17:08:27 +11:00
dip_switch.h Keymap introspection for Dip Switches (#22543) 2023-12-11 23:06:18 +00:00
dynamic_keymap.c Fix compilation of dynamic_keymap.c without VIA (#21858) 2023-08-29 14:28:09 +01:00
dynamic_keymap.h
eeconfig.c EEPROM: Don't erase if we don't have to. Adding eeprom_driver_format abstraction. (#18332) 2024-05-28 12:49:55 +01:00
eeconfig.h Infer eeconfig identifiers (#22135) 2024-03-14 21:45:03 +11:00
encoder.c Normalise mouse keycodes (#23975) 2024-07-03 18:35:54 +10:00
encoder.h Rename encoder pins defines (#24003) 2024-07-03 17:18:27 +10:00
haptic.c [Core] usb_device_state: consolidate usb state handling across implementations (#24258) 2024-10-18 09:57:08 +02:00
haptic.h Update GPIO macro usages in core (#23093) 2024-02-18 17:08:27 +11:00
joystick.c Update GPIO macro usages in core (#23093) 2024-02-18 17:08:27 +11:00
joystick.h Fix joystick initialization (#22953) 2024-02-17 01:14:46 +11:00
keyboard.c Rename process_{led,rgb}_matrix() (#23422) 2024-04-05 15:43:52 +01:00
keyboard.h Keymap introspection for Dip Switches (#22543) 2023-12-11 23:06:18 +00:00
keycode_config.c Begin removal of bootmagic lite terminology (#22970) 2024-01-28 22:51:58 +00:00
keycode_config.h
keycode.h Normalise mouse keycodes (#23975) 2024-07-03 18:35:54 +10:00
keycodes.h Add new connection keycodes for Bluetooth, 2.4GHz. (#24251) 2024-08-27 10:52:23 +10:00
keymap_common.c Keymap introspection for Dip Switches (#22543) 2023-12-11 23:06:18 +00:00
keymap_common.h
keymap_introspection.c Expand count checks in keymap introspection (#24464) 2024-10-11 06:54:53 +11:00
keymap_introspection.h Add support for key override introspection. (#24120) 2024-07-16 09:22:17 +10:00
leader.c
leader.h
led_tables.c
led_tables.h
led.c Remove deprecated led_set_user (#23979) 2024-06-22 09:10:58 +01:00
led.h Remove deprecated led_set_user (#23979) 2024-06-22 09:10:58 +01:00
main.c Refactor vusb to protocol use pre/post task (#14944) 2024-03-14 21:45:12 +11:00
matrix_common.c
matrix.c Update atomic GPIO macros in keyboard custom matrix (#23796) 2024-07-13 18:41:05 +10:00
matrix.h
modifiers.h
mousekey.c Enhance overlapping mouse keys control (#23341) 2024-08-19 03:18:28 +01:00
mousekey.h Enhance overlapping mouse keys control (#23341) 2024-08-19 03:18:28 +01:00
os_detection.c [Core] usb_device_state: consolidate usb state handling across implementations (#24258) 2024-10-18 09:57:08 +02:00
os_detection.h [Core] usb_device_state: consolidate usb state handling across implementations (#24258) 2024-10-18 09:57:08 +02:00
pointing_device_internal.h
programmable_button.c
programmable_button.h
quantum_keycodes_legacy.h Add new connection keycodes for Bluetooth, 2.4GHz. (#24251) 2024-08-27 10:52:23 +10:00
quantum_keycodes.h Align location of tap dance keycode (#22742) 2023-12-24 06:52:41 +00:00
quantum.c Separate RGBLight/RGB Matrix keycode handling (#23679) 2024-10-12 18:43:50 +02:00
quantum.h Add easier way to set default single layer (#24376) 2024-10-06 21:39:21 +13:00
raw_hid.h Raw HID: documentation improvements (#21596) 2023-07-25 09:20:41 +10:00
repeat_key.c Normalise mouse keycodes (#23975) 2024-07-03 18:35:54 +10:00
repeat_key.h
ring_buffer.h
secure.c
secure.h
steno_keycodes.h Remove requirement for keymap_steno.h include in keymaps (#22423) 2023-11-12 18:25:46 +11:00
sync_timer.c
sync_timer.h
tri_layer.c
tri_layer.h
util.h [Core] quantum: util: add bit and bitmask helpers (#24229) 2024-10-12 18:48:00 +02:00
variable_trace.c
variable_trace.h
via.c refactor: move default RGB/LED matrix #defines (#21938) 2023-09-28 11:51:18 +01:00
via.h
virtser.h
wpm.c
wpm.h