Re: =?utf-8?B?562U5aSNOiDnrZTlpI06?= MM: Non QMI Huawei modems without PPP support?



Olof Ermis <olof ermis gmail com> writes:

>  grep . /sys/bus/usb/devices/2-6:1.1/bAlternateSetting
>
> Gives
>
> 0
>
> so that should be on order then I assume.
>
> Tommy, do you have any input here? You got cdc_ncm to work with the
> patch right? Do you have any idea why bind() fails?
>
> So I did some debugging and it fails at
>
> temp = usb_driver_claim_interface(driver, ctx->data, dev);
>
> With the attached cdc_ncm.c (and the lsusb -v log) I get the following log:
>
> Nov 13 10:27:40 oloflinux kernel: [72536.855827] usbcore:
> deregistering interface driver cdc_ncm
> Nov 13 10:27:51 oloflinux kernel: [72548.585477] usb 2-6: while(),
> buf[1] is 36, buf[2] is 0
> Nov 13 10:27:51 oloflinux kernel: [72548.585481] usb 2-6: Entered
> advance section'
> Nov 13 10:27:51 oloflinux kernel: [72548.585484] usb 2-6: while(),
> buf[1] is 36, buf[2] is 26
> Nov 13 10:27:51 oloflinux kernel: [72548.585486] usb 2-6: Entered
> USB_CDC_NCM_TYPE
> Nov 13 10:27:51 oloflinux kernel: [72548.585488] usb 2-6: Still in
> USB_CDC_NCM_TYPE
> Nov 13 10:27:51 oloflinux kernel: [72548.585490] usb 2-6: Entered
> advance section'
> Nov 13 10:27:51 oloflinux kernel: [72548.585493] usb 2-6: while(),
> buf[1] is 36, buf[2] is 15
> Nov 13 10:27:51 oloflinux kernel: [72548.585495] usb 2-6: USB_CDC_ETHERNET_TYPE
> Nov 13 10:27:51 oloflinux kernel: [72548.585497] usb 2-6: Entered
> advance section'
> Nov 13 10:27:51 oloflinux kernel: [72548.585500] usb 2-6: while(),
> buf[1] is 36, buf[2] is 6
> Nov 13 10:27:51 oloflinux kernel: [72548.585502] usb 2-6: USB_CDC_UNION_TYPE
> Nov 13 10:27:51 oloflinux kernel: [72548.585504] usb 2-6: Entered
> advance section'
> Nov 13 10:27:51 oloflinux kernel: [72548.585507] cdc_ncm 2-6:1.1:
> Failed at 'claim interfaces, if any'
> Nov 13 10:27:51 oloflinux kernel: [72548.585510] usb 2-6: bind() failure
>
> I commented out temp = usb_driver_claim_interface(driver, ctx->data,
> dev); that line to see what happened and then I got:

Great! Thanks a lot. This makes sense.  We try to claim the data
interface, but fail since that is identical to the control interface
which is already claimed by us during the probe.

I guess we have to add an additional test here to avoid claiming the
data interface when it is identical to the control interface.  That will
probably make this v3.8 material.

> Nov 13 10:35:24 oloflinux NetworkManager[924]:    SCPlugin-Ifupdown:
> devices added (path:
> /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-6/2-6:1.1/net/wwan0,
> iface: wwan0)
> Nov 13 10:35:24 oloflinux NetworkManager[924]:    SCPlugin-Ifupdown:
> device added (path:
> /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-6/2-6:1.1/net/wwan0,
> iface: wwan0): no ifupdown configuration found.
>
> So it passed all the other subsequent checks it looks like, but still
> no wwan0 device when I do ifconfig though...

NM certainly sees the device.  But it is not up by default, so you will
need to run either "ifconfig -a" or "ifconfig wwan0" to see it.

Could you verify that something like the attached patch works just as
well as commenting out the usb_driver_claim_interface?


Bjørn
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 4cd582a..3e9378b 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -540,10 +540,12 @@ advance:
 	    (ctx->ether_desc == NULL) || (ctx->control != intf))
 		goto error;
 
-	/* claim interfaces, if any */
-	temp = usb_driver_claim_interface(driver, ctx->data, dev);
-	if (temp)
-		goto error;
+	/* claim data interface, if different from control */
+	if (ctx->data != ctx->control) {
+		temp = usb_driver_claim_interface(driver, ctx->data, dev);
+		if (temp)
+			goto error;
+	}
 
 	iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber;
 
@@ -1245,6 +1247,14 @@ static const struct usb_device_id cdc_devs[] = {
 	  .driver_info = (unsigned long) &wwan_info,
 	},
 
+	/* Huawei NCM devices disguised as vendor specific */
+	{ USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x16),
+	  .driver_info = (unsigned long)&wwan_info,
+	},
+	{ USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x46),
+	  .driver_info = (unsigned long)&wwan_info,
+	},
+
 	/* Generic CDC-NCM devices */
 	{ USB_INTERFACE_INFO(USB_CLASS_COMM,
 		USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),


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