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)



On 04/05/15 01:52, Ryo ONODERA wrote:
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;

Missing  uaa->proto == UIPROTO_CDC_NOCLASS, I think.

That said, I think there's a bug somewhere else that's causing problems here.

Can you boot with -xv flags and an updated -current kernel with USB_DEBUG
and usbdebug set? I've add some more debug output to the kernel.

Thanks,
Nick





Home | Main Index | Thread Index | Old Index