Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: USB networking (cdce) with Linux host (g_ether)



Hi,

I believe that following patch is good for us because my USB modem device
is bad information and it should be treated as special case.

Index: sys/dev/usb/umodem.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umodem.c,v
retrieving revision 1.66
diff -u -r1.66 umodem.c
--- sys/dev/usb/umodem.c	6 Apr 2014 02:01:43 -0000	1.66
+++ sys/dev/usb/umodem.c	5 Apr 2015 00:49:30 -0000
@@ -81,6 +81,11 @@
 	NULL,
 };
 
+Static const struct usb_devno umodem_devs[] = {
+	{ USB_VENDOR_CONEXANT, USB_PRODUCT_CONEXANT_MODEM_1},
+};
+#define umodem_lookup(v, p) usb_lookup(umodem_devs, v, p)
+
 int             umodem_match(device_t, cfdata_t, void *);
 void            umodem_attach(device_t, device_t, void *);
 int             umodem_detach(device_t, int);
@@ -97,22 +102,24 @@
 	struct usbif_attach_arg *uaa = aux;
 	usb_interface_descriptor_t *id;
 	int cm, acm;
+	int ret = UMATCH_NONE;
 
-	id = usbd_get_interface_descriptor(uaa->iface);
-	if (uaa->subclass != UISUBCLASS_ABSTRACT_CONTROL_MODEL &&
-	    (id->bInterfaceClass == UICLASS_CDC_DATA &&
-	     id->bInterfaceSubClass == UISUBCLASS_DATA))
-		return (UMATCH_IFACECLASS_IFACESUBCLASS);
-
-	if (uaa->class != UICLASS_CDC ||
-	    uaa->subclass != UISUBCLASS_ABSTRACT_CONTROL_MODEL ||
-	    !(uaa->proto == UIPROTO_CDC_NOCLASS || uaa->proto == UIPROTO_CDC_AT))
-		return (UMATCH_NONE);
+	if (umodem_lookup(uaa->vendor, uaa->product))
+		ret = UMATCH_VENDOR_PRODUCT;
 
+	if (uaa->class == UICLASS_CDC &&
+	    uaa->subclass == UISUBCLASS_ABSTRACT_CONTROL_MODEL &&
+	    uaa->proto == UIPROTO_CDC_AT)
+		ret = UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO;
+
+	if (ret == UMATCH_NONE)
+		return UMATCH_NONE;
+
+	id = usbd_get_interface_descriptor(uaa->iface);
 	if (umodem_get_caps(uaa->device, &cm, &acm, id) == -1)
 		return (UMATCH_NONE);
 
-	return (UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO);
+	return (ret);
 }
 
 void 
Index: sys/dev/usb/usbdevs
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs,v
retrieving revision 1.693
diff -u -r1.693 usbdevs
--- sys/dev/usb/usbdevs	17 Mar 2015 08:14:30 -0000	1.693
+++ sys/dev/usb/usbdevs	5 Apr 2015 00:49:31 -0000
@@ -3345,6 +3345,7 @@
 /* Conexant */
 product CONEXANT PRISM_GT_1	0x2000	PrismGT USB 2.0 WLAN
 product CONEXANT PRISM_GT_2	0x2002	PrismGT USB 2.0 WLAN
+product CONEXANT MODEM_1	0x1329	USB Modem
 
 /* Yamaha products */
 product YAMAHA UX256		0x1000	UX256 MIDI I/F
Index: sys/dev/usb/usbdevs.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs.h,v
retrieving revision 1.685
diff -u -r1.685 usbdevs.h
--- sys/dev/usb/usbdevs.h	17 Mar 2015 08:15:48 -0000	1.685
+++ sys/dev/usb/usbdevs.h	5 Apr 2015 00:49:31 -0000
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.685 2015/03/17 08:15:48 macallan Exp $	*/
+/*	$NetBSD$	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.692 2015/03/15 01:37:47 nonaka Exp
+ *	NetBSD: usbdevs,v 1.693 2015/03/17 08:14:30 macallan Exp
  */
 
 /*
@@ -3352,6 +3352,7 @@
 /* Conexant */
 #define	USB_PRODUCT_CONEXANT_PRISM_GT_1	0x2000		/* PrismGT USB 2.0 WLAN */
 #define	USB_PRODUCT_CONEXANT_PRISM_GT_2	0x2002		/* PrismGT USB 2.0 WLAN */
+#define	USB_PRODUCT_CONEXANT_MODEM_1	0x1329		/* USB Modem */
 
 /* Yamaha products */
 #define	USB_PRODUCT_YAMAHA_UX256	0x1000		/* UX256 MIDI I/F */
Index: sys/dev/usb/usbdevs_data.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs_data.h,v
retrieving revision 1.686
diff -u -r1.686 usbdevs_data.h
--- sys/dev/usb/usbdevs_data.h	17 Mar 2015 08:15:48 -0000	1.686
+++ sys/dev/usb/usbdevs_data.h	5 Apr 2015 00:49:31 -0000
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.686 2015/03/17 08:15:48 macallan Exp $	*/
+/*	$NetBSD$	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.692 2015/03/15 01:37:47 nonaka Exp
+ *	NetBSD: usbdevs,v 1.693 2015/03/17 08:14:30 macallan Exp
  */
 
 /*
@@ -4510,6 +4510,8 @@
 	    5167, 4710, 5175, 5140, 0,
 	    USB_VENDOR_CONEXANT, USB_PRODUCT_CONEXANT_PRISM_GT_2, 
 	    5167, 4710, 5175, 5140, 0,
+	    USB_VENDOR_CONEXANT, USB_PRODUCT_CONEXANT_MODEM_1, 
+	    4710, 4845, 0,
 	    USB_VENDOR_YAMAHA, USB_PRODUCT_YAMAHA_UX256, 
 	    18766, 15980, 15971, 0,
 	    USB_VENDOR_YAMAHA, USB_PRODUCT_YAMAHA_MU1000, 
@@ -5280,7 +5282,7 @@
 	    "GNU\0" /* 1 refs @ 4689 */
 	    "USRP\0" /* 2 refs @ 4693 */
 	    "HomeConnect\0" /* 4 refs @ 4698 */
-	    "USB\0" /* 188 refs @ 4710 */
+	    "USB\0" /* 189 refs @ 4710 */
 	    "Bluetooth\0" /* 17 refs @ 4714 */
 	    "Adapter\0" /* 71 refs @ 4724 */
 	    "3C19250\0" /* 1 refs @ 4732 */
@@ -5296,7 +5298,7 @@
 	    "3C460B\0" /* 1 refs @ 4812 */
 	    "3CRUSB10075\0" /* 1 refs @ 4819 */
 	    "OfficeConnect\0" /* 1 refs @ 4831 */
-	    "Modem\0" /* 14 refs @ 4845 */
+	    "Modem\0" /* 15 refs @ 4845 */
 	    "ISDN\0" /* 3 refs @ 4851 */
 	    "TA\0" /* 2 refs @ 4856 */
 	    "camera\0" /* 5 refs @ 4859 */

--
Ryo ONODERA // ryo_on%yk.rim.or.jp@localhost
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


Home | Main Index | Thread Index | Old Index