Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/dev/wip/librumpusbhc Add a simple hack to make inte...



details:   https://anonhg.NetBSD.org/src/rev/bd4e1257431b
branches:  trunk
changeset: 750689:bd4e1257431b
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sun Jan 10 22:13:18 2010 +0000

description:
Add a simple hack to make interrupt pipes work (can't close them
yet ... except with SIGINT.  "muah").

diffstat:

 sys/rump/dev/wip/librumpusbhc/rumpusbhc.c |  19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diffs (56 lines):

diff -r f6c078be3ee2 -r bd4e1257431b sys/rump/dev/wip/librumpusbhc/rumpusbhc.c
--- a/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c Sun Jan 10 21:30:16 2010 +0000
+++ b/sys/rump/dev/wip/librumpusbhc/rumpusbhc.c Sun Jan 10 22:13:18 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpusbhc.c,v 1.11 2010/01/10 21:30:16 pooka Exp $     */
+/*     $NetBSD: rumpusbhc.c,v 1.12 2010/01/10 22:13:18 pooka Exp $     */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpusbhc.c,v 1.11 2010/01/10 21:30:16 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpusbhc.c,v 1.12 2010/01/10 22:13:18 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -740,8 +740,17 @@
 doxfer_kth(void *arg)
 {
        usbd_xfer_handle xfer = arg;
+       usb_endpoint_descriptor_t *ed = xfer->pipe->endpoint->edesc;
+       bool repeat;
 
-       rumpusb_device_bulk_start(SIMPLEQ_FIRST(&xfer->pipe->queue));
+       if ((ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT)
+               repeat = true;
+       else
+               repeat = false;
+
+       do {
+               rumpusb_device_bulk_start(SIMPLEQ_FIRST(&xfer->pipe->queue));
+       } while (repeat);
        kthread_exit(0);
 }
 
@@ -857,8 +866,9 @@
                case UE_CONTROL:
                        pipe->methods = &rumpusb_device_ctrl_methods;
                        break;
+               case UE_INTERRUPT:
                case UE_BULK:
-               case UE_INTERRUPT:
+                       pipe->methods = &rumpusb_device_bulk_methods;
                        endpt = pipe->endpoint->edesc->bEndpointAddress;
                        if (UE_GET_DIR(endpt) == UE_DIR_IN) {
                                oflags = O_RDONLY;
@@ -866,7 +876,6 @@
                                oflags = O_WRONLY;
                        }
                        endpt = UE_GET_ADDR(endpt);
-                       pipe->methods = &rumpusb_device_bulk_methods;
 
                        if (sc->sc_fdmodes[endpt] == oflags
                            || sc->sc_fdmodes[endpt] == O_RDWR)



Home | Main Index | Thread Index | Old Index