From f4227c4b01840c092b5431cbe6d92de282fe5628 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Thu, 18 Jun 2015 00:15:00 +0200 Subject: libpayload udc: add interface to add string descriptors They're ASCII only, with only one language at a time, but they should be good enough to report device names and serial numbers. BUG=none BRANCH=none TEST=with depthcharge CL, check dmesg on the host device Change-Id: If888e05b2f372f7f0f43fadb108ca7ef4ed3b7c1 Signed-off-by: Patrick Georgi Original-Commit-Id: f0bc4242057d3edc4f4796ebeed2d98d89d60a1d Original-Change-Id: Ibe42f1b49f412e5482cebb7ebe20f6034352fd12 Original-Signed-off-by: Patrick Georgi Original-Reviewed-on: https://chromium-review.googlesource.com/278300 Original-Tested-by: Patrick Georgi Original-Reviewed-by: Furquan Shaikh Original-Commit-Queue: Patrick Georgi Reviewed-on: http://review.coreboot.org/10626 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- payloads/libpayload/include/udc/udc.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'payloads/libpayload/include') diff --git a/payloads/libpayload/include/udc/udc.h b/payloads/libpayload/include/udc/udc.h index 7987c51286..99cbb1b7eb 100644 --- a/payloads/libpayload/include/udc/udc.h +++ b/payloads/libpayload/include/udc/udc.h @@ -102,6 +102,22 @@ struct usbdev_ctrl { void (*add_gadget)(struct usbdev_ctrl *, struct usbdev_configuration *config); + /** + * Add a set of strings to use for string descriptors. + * + * 's' must point to an array of strings of which the first + * element is unused, with at most 255 elements. + * + * 'm' is the size of 'strings' (ie. the index of the last entry). + * + * 'l' is the USB language code, of which some are defined below, + * eg. LANG_EN_US. + * + * For now, only one language is ever exposed: Calling add_strings overwrites + * older configuration. + */ + void (*add_strings)(unsigned short l, unsigned char m, const char **s); + /** * Add packet to process by the controller. * zlp: zero length packet, if such a termination is necessary @@ -136,8 +152,13 @@ struct usbdev_ctrl { void (*free_data)(void *); }; +#define LANG_DE_DE 0x0407 +#define LANG_EN_US 0x0409 + void udc_add_gadget(struct usbdev_ctrl *this, struct usbdev_configuration *config); +void udc_add_strings(unsigned short id, unsigned char count, + const char *strings[]); void udc_handle_setup(struct usbdev_ctrl *this, int ep, dev_req_t *dr); #endif -- cgit v1.2.3