-
-
Notifications
You must be signed in to change notification settings - Fork 40k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core] usb_device_state
: consolidate usb state handling across implementations
#24258
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KarlK90
changed the title
Maintenance/usb device state
[Core] USB: consolidate hid state across drivers
Aug 9, 2024
KarlK90
force-pushed
the
maintenance/usb-device-state
branch
4 times, most recently
from
August 9, 2024 19:58
d208380
to
a159096
Compare
KarlK90
changed the title
[Core] USB: consolidate hid state across drivers
[Core] usb_device_state: consolidate usb state handling across implementations
Aug 9, 2024
KarlK90
changed the title
[Core] usb_device_state: consolidate usb state handling across implementations
[Core] Aug 9, 2024
usb_device_state
: consolidate usb state handling across implementations
KarlK90
force-pushed
the
maintenance/usb-device-state
branch
from
August 9, 2024 20:06
a159096
to
b02f9ad
Compare
action_util.c and report.c error due to not having USB_PROTOCOL_* defined. |
KarlK90
force-pushed
the
maintenance/usb-device-state
branch
from
August 12, 2024 07:53
b02f9ad
to
ef6403e
Compare
Thanks! Fixed now. |
KarlK90
force-pushed
the
maintenance/usb-device-state
branch
2 times, most recently
from
August 12, 2024 17:34
c414c6a
to
5b62e78
Compare
KarlK90
force-pushed
the
maintenance/usb-device-state
branch
from
August 12, 2024 17:36
5b62e78
to
4a2aa2b
Compare
zvecr
reviewed
Aug 12, 2024
KarlK90
force-pushed
the
maintenance/usb-device-state
branch
from
August 12, 2024 20:53
4a2aa2b
to
2546936
Compare
KarlK90
force-pushed
the
maintenance/usb-device-state
branch
from
September 8, 2024 13:05
2546936
to
96a59a7
Compare
KarlK90
force-pushed
the
maintenance/usb-device-state
branch
from
October 6, 2024 09:42
96a59a7
to
19fcfa7
Compare
Looks like there are some lint errors for OS detection, and the tests are failing for it, too. |
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 <[email protected]>
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 <[email protected]>
Signed-off-by: Stefan Kerkmann <[email protected]>
KarlK90
force-pushed
the
maintenance/usb-device-state
branch
from
October 12, 2024 17:54
19fcfa7
to
89dfacf
Compare
Thanks, I've addressed the failing tests. |
drashna
approved these changes
Oct 12, 2024
ilham-agustiawan
pushed a commit
to ilham-agustiawan/qmk_firmware
that referenced
this pull request
Nov 30, 2024
…ementations (qmk#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 <[email protected]> * 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 <[email protected]> * keyboards: fix oversize warnings Signed-off-by: Stefan Kerkmann <[email protected]> --------- Signed-off-by: Stefan Kerkmann <[email protected]>
smallketchup82
pushed a commit
to smallketchup82/qmk_firmware
that referenced
this pull request
Dec 1, 2024
…ementations (qmk#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 <[email protected]> * 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 <[email protected]> * keyboards: fix oversize warnings Signed-off-by: Stefan Kerkmann <[email protected]> --------- Signed-off-by: Stefan Kerkmann <[email protected]>
jlaptavi
pushed a commit
to jlaptavi/qmk_firmware
that referenced
this pull request
Dec 3, 2024
…ementations (qmk#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 <[email protected]> * 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 <[email protected]> * keyboards: fix oversize warnings Signed-off-by: Stefan Kerkmann <[email protected]> --------- Signed-off-by: Stefan Kerkmann <[email protected]>
DmNosachev
pushed a commit
to DmNosachev/qmk_firmware
that referenced
this pull request
Dec 7, 2024
…ementations (qmk#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 <[email protected]> * 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 <[email protected]> * keyboards: fix oversize warnings Signed-off-by: Stefan Kerkmann <[email protected]> --------- Signed-off-by: Stefan Kerkmann <[email protected]>
SyrupSplashin
pushed a commit
to SyrupSplashin/qmk_firmware
that referenced
this pull request
Dec 10, 2024
…ementations (qmk#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 <[email protected]> * 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 <[email protected]> * keyboards: fix oversize warnings Signed-off-by: Stefan Kerkmann <[email protected]> --------- Signed-off-by: Stefan Kerkmann <[email protected]>
LeonMusCoden
pushed a commit
to LeonMusCoden/qmk_firmware
that referenced
this pull request
Jan 5, 2025
…ementations (qmk#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 <[email protected]> * 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 <[email protected]> * keyboards: fix oversize warnings Signed-off-by: Stefan Kerkmann <[email protected]> --------- Signed-off-by: Stefan Kerkmann <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
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 protocolkeyboard_idle
: for the idle_rate of the keyboard endpointAnd 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.
This is then put into use for usb hid specification section 7.2.6:
Thus on reset we should always do exactly that.
Types of Changes
Issues Fixed or Closed by This PR
Checklist