>Number:         109959
>Category:       usb
>Synopsis:       usb_interrupt_read does not respect timeout
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-usb
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 06 03:20:08 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Maurice Castro
>Release:        FreeBSD 5.4-RELEASE i386
>Organization:
Clarinet Internet Solutions
>Environment:
System: FreeBSD sphinx.clari.net.au 5.4-RELEASE FreeBSD 5.4-RELEASE #1: Wed Nov 
30 11:05:23 EST 2005 [EMAIL PROTECTED]:/work/src/sys/i386/compile/sphinx i386

All version of FreeBSD (and other BSDs) since 5.4 (possibly earlier)


>Description:

Requesting a timeout on usb_interrupt_read has no effect. This results in 
hanging reads for libusb. 

>How-To-Repeat:

In particular, the port sysutils/nut-usb will hang on initialising
a Powerware 3105 UPS.

>Fix:

--- ugen.c.orig Tue Mar  6 13:36:15 2007
+++ ugen.c      Tue Mar  6 09:56:20 2007
@@ -740,11 +740,17 @@
                        }
                        sce->state |= UGEN_ASLP;
                        DPRINTFN(5, ("ugenread: sleep on %p\n", sce));
-                       error = tsleep(sce, PZERO | PCATCH, "ugenri", 0);
+                       error = tsleep(sce, PZERO | PCATCH, "ugenri", 
sce->timeout);
                        sce->state &= ~UGEN_ASLP;
                        DPRINTFN(5, ("ugenread: woke, error=%d\n", error));
                        if (sc->sc_dying)
                                error = EIO;
+                       /* we timed out - return 0 bytes */
+                       if (error == EAGAIN)
+                       {
+                               error = 0;
+                               break;
+                       }
                        if (error)
                                break;
                }

>Release-Note:
>Audit-Trail:
>Unformatted:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-usb
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to