* [PATCH v2] net: cdc_ether: allow combined control and data interface
@ 2013-06-29 10:03 Bjørn Mork
[not found] ` <1372500186-23567-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2013-07-02 8:17 ` Oliver Neukum
0 siblings, 2 replies; 5+ messages in thread
From: Bjørn Mork @ 2013-06-29 10:03 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, Enrico Mioso, Oliver Neukum,
Bjørn Mork
Some Icera based Huawei modems handled by this driver are not
completely CDC ECM compliant, using the same USB interface for both
control and data. The CDC functional descriptors include a Union
naming this interface as both master and slave, so it is supportable
by relaxing the descriptor parsing in case these interfaces are
identical.
This has been tested on a Huawei K3806 and verified to add support
for that device.
Reported-and-tested-by: Enrico Mioso <mrkiko.rs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
---
v2: Simplified unbind logic. Thanks to Oliver Neukum
drivers/net/usb/cdc_ether.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 04ee044..4393f14 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -215,6 +215,10 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
goto bad_desc;
}
+ /* some devices merge these - skip class check */
+ if (info->control == info->data)
+ goto next_desc;
+
/* a data interface altsetting does the real i/o */
d = &info->data->cur_altsetting->desc;
if (d->bInterfaceClass != USB_CLASS_CDC_DATA) {
@@ -304,19 +308,23 @@ next_desc:
/* claim data interface and set it up ... with side effects.
* network traffic can't flow until an altsetting is enabled.
*/
- status = usb_driver_claim_interface(driver, info->data, dev);
- if (status < 0)
- return status;
+ if (info->data != info->control) {
+ status = usb_driver_claim_interface(driver, info->data, dev);
+ if (status < 0)
+ return status;
+ }
status = usbnet_get_endpoints(dev, info->data);
if (status < 0) {
/* ensure immediate exit from usbnet_disconnect */
usb_set_intfdata(info->data, NULL);
- usb_driver_release_interface(driver, info->data);
+ if (info->data != info->control)
+ usb_driver_release_interface(driver, info->data);
return status;
}
/* status endpoint: optional for CDC Ethernet, not RNDIS (or ACM) */
- dev->status = NULL;
+ if (info->data != info->control)
+ dev->status = NULL;
if (info->control->cur_altsetting->desc.bNumEndpoints == 1) {
struct usb_endpoint_descriptor *desc;
@@ -349,6 +357,10 @@ void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf)
struct cdc_state *info = (void *) &dev->data;
struct usb_driver *driver = driver_of(intf);
+ /* combined interface - nothing to do */
+ if (info->data == info->control)
+ return;
+
/* disconnect master --> disconnect slave */
if (intf == info->control && info->data) {
/* ensure immediate exit from usbnet_disconnect */
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: cdc_ether: allow combined control and data interface
[not found] ` <1372500186-23567-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
@ 2013-07-02 6:38 ` David Miller
2013-07-02 9:06 ` Oliver Neukum
0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2013-07-02 6:38 UTC (permalink / raw)
To: bjorn-yOkvZcmFvRU
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA,
mrkiko.rs-Re5JQEeQqe8AvxtiuMwx3w, oliver-GvhC2dPhHPQdnm+yROfE0A
From: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
Date: Sat, 29 Jun 2013 12:03:06 +0200
> Some Icera based Huawei modems handled by this driver are not
> completely CDC ECM compliant, using the same USB interface for both
> control and data. The CDC functional descriptors include a Union
> naming this interface as both master and slave, so it is supportable
> by relaxing the descriptor parsing in case these interfaces are
> identical.
>
> This has been tested on a Huawei K3806 and verified to add support
> for that device.
>
> Reported-and-tested-by: Enrico Mioso <mrkiko.rs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Bjørn Mork <bjorn-yOkvZcmFvRU@public.gmane.org>
> ---
> v2: Simplified unbind logic. Thanks to Oliver Neukum
Oliver if you could give this a quick review, that would be
great.
Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: cdc_ether: allow combined control and data interface
2013-06-29 10:03 [PATCH v2] net: cdc_ether: allow combined control and data interface Bjørn Mork
[not found] ` <1372500186-23567-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
@ 2013-07-02 8:17 ` Oliver Neukum
2013-07-02 8:48 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Oliver Neukum @ 2013-07-02 8:17 UTC (permalink / raw)
To: Bjørn Mork; +Cc: netdev, linux-usb, Enrico Mioso
On Saturday 29 June 2013 12:03:06 Bjørn Mork wrote:
> Some Icera based Huawei modems handled by this driver are not
> completely CDC ECM compliant, using the same USB interface for both
> control and data. The CDC functional descriptors include a Union
> naming this interface as both master and slave, so it is supportable
> by relaxing the descriptor parsing in case these interfaces are
> identical.
>
> This has been tested on a Huawei K3806 and verified to add support
> for that device.
>
> Reported-and-tested-by: Enrico Mioso <mrkiko.rs@gmail.com>
> Signed-off-by: Bjørn Mork <bjorn@mork.no>
Acked-by: Oliver Neukum <oliver@neukum.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: cdc_ether: allow combined control and data interface
2013-07-02 8:17 ` Oliver Neukum
@ 2013-07-02 8:48 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2013-07-02 8:48 UTC (permalink / raw)
To: oliver; +Cc: bjorn, netdev, linux-usb, mrkiko.rs
From: Oliver Neukum <oliver@neukum.org>
Date: Tue, 02 Jul 2013 10:17:51 +0200
> On Saturday 29 June 2013 12:03:06 Bjørn Mork wrote:
>> Some Icera based Huawei modems handled by this driver are not
>> completely CDC ECM compliant, using the same USB interface for both
>> control and data. The CDC functional descriptors include a Union
>> naming this interface as both master and slave, so it is supportable
>> by relaxing the descriptor parsing in case these interfaces are
>> identical.
>>
>> This has been tested on a Huawei K3806 and verified to add support
>> for that device.
>>
>> Reported-and-tested-by: Enrico Mioso <mrkiko.rs@gmail.com>
>> Signed-off-by: Bjørn Mork <bjorn@mork.no>
> Acked-by: Oliver Neukum <oliver@neukum.org>
Applied, thanks for the review Oliver.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: cdc_ether: allow combined control and data interface
2013-07-02 6:38 ` David Miller
@ 2013-07-02 9:06 ` Oliver Neukum
0 siblings, 0 replies; 5+ messages in thread
From: Oliver Neukum @ 2013-07-02 9:06 UTC (permalink / raw)
To: David Miller; +Cc: bjorn, netdev, linux-usb, mrkiko.rs
On Monday 01 July 2013 23:38:17 David Miller wrote:
> From: Bjørn Mork <bjorn@mork.no>
> Date: Sat, 29 Jun 2013 12:03:06 +0200
>
> > Some Icera based Huawei modems handled by this driver are not
> > completely CDC ECM compliant, using the same USB interface for both
> > control and data. The CDC functional descriptors include a Union
> > naming this interface as both master and slave, so it is supportable
> > by relaxing the descriptor parsing in case these interfaces are
> > identical.
> >
> > This has been tested on a Huawei K3806 and verified to add support
> > for that device.
> >
> > Reported-and-tested-by: Enrico Mioso <mrkiko.rs@gmail.com>
> > Signed-off-by: Bjørn Mork <bjorn@mork.no>
> > ---
> > v2: Simplified unbind logic. Thanks to Oliver Neukum
>
> Oliver if you could give this a quick review, that would be
> great.
Done.
Sorry for the delay
Oliver
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-07-02 9:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-29 10:03 [PATCH v2] net: cdc_ether: allow combined control and data interface Bjørn Mork
[not found] ` <1372500186-23567-1-git-send-email-bjorn-yOkvZcmFvRU@public.gmane.org>
2013-07-02 6:38 ` David Miller
2013-07-02 9:06 ` Oliver Neukum
2013-07-02 8:17 ` Oliver Neukum
2013-07-02 8:48 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).