diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2017-08-10 14:36:30 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-08-16 04:03:24 -0700 |
commit | 9e33d6ce3c6c0a8de24dd6afa71f2adc255a156b (patch) | |
tree | 081b226e96525148b389e76681e41b502edd5eb4 /chip/stm32/usb_console.c | |
parent | a1abf686c3174c6b18d20e8fc250cc4d5a045d97 (diff) | |
download | chrome-ec-9e33d6ce3c6c0a8de24dd6afa71f2adc255a156b.tar.gz |
chip/stm32/usb: Replace reset handler by generic event handler
Some USB interface handlers need to know when USB has been
successfully resumed after a wake event. For example, this is
useful so that HID keyboard can send the events at the right time.
BRANCH=none
BUG=b:35775048
TEST=Using USB HID keyboard patches to queue keys in a FIFO:
After USB autosuspends, press a single key and hold it. Without
this patch the endpoint data only gets reloaded on the _next_
event.
TEST=On hammer, I2C passthrough still works.
Change-Id: I9b52b9de16767c8a66c702a5ae70369334a3d590
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/569547
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/stm32/usb_console.c')
-rw-r--r-- | chip/stm32/usb_console.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/chip/stm32/usb_console.c b/chip/stm32/usb_console.c index c2a40918f2..83fc837aab 100644 --- a/chip/stm32/usb_console.c +++ b/chip/stm32/usb_console.c @@ -91,8 +91,11 @@ static void con_ep_rx(void) console_has_input(); } -static void ep_reset(void) +static void ep_event(enum usb_ep_event evt) { + if (evt != USB_EVENT_RESET) + return; + btable_ep[USB_EP_CONSOLE].tx_addr = usb_sram_addr(ep_buf_tx); btable_ep[USB_EP_CONSOLE].tx_count = 0; @@ -109,7 +112,7 @@ static void ep_reset(void) is_reset = 1; } -USB_DECLARE_EP(USB_EP_CONSOLE, con_ep_tx, con_ep_rx, ep_reset); +USB_DECLARE_EP(USB_EP_CONSOLE, con_ep_tx, con_ep_rx, ep_event); static int __tx_char(void *context, int c) { |