Skip to content

Commit

Permalink
usb_device_state: reset protocol on reset
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
KarlK90 committed Aug 9, 2024
1 parent 31e4912 commit a159096
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions tmk_core/protocol/chibios/usb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ void usb_event_queue_task(void) {
break;
case USB_EVENT_RESET:
usb_device_state_set_reset();
usb_device_state_set_protocol(USB_PROTOCOL_REPORT);
break;
default:
// Nothing to do, we don't handle it.
Expand Down
1 change: 1 addition & 0 deletions tmk_core/protocol/lufa/lufa.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ void EVENT_USB_Device_Disconnect(void) {
void EVENT_USB_Device_Reset(void) {
print("[R]");
usb_device_state_set_reset();
usb_device_state_set_protocol(USB_PROTOCOL_REPORT);
}

/** \brief Event USB Device Connect
Expand Down

0 comments on commit a159096

Please sign in to comment.