diff options
author | Nick Sanders <nsanders@chromium.org> | 2016-04-06 14:25:45 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-05-26 16:17:26 -0700 |
commit | 56ee8aefc33505a7df4e4148001a11ac461907a3 (patch) | |
tree | 9aa84b4f26d7396878757bb7ed79bebaa18f59a2 /include/usb_descriptor.h | |
parent | 5cc3cac589d3e869266c18ed7e538a769496478f (diff) | |
download | chrome-ec-56ee8aefc33505a7df4e4148001a11ac461907a3.tar.gz |
servo_micro: add programmable serial number
This change provides a console command for setting,
and loading a usb serial number from flash. This
feature adds CONFIG_USB_SERIALNO, and currently only
has a useful implementation when PSTATE is present.
BUG=chromium:571477
TEST=serialno set abcdef; serialno load; reboot
BRANCH=none
Change-Id: I3b24cfa2d52d54118bc3fd54b276e3d95412d245
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/337359
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'include/usb_descriptor.h')
-rw-r--r-- | include/usb_descriptor.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/usb_descriptor.h b/include/usb_descriptor.h index baa6e6421b..a29b9eda76 100644 --- a/include/usb_descriptor.h +++ b/include/usb_descriptor.h @@ -233,6 +233,24 @@ struct usb_setup_packet { WIDESTR(str) \ } +#ifdef CONFIG_USB_SERIALNO +/* String Descriptor for USB, for editable strings. */ +#define USB_STRING_LEN 30 +struct usb_string_desc { + uint8_t _len; + uint8_t _type; + wchar_t _data[USB_STRING_LEN]; +}; +#define USB_WR_STRING_DESC(str) \ + (&(struct usb_string_desc) { \ + /* As above, two bytes metadata, no null terminator. */ \ + sizeof(WIDESTR(str)) + 2 - 2, \ + USB_DT_STRING, \ + WIDESTR(str) \ +}) +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) \ __attribute__((section(".rodata.usb_desc_" STRINGIFY(name)))) |