Current-Users archive

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

Re: ohci: early return



On 04/16/13 09:13, Thomas Klausner wrote:
I'm using an ehci+ohci host controller in a pci-express slot on
6.99.19/amd64, for a uaudio sound card (dmesg at the end).

The first issue is: this uaudio0 is not detected at boot, nor can I
detect it using drvctl. I have to physically unplug and replug the
soundcard after boot. Any ideas why this is necessary?

Can you try to boot with the attached patch for starters?


Second issue: About once a day (usually when starting audio playback),
I get:

Apr 16 09:58:10 yt /netbsd: ohci1: isoc TD alloc failed


It ran out of memory and never recovered. This won't be easy to fix.

Nick
Index: sys/dev/usb/usb_subr.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.190
diff -u -p -u -r1.190 usb_subr.c
--- sys/dev/usb/usb_subr.c      20 Mar 2013 11:14:51 -0000      1.190
+++ sys/dev/usb/usb_subr.c      16 Apr 2013 09:18:59 -0000
@@ -1063,6 +1063,9 @@ usbd_reattach_device(device_t parent, us
  * Do as Windows does: try to read 64 bytes -- there are devices which
  * recognize the initial descriptor fetch (before the control endpoint's
  * MaxPacketSize is known by the host) by exactly this length.
+ *
+ * If the 64 bytes request fails try for just the 8 that the USB 2.0
+ * specification says should be requested.
  */
 static usbd_status
 usbd_get_initial_ddesc(usbd_device_handle dev, usb_device_descriptor_t *desc)
@@ -1076,13 +1079,23 @@ usbd_get_initial_ddesc(usbd_device_handl
        USETW2(req.wValue, UDESC_DEVICE, 0);
        USETW(req.wIndex, 0);
        USETW(req.wLength, 64);
+       DPRINTF(("%s asking for 64 bytes\n", __func__));
+
        res = usbd_do_request_flags(dev, &req, buf, USBD_SHORT_XFER_OK,
                &actlen, USBD_DEFAULT_TIMEOUT);
-       if (res)
-               return res;
+       if (res) {
+               DPRINTF(("%s asking for 8 bytes\n", __func__));
+               USETW(req.wLength, 8);
+               res = usbd_do_request_flags(dev, &req, buf, USBD_SHORT_XFER_OK,
+                       &actlen, USBD_DEFAULT_TIMEOUT);
+               if (res)
+                       return res;
+       }
        if (actlen < 8)
                return USBD_SHORT_XFER;
        memcpy(desc, buf, 8);
+       DPRINTF(("%s got info\n", __func__));
+
        return USBD_NORMAL_COMPLETION;
 }
 


Home | Main Index | Thread Index | Old Index