Module Name:    src
Committed By:   martin
Date:           Sat May  9 08:16:54 UTC 2020

Modified Files:
        src/sys/dev/usb [netbsd-9]: if_cdce.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #896):

        sys/dev/usb/if_cdce.c: revision 1.71

Search the descriptors of the appropriate interface to ensure correct
match.

PR kern/55240 cdce(4) error "no data interface" when ECM USB IF are
preceded by ACM USB IF


To generate a diff of this commit:
cvs rdiff -u -r1.53.2.1 -r1.53.2.2 src/sys/dev/usb/if_cdce.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.53.2.1 src/sys/dev/usb/if_cdce.c:1.53.2.2
--- src/sys/dev/usb/if_cdce.c:1.53.2.1	Sun Sep  1 13:00:36 2019
+++ src/sys/dev/usb/if_cdce.c	Sat May  9 08:16:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cdce.c,v 1.53.2.1 2019/09/01 13:00:36 martin Exp $ */
+/*	$NetBSD: if_cdce.c,v 1.53.2.2 2020/05/09 08:16:54 martin Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wp...@windriver.com>
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.53.2.1 2019/09/01 13:00:36 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.53.2.2 2020/05/09 08:16:54 martin Exp $");
 
 #include <sys/param.h>
 
@@ -145,8 +145,9 @@ cdce_attach(device_t parent, device_t se
 	if (un->un_flags & CDCE_NO_UNION)
 		un->un_iface = uiaa->uiaa_iface;
 	else {
-		ud = (const usb_cdc_union_descriptor_t *)usb_find_desc(un->un_udev,
-		    UDESC_CS_INTERFACE, UDESCSUB_CDC_UNION);
+		ud = (const usb_cdc_union_descriptor_t *)usb_find_desc_if(un->un_udev,
+		    UDESC_CS_INTERFACE, UDESCSUB_CDC_UNION,
+		    usbd_get_interface_descriptor(uiaa->uiaa_iface));
 		if (ud == NULL) {
 			aprint_error_dev(self, "no union descriptor\n");
 			return;
@@ -236,8 +237,9 @@ cdce_attach(device_t parent, device_t se
 		return;
 	}
 
-	ue = (const usb_cdc_ethernet_descriptor_t *)usb_find_desc(dev,
-	    UDESC_CS_INTERFACE, UDESCSUB_CDC_ENF);
+	ue = (const usb_cdc_ethernet_descriptor_t *)usb_find_desc_if(dev,
+	    UDESC_CS_INTERFACE, UDESCSUB_CDC_ENF,
+	    usbd_get_interface_descriptor(uiaa->uiaa_iface));
 	if (!ue || usbd_get_string(dev, ue->iMacAddress, eaddr_str) ||
 	    ether_aton_r(un->un_eaddr, sizeof(un->un_eaddr), eaddr_str)) {
 		aprint_normal_dev(self, "faking address\n");

Reply via email to