Re: Viewing many gadgets in error under Windows with mass storage function and configfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 07/02/2015 03:14 PM, Felipe Balbi wrote:
On Thu, Jul 02, 2015 at 02:55:34PM +0200, Krzysztof Opasiak wrote:


On 07/02/2015 02:45 PM, Michal Nazarewicz wrote:
On Thu, Jul 02, 2015 at 12:51:54PM +0200, Gregory CLEMENT wrote:
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.

On Thu, Jul 02 2015, Felipe Balbi wrote:
This has been reported. Michal was working on a fix, but the patch
hasn't been applied yet.

I’ve came up with [1], which you should feel free to test, but then
Krzysztof came along with [2], which among other things addressed the
LUN count issue, and I kind of stopped working on the issue waiting for
his follow up.

Sorry that it took so much time. I have been quite busy with some other
things. I will send fixed version of that series in a few hours.

I'm taking Michal's patch as a quick fix for the -rc though. That patch
is simple enough to get in and solves the issue at hand.


Nope it doesn't. It may read past buffer in case of legacy gadgets please see discussion in [1]

1 - http://marc.info/?l=linux-usb&m=143498343720763&w=2

BR's
--
Krzysztof Opasiak
Samsung R&D Institute Poland
Samsung Electronics
--
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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux