Patchwork [2/3] cdc_ether: allow vendor specific data interface if control interface is vendor specific

login
register
mail settings
Submitter Bjørn Mork
Date Dec. 13, 2011, 4:33 a.m.
Message ID <1323750784-32608-3-git-send-email-bjorn@mork.no>
Download mbox | patch
Permalink /patch/130983/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Bjørn Mork - Dec. 13, 2011, 4:33 a.m.
From: Bjørn Mork <bjorn@mork.no>

Some vendors, like Huawei, use the vendor specific class code all over the
place even for devices which otherwise conform pretty well to the CDC ECM
specification.  This allows such devices to be supported merely by
adding them to the device specific whitelist.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
---
 drivers/net/usb/cdc_ether.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
Joe Perches - Dec. 13, 2011, 4:54 a.m.
On Tue, 2011-12-13 at 05:33 +0100, Bjorn Mork wrote:
> diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
[]
> @@ -211,8 +211,12 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
[]
> -				dev_dbg(&intf->dev, "slave class %u\n",
[]
> +				dev_dbg(&intf->dev, "xslave class %u\n",

Why change the output from slave to xslave?


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bjørn Mork - Dec. 13, 2011, 4:59 a.m.
Joe Perches <joe@perches.com> writes:

> On Tue, 2011-12-13 at 05:33 +0100, Bjorn Mork wrote:
>> diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
> []
>> @@ -211,8 +211,12 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
> []
>> -				dev_dbg(&intf->dev, "slave class %u\n",
> []
>> +				dev_dbg(&intf->dev, "xslave class %u\n",
>
> Why change the output from slave to xslave?

That was unintentional.  Sorry.  Don't understand how checkpatch could
have missed that :-)

Will fix and submit again, unless there are objections to the actual
code change.



Bjørn
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov - Dec. 13, 2011, 10:39 a.m.
Hello.

On 13-12-2011 8:59, Bjørn Mork wrote:

>> On Tue, 2011-12-13 at 05:33 +0100, Bjorn Mork wrote:
>>> diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
>> []
>>> @@ -211,8 +211,12 @@ int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
>> []
>>> -				dev_dbg(&intf->dev, "slave class %u\n",
>> []
>>> +				dev_dbg(&intf->dev, "xslave class %u\n",
>>
>> Why change the output from slave to xslave?
>
> That was unintentional.  Sorry.  Don't understand how checkpatch could
> have missed that :-)

    Don't understand what checkpatch.pl would have to do with that. :-)

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 99ed6eb..84840dd 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -211,8 +211,12 @@  int usbnet_generic_cdc_bind(struct usbnet *dev, struct usb_interface *intf)
 
 			/* a data interface altsetting does the real i/o */
 			d = &info->data->cur_altsetting->desc;
-			if (d->bInterfaceClass != USB_CLASS_CDC_DATA) {
-				dev_dbg(&intf->dev, "slave class %u\n",
+			if ((d->bInterfaceClass != USB_CLASS_CDC_DATA) &&
+				/* Allow vendor specific data interface iff
+				   control interface is vendor specific */
+				!(info->control->cur_altsetting->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
+					d->bInterfaceClass == USB_CLASS_VENDOR_SPEC)) {
+				dev_dbg(&intf->dev, "xslave class %u\n",
 					d->bInterfaceClass);
 				goto bad_desc;
 			}