Re: Query: Reset string id during rndis unbind

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

 



Hello Michal,

On Thu, Aug 9, 2012 at 12:55 AM, Michal Nazarewicz <mina86@xxxxxxxxxx> wrote:
> Kernel Newbie <kernelfanatic@xxxxxxxxx> writes:
>> In the 3.4 kernel, we have observed that the RNDIS function driver clears
>> the string id reference to 0 during unbind. And, during bind, we see that
>> the rndis_init() itself is initiated only when the RNDIS string id reference
>> is 0. Is this ok?
>>
>> The issue behind this query is:
>> As rndis is requesting a new string id during every bind, during dynamic
>> function switches (e.g. enable tethering/disable tethering) RNDIS gets a
>> new string id for its descriptor from the composite framework. When connecting
>> to a Windows host, due to the string id changes, the device manager treats
>> this as a new instance of the device and requests for driver installation
>> during every connect.
>
> If you reconfigure the whole composite gadget, what guarantee do you
> have that those ID's will be available?  They could be assigned to
> completely unrelated strings.
>

Ok. In that case, the other gadget drivers follow the same behavior
during unbind right? e.g. f_acm or f_ecm drivers should also reset
their id's to 0 during unbind? Please correct me if my understanding
is wrong.

Thanks,
Balakumar R

>> When I did the below changes, the above issue is not seen anymore. Can
>> you provide
>> your views on this?
>>
>> --Change--
>> diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c
>> index 6cfbb5b..3c12c42 100644
>> --- a/drivers/usb/gadget/f_rndis.c
>> +++ b/drivers/usb/gadget/f_rndis.c
>> @@ -820,7 +820,7 @@ rndis_unbind(struct usb_configuration *c, struct
>> usb_function *f)
>>
>>         rndis_deregister(rndis->config);
>>         rndis_exit();
>> -       rndis_string_defs[0].id = 0;
>>
>>         if (gadget_is_superspeed(c->cdev->gadget))
>>                 usb_free_descriptors(f->ss_descriptors);
>> @@ -869,14 +869,13 @@ rndis_bind_config_vendor(struct
>> usb_configuration *c, u8 ethaddr[ETH_ALEN],
>>         if (!can_support_rndis(c) || !ethaddr)
>>                 return -EINVAL;
>>
>> +       /* ... and setup RNDIS itself */
>> +       status = rndis_init();
>> +       if (status < 0)
>> +               return status;
>> +
>>         /* maybe allocate device-global string IDs */
>>         if (rndis_string_defs[0].id == 0) {
>> -
>> -               /* ... and setup RNDIS itself */
>> -               status = rndis_init();
>> -               if (status < 0)
>> -                       return status;
>> -
>>                 /* control interface label */
>>                 status = usb_string_id(c->cdev);
>>                 if (status < 0)
>> --End--
>>
>> Thanks,
>> Balakumar R
>> --
>> 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
>
> --
> Best regards,                                         _     _
> .o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
> ..o | Computer Science,  Michał “mina86” Nazarewicz    (o o)
> ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo--
>
--
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