Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349241
b: refs/heads/master
c: 9992c2e
h: refs/heads/master
i:
  349239: e5df646
v: v3
  • Loading branch information
Bjørn Mork authored and David S. Miller committed Jan 21, 2013
1 parent 814e3e5 commit b46e9c1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8141ed9fcedb278f4a3a78680591bef1e55f75fb
refs/heads/master: 9992c2e2fbb72ffc63d4587c4aa94dfcd8229e55
27 changes: 27 additions & 0 deletions trunk/drivers/net/usb/cdc_ncm.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,23 @@ static const struct ethtool_ops cdc_ncm_ethtool_ops = {
.nway_reset = usbnet_nway_reset,
};

/* return first slave interface if an IAD matches the given master */
static struct usb_interface *get_iad_slave(struct usb_device *udev,
struct usb_interface *master) {
int i;
struct usb_interface_assoc_descriptor *iad;
u8 mnum = master->cur_altsetting->desc.bInterfaceNumber;

for (i = 0; i < USB_MAXIADS; i++) {
iad = udev->actconfig->intf_assoc[i];
if (!iad)
break;
if (iad->bFirstInterface == mnum && iad->bInterfaceCount == 2)
return usb_ifnum_to_if(udev, mnum + 1);
}
return NULL;
}

int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_altsetting)
{
struct cdc_ncm_ctx *ctx;
Expand Down Expand Up @@ -435,6 +452,16 @@ int cdc_ncm_bind_common(struct usbnet *dev, struct usb_interface *intf, u8 data_
len -= temp;
}

/* some buggy devices have an IAD but no CDC Union */
if (!ctx->union_desc) {
dev_dbg(&intf->dev, "missing CDC Union descriptor\n");
ctx->data = get_iad_slave(dev->udev, intf);
if (ctx->data) {
ctx->control = intf;
dev_dbg(&intf->dev, "got slave from IAD\n");
}
}

/* check if we got everything */
if ((ctx->control == NULL) || (ctx->data == NULL) ||
((!ctx->mbim_desc) && ((ctx->ether_desc == NULL) || (ctx->control != intf))))
Expand Down

0 comments on commit b46e9c1

Please sign in to comment.