From patchwork Wed Mar 18 08:24:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Delaunay X-Patchwork-Id: 243771 List-Id: U-Boot discussion From: patrick.delaunay at st.com (Patrick Delaunay) Date: Wed, 18 Mar 2020 09:24:46 +0100 Subject: [PATCH 01/18] usb: gadget: g_dnl: add function g_dnl_set_product In-Reply-To: <20200318082503.8025-1-patrick.delaunay@st.com> References: <20200318082503.8025-1-patrick.delaunay@st.com> Message-ID: <20200318082503.8025-2-patrick.delaunay@st.com> Add a function g_dnl_set_product to change the Product string used in USB enumeration in any command based on download gadget. If the function is called with NULL pointer, the product string is set to the default value (product[] = "USB download gadget"). Signed-off-by: Patrick Delaunay --- drivers/usb/gadget/g_dnl.c | 8 ++++++++ include/g_dnl.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c index e9e1600a1a..7a51b53f24 100644 --- a/drivers/usb/gadget/g_dnl.c +++ b/drivers/usb/gadget/g_dnl.c @@ -89,6 +89,14 @@ static struct usb_gadget_strings *g_dnl_composite_strings[] = { NULL, }; +void g_dnl_set_product(const char *s) +{ + if (s) + g_dnl_string_defs[1].s = s; + else + g_dnl_string_defs[1].s = product; +} + static int g_dnl_unbind(struct usb_composite_dev *cdev) { struct usb_gadget *gadget = cdev->gadget; diff --git a/include/g_dnl.h b/include/g_dnl.h index 6d461c73d3..836ee602c8 100644 --- a/include/g_dnl.h +++ b/include/g_dnl.h @@ -38,6 +38,7 @@ int g_dnl_board_usb_cable_connected(void); int g_dnl_register(const char *s); void g_dnl_unregister(void); void g_dnl_set_serialnumber(char *); +void g_dnl_set_product(const char *s); bool g_dnl_detach(void); void g_dnl_trigger_detach(void);