summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2015-11-30 15:38:15 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-12-01 18:52:52 -0800
commit9167ce023260fa089e9aa741eb36902484c33154 (patch)
treeb81fb773e56f3465fe11d5f57178bb64c9cc927c
parentbe47beb539fdb647e7f40d8188b94160476ffe40 (diff)
downloadchrome-ec-9167ce023260fa089e9aa741eb36902484c33154.tar.gz
usb: Put HID descriptor in the correct order
From the "Device Class Definition for Human Interface Devices" spec: When a Get_Descriptor(Configuration) request is issued, it returns the Configuration descriptor, all Interface descriptors, all Endpoint descriptors, and the HID descriptor for each interface. It shall not return the String descriptor, HID Report descriptor or any of the optional HID class descriptors. The HID descriptor shall be interleaved between the Interface and Endpoint descriptors for HID Interfaces. That is, the order shall be: Configuration descriptor Interface descriptor (specifying HID Class) HID descriptor (associated with above Interface) Endpoint descriptor (for HID Interrupt In Endpoint) Optional Endpoint descriptor (for HID Interrupt Out Endpoint) This makes that happen. BUG=chrome-os-partner:34893 BRANCH=none TEST=manual "make buildall" works, this image seems to work on the Cr50. Also, before this CL, I see this: 0x00060f5c 0x00000000 .rodata g NOTYPE __usb_desc 0x00060f5c 0x00000009 .rodata g OBJECT usb_desc_conf 0x00060f65 0x00000009 .rodata g OBJECT usb_desc_iface0_0iface 0x00060f6e 0x00000007 .rodata g OBJECT usb_desc_iface0_1ep0 0x00060f75 0x00000007 .rodata g OBJECT usb_desc_iface0_1ep1 0x00060f7c 0x00000009 .rodata g OBJECT usb_desc_iface1_0iface 0x00060f85 0x00000007 .rodata g OBJECT usb_desc_iface1_1ep81 0x00060f8c 0x00000009 .rodata g OBJECT usb_desc_iface1_2hid 0x00060f95 0x00000000 .rodata g NOTYPE __usb_desc_end and after, this: 0x00060f5c 0x00000000 .rodata g NOTYPE __usb_desc 0x00060f5c 0x00000009 .rodata g OBJECT usb_desc_conf 0x00060f65 0x00000009 .rodata g OBJECT usb_desc_iface0_0iface 0x00060f6e 0x00000007 .rodata g OBJECT usb_desc_iface0_2ep0 0x00060f75 0x00000007 .rodata g OBJECT usb_desc_iface0_2ep1 0x00060f7c 0x00000009 .rodata g OBJECT usb_desc_iface1_0iface 0x00060f85 0x00000009 .rodata g OBJECT usb_desc_iface1_1hid 0x00060f8e 0x00000007 .rodata g OBJECT usb_desc_iface1_2ep81 0x00060f95 0x00000000 .rodata g NOTYPE __usb_desc_end The HID descriptor comes before the endpoint. Change-Id: I8035a4cc884d8bb900bc1eb25fd3e4e9aba05bf8 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/314832 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--include/usb_descriptor.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/usb_descriptor.h b/include/usb_descriptor.h
index 62dfe093e1..327f127585 100644
--- a/include/usb_descriptor.h
+++ b/include/usb_descriptor.h
@@ -226,11 +226,11 @@ struct usb_setup_packet {
}
/* Use these macros for declaring descriptors, to order them properly */
-#define USB_CONF_DESC(name) CONCAT2(usb_desc_, name) \
- __attribute__((section(".rodata.usb_desc_" STRINGIFY(name))))
+#define USB_CONF_DESC(name) CONCAT2(usb_desc_, name) \
+ __attribute__((section(".rodata.usb_desc_" STRINGIFY(name))))
#define USB_IFACE_DESC(num) USB_CONF_DESC(CONCAT3(iface, num, _0iface))
-#define USB_EP_DESC(i, num) USB_CONF_DESC(CONCAT4(iface, i, _1ep, num))
-#define USB_CUSTOM_DESC(i, name) USB_CONF_DESC(CONCAT4(iface, i, _2, name))
+#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))
/* USB Linker data */
extern const uint8_t __usb_desc[];