@@ -563,6 +563,33 @@ static int cdc_ncm_bind(struct usbnet *dev, struct usb_interface *intf)
563
563
{
564
564
int ret ;
565
565
566
+ /* The MBIM spec defines a NCM compatible default altsetting,
567
+ * which we may have matched:
568
+ *
569
+ * "Functions that implement both NCM 1.0 and MBIM (an
570
+ * “NCM/MBIM function”) according to this recommendation
571
+ * shall provide two alternate settings for the
572
+ * Communication Interface. Alternate setting 0, and the
573
+ * associated class and endpoint descriptors, shall be
574
+ * constructed according to the rules given for the
575
+ * Communication Interface in section 5 of [USBNCM10].
576
+ * Alternate setting 1, and the associated class and
577
+ * endpoint descriptors, shall be constructed according to
578
+ * the rules given in section 6 (USB Device Model) of this
579
+ * specification."
580
+ *
581
+ * Do not bind to such interfaces, allowing cdc_mbim to handle
582
+ * them
583
+ */
584
+ #if IS_ENABLED (CONFIG_USB_NET_CDC_MBIM )
585
+ if ((intf -> num_altsetting == 2 ) &&
586
+ !usb_set_interface (dev -> udev ,
587
+ intf -> cur_altsetting -> desc .bInterfaceNumber ,
588
+ CDC_NCM_COMM_ALTSETTING_MBIM ) &&
589
+ cdc_ncm_comm_intf_is_mbim (intf -> cur_altsetting ))
590
+ return - ENODEV ;
591
+ #endif
592
+
566
593
/* NCM data altsetting is always 1 */
567
594
ret = cdc_ncm_bind_common (dev , intf , 1 );
568
595
0 commit comments