Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/dev/lib/libugenhc Fix snafu with error reporting in...



details:   https://anonhg.NetBSD.org/src/rev/704572305beb
branches:  trunk
changeset: 752235:704572305beb
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sat Feb 20 13:56:29 2010 +0000

description:
Fix snafu with error reporting in bulk transfers.

diffstat:

 sys/rump/dev/lib/libugenhc/ugenhc.c |  26 ++++++++++----------------
 1 files changed, 10 insertions(+), 16 deletions(-)

diffs (73 lines):

diff -r c677cda9d339 -r 704572305beb sys/rump/dev/lib/libugenhc/ugenhc.c
--- a/sys/rump/dev/lib/libugenhc/ugenhc.c       Sat Feb 20 13:43:31 2010 +0000
+++ b/sys/rump/dev/lib/libugenhc/ugenhc.c       Sat Feb 20 13:56:29 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ugenhc.c,v 1.5 2010/02/18 16:24:19 pooka Exp $ */
+/*     $NetBSD: ugenhc.c,v 1.6 2010/02/20 13:56:29 pooka Exp $ */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugenhc.c,v 1.5 2010/02/18 16:24:19 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugenhc.c,v 1.6 2010/02/20 13:56:29 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -707,7 +707,7 @@
        bool isread;
        int len, error, endpt;
        uint8_t *buf;
-       int xfererr = 0;
+       int xfererr = USBD_NORMAL_COMPLETION;
        int val;
 
        endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
@@ -734,7 +734,7 @@
                                if (error == ETIMEDOUT)
                                        continue;
                                n = 0;
-                               xfer->status = USBD_IOERROR;
+                               xfererr = USBD_IOERROR;
                                goto out;
                        }
                        done += n;
@@ -746,8 +746,11 @@
                        done = n;
                        if (done == len)
                                break;
-                       else
+                       else if (n != -1)
                                panic("short write");
+
+                       xfererr = USBD_IOERROR;
+                       goto out;
                }
 
                if (xfer->flags & USBD_SHORT_XFER_OK)
@@ -756,21 +759,12 @@
 
        if (RUSB(xfer)->rusb_status == 0) {
                xfer->actlen = done;
-               xfer->status = USBD_NORMAL_COMPLETION;
-               /* override */
-               if (xfererr) {
-                       printf("err!\n");
-                       xfer->status = xfererr;
-               }
        } else {
-               xfer->status = USBD_CANCELLED;
+               xfererr = USBD_CANCELLED;
                RUSB(xfer)->rusb_status = 2;
        }
  out:
-       val = 0;
-       error = 0;
-       rumpuser_ioctl(sc->sc_ugenfd[endpt], USB_SET_SHORT_XFER, &val, &error);
-       xfer->status = error;
+       xfer->status = xfererr;
        usb_transfer_complete(xfer);
        return (USBD_IN_PROGRESS);
 }



Home | Main Index | Thread Index | Old Index