From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eddie Cai Date: Sun, 16 Apr 2017 23:48:52 +0800 Subject: [U-Boot] [U-Boot PATCH V2 4/8] usb: ums: add functions to set and get usb interface descriptor In-Reply-To: <20170416154856.14636-1-eddie.cai.linux@gmail.com> References: <20170416154856.14636-1-eddie.cai.linux@gmail.com> Message-ID: <20170416154856.14636-5-eddie.cai.linux@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de add functions to set and get usb interface descriptor, so people can customize usb interface descriptor Signed-off-by: Eddie Cai --- 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