Hi Eddie, > add functions to set and get usb interface descriptor, so people can > customize usb interface descriptor
The f_mass_storage USB function is used through the g_dnl code: ./drivers/usb/gadget/g_dnl.c Other gadget functions - like dfu and thor are using it. Please consider following this scheme - for example look into the Samsung's Thor protocol support at: ./drivers/usb/gadget/f_thor.c Since we managed to add Thor (vendor specific protocol), then it should be doable to add rockusb as well. Another good example of this framework reuse is f_fastboot.c to support Android fastboot protocol. Please consider if rockchip could be added in the same manner. > > Signed-off-by: Eddie Cai <[email protected]> > --- > 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) +{ To adjust the usb descriptor one can use: g_dnl_bind_fixup() function (defined at g_dnl.c). It is used to adjust information added to USB file descriptor - e.g. board/samsung/common/gadget.c or board/siemens/common/factoryreset.c > + 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); Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected] _______________________________________________ U-Boot mailing list [email protected] https://lists.denx.de/listinfo/u-boot

