Hi Felipe, thanks for you prompt feedback. On 02/07/2015 13:45, Felipe Balbi wrote: > Hi, > > On Thu, Jul 02, 2015 at 12:51:54PM +0200, Gregory CLEMENT wrote: >> Hello, >> >> When I use configs to configure the mass storage function for the >> gadget, and when the device is plugged under Windows, then the >> partition that I expose is well managed, but I also see 7 other gadget >> in the device manager with error. >> >> This seven bogus gadget seems to be the 7 other LUN that are not >> used. Indeed if I apply this dirty patch: >> >> diff --git a/drivers/usb/gadget/function/f_mass_storage.c b/drivers/usb/gadget/function/f_mass_storage.c >> index 3cc109f..2b4ae98 100644 >> --- a/drivers/usb/gadget/function/f_mass_storage.c >> +++ b/drivers/usb/gadget/function/f_mass_storage.c >> @@ -3511,7 +3511,8 @@ static struct usb_function_instance *fsg_alloc_inst(void) >> rc = PTR_ERR(opts->common); >> goto release_opts; >> } >> - rc = fsg_common_set_nluns(opts->common, FSG_MAX_LUNS); >> +// rc = fsg_common_set_nluns(opts->common, FSG_MAX_LUNS); >> + rc = fsg_common_set_nluns(opts->common, 1); >> if (rc) >> goto release_opts; >> >> Then there is no more gadget error under Windows. As the value of >> FSG_MAX_LUNS is 8 and in my configuration I only use one partition, >> then it makes sens that I see 7 bogus gadgets. >> >> I also saw that in the legacy driver, it was possible to modify the >> number of LUN using the module parameter file_count. > > This has been reported. Michal was working on a fix, but the patch > hasn't been applied yet. Oh sorry to not have finding the thread about it. > >> There is no such parameter when using configfs. >> >> What would be the correct way to fix it? > > Making sure you don't lie to the other side of the cable :-) > >> I thought about enumerate how many LUN where configured through >> configfs and then setting the exact number using fsg_common_set_nluns. > > yeah, that should be the way. > >> There is no problem at all under Linux so maybe it is jut the way how >> the gadget is exposed through USB. > > no, we shouldn't really lie, this really needs fixing. Ok so don't hesitate to ask me to test or if you need any help. Thanks, Gregory > >> >> I tested it on the kernel 3.17 and 4.1 using the musb of the SoC >> AM335x. >> >> Thanks for your feedback. >> >> Gregory >> >> -- >> Gregory Clement, Free Electrons >> Kernel, drivers, real-time and embedded Linux >> development, consulting, training and support. >> http://free-electrons.com > -- Gregory Clement, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html