diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2017-11-15 15:00:12 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-12-12 03:57:19 -0800 |
commit | e3c1e2265c732d465f3df90e5ea64bd02f02234f (patch) | |
tree | 7a6db56d522a6ff448f78691ad696901792e47d8 /chip/stm32/usb_hid.c | |
parent | 2f4fd74df5af5885a24d2c1ddc9deb71dd874315 (diff) | |
download | chrome-ec-e3c1e2265c732d465f3df90e5ea64bd02f02234f.tar.gz |
stm32/usb: Patching framework for USB descriptors
In some cases, we want to be able to dynamically modify a few bytes
in the USB descriptor (in our case, length of referenced items),
but it could also be other things like flags.
These 2 new functions allow to keep all the USB descriptor in flash, and
modify these few bytes before writing them in the USB buffer.
BRANCH=none
BUG=b:37447752
TEST=Flash hammer, USB descriptors are valid.
Change-Id: I8624255fa43f52a0aaa21d20e963f3974f236912
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/771057
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip/stm32/usb_hid.c')
-rw-r--r-- | chip/stm32/usb_hid.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/chip/stm32/usb_hid.c b/chip/stm32/usb_hid.c index f24bdd5982..873d80009a 100644 --- a/chip/stm32/usb_hid.c +++ b/chip/stm32/usb_hid.c @@ -107,8 +107,7 @@ int hid_iface_request(usb_uint *ep0_buf_rx, usb_uint *ep0_buf_tx, return report_left ? 1 : 0; } else if (ep0_buf_rx[1] == (USB_HID_DT_HID << 8)) { /* Setup : HID specific : Get HID descriptor */ - memcpy_to_usbram((void *) usb_sram_addr(ep0_buf_tx), - hid_desc, sizeof(*hid_desc)); + memcpy_to_usbram_ep0_patch(hid_desc, sizeof(*hid_desc)); btable_ep[0].tx_count = sizeof(*hid_desc); STM32_TOGGLE_EP(0, EP_TX_RX_MASK, EP_TX_RX_VALID, EP_STATUS_OUT); |