[U-Boot] [U-Boot PATCH V2 4/8] usb: ums: add functions to set and get usb interface descriptor

Eddie Cai
2017-04-16T15:48:52Z

add functions to set and get usb interface descriptor, so people can
customize usb interface descriptor

Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
---
drivers/usb/gadget/f_mass_storage.c | 18 ++++++++++++++++++
include/f_mass_storage.h | 2 ++
2 files changed, 20 insertions(+)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index faf875e..333f069 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2870,6 +2870,24 @@ static int fsg_bind_config(struct usb_composite_dev *cdev,
return rc;
}

+struct usb_interface_descriptor *fsg_get_usb_interface_descriptor(void)
+{
+ return &fsg_intf_desc;
+}
+
+void fsg_set_usb_interface_descriptor(struct usb_interface_descriptor *desc)
+{
+ if (desc) {
+ fsg_intf_desc.bLength = desc->bLength;
+ fsg_intf_desc.bDescriptorType = desc->bDescriptorType;
+ fsg_intf_desc.bNumEndpoints = desc->bNumEndpoints;
+ fsg_intf_desc.bInterfaceClass = desc->bInterfaceClass;
+ fsg_intf_desc.bInterfaceSubClass = desc->bInterfaceSubClass;
+ fsg_intf_desc.bInterfaceProtocol = desc->bInterfaceProtocol;
+ fsg_intf_desc.iInterface = desc->iInterface;
+ }
+}
+
int fsg_add(struct usb_configuration *c)
{
struct fsg_common *fsg_common;
diff --git a/include/f_mass_storage.h b/include/f_mass_storage.h
index df6ea33..0cf29df 100644
--- a/include/f_mass_storage.h
+++ b/include/f_mass_storage.h
@@ -500,6 +500,8 @@ struct fsg_dev {
struct usb_ep *bulk_out;
};

+struct usb_interface_descriptor *fsg_get_usb_interface_descriptor(void);
+void fsg_set_usb_interface_descriptor(struct usb_interface_descriptor *desc);
int sleep_thread(struct fsg_common *common);
int do_scsi_command(struct fsg_common *common);

--
2.10.2