Hi there!

Being in need of uticom driver noticed that it didn't worked out of the box. Compiled, but opening the serial port twice panics the kernel.

With the attached fix applyed to sys/dev/usb/uticom.c it's working for me now with single port devices.

Regards,

Dani

Patch
==================================================================
--- uticom.c    Sat Nov 20 20:11:19 2010
+++ uticom.c    Wed Dec  1 10:55:47 2010
@@ -209,7 +209,6 @@
     struct uticom_softc *sc = (struct uticom_softc *)self;
     struct usb_attach_arg *uaa = aux;
     usbd_device_handle dev = uaa->device;
-    usbd_interface_handle iface;
     usb_config_descriptor_t *cdesc;
     usb_interface_descriptor_t *id;
     usb_endpoint_descriptor_t *ed;
@@ -381,7 +380,7 @@
     sc->sc_iface_number = id->bInterfaceNumber;

     for (i = 0; i < id->bNumEndpoints; i++) {
-        ed = usbd_interface2endpoint_descriptor(iface, i);
+        ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i);
         if (ed == NULL) {
             printf("%s: no endpoint descriptor for %d\n",
                 sc->sc_dev.dv_xname, i);
@@ -392,9 +391,12 @@
         if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN &&
             UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
             uca.bulkin = ed->bEndpointAddress;
+            uca.ibufsize = UGETW(ed->wMaxPacketSize);
+            uca.ibufsizepad = UGETW(ed->wMaxPacketSize);
         } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT &&
             UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) {
             uca.bulkout = ed->bEndpointAddress;
+            uca.obufsize = UGETW(ed->wMaxPacketSize);
         }
     }

@@ -415,11 +417,8 @@
     sc->sc_dtr = sc->sc_rts = -1;

     uca.portno = UCOM_UNK_PORTNO;
-    uca.ibufsize = UTICOM_IBUFSZ;
-    uca.obufsize = UTICOM_OBUFSZ;
-    uca.ibufsizepad = UTICOM_IBUFSZ;
     uca.device = dev;
-    uca.iface = iface;
+    uca.iface = sc->sc_iface;
     uca.opkthdrlen = 0;
     uca.methods = &uticom_methods;
     uca.arg = sc;

Reply via email to