summaryrefslogtreecommitdiff
path: root/include/usb_descriptor.h
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@google.com>2017-05-17 18:15:15 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-05-18 06:03:52 -0700
commit11237d5e911d769cac995e2e1ab9d16598542bc8 (patch)
tree1e679437f36debf7a67e74891bb7bd937049234b /include/usb_descriptor.h
parent0b077ad67173f11f8816b01213bc09f622326799 (diff)
downloadchrome-ec-11237d5e911d769cac995e2e1ab9d16598542bc8.tar.gz
hammer: Make keyboard work at firmware screen
First, libpayload expects the keyboard interface index to be 0. Then, hid_iface_request needs to reply to USB_HID_DT_HID request with the content of struct usb_hid_descriptor. With current code, the variable name is generated (and therefore hard to guess), so we create a new set of macros so that we can use a specific variable name. Also, add support for HID Get_Protocol and Set_Protocol, as they are compulsory for devices supporting boot protocol, even though those are mostly no-op for now. Finally, add a note regarding USB HID keyboard boot protocol, to make sure that we do not accidentally change the report format. BRANCH=none BUG=b:36538963 TEST=Keyboard works in FW screen, both trackpad and keyboard still work when AP has booted. TEST=hammer/staff can still be updated (both RO from RW, and RW from RO) Change-Id: Ibea4888385909c9ce3b430464e5805c039d4b9ed Reviewed-on: https://chromium-review.googlesource.com/505796 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/usb_descriptor.h')
-rw-r--r--include/usb_descriptor.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/usb_descriptor.h b/include/usb_descriptor.h
index 1343e0d777..c6e877aac6 100644
--- a/include/usb_descriptor.h
+++ b/include/usb_descriptor.h
@@ -275,9 +275,12 @@ extern struct usb_string_desc *usb_serialno_desc;
#endif
/* Use these macros for declaring descriptors, to order them properly */
-#define USB_CONF_DESC(name) CONCAT2(usb_desc_, name) \
+#define USB_CONF_DESC_VAR(name, varname) varname \
__attribute__((section(".rodata.usb_desc_" STRINGIFY(name))))
+#define USB_CONF_DESC(name) USB_CONF_DESC_VAR(name, CONCAT2(usb_desc_, name))
#define USB_IFACE_DESC(num) USB_CONF_DESC(CONCAT3(iface, num, _0iface))
+#define USB_CUSTOM_DESC_VAR(i, name, varname) \
+ USB_CONF_DESC_VAR(CONCAT4(iface, i, _1, name), varname)
#define USB_CUSTOM_DESC(i, name) USB_CONF_DESC(CONCAT4(iface, i, _1, name))
#define USB_EP_DESC(i, num) USB_CONF_DESC(CONCAT4(iface, i, _2ep, num))