Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb Allow multiple opens of the control endpoint. T...



details:   https://anonhg.NetBSD.org/src/rev/5a79cbbed538
branches:  trunk
changeset: 580964:5a79cbbed538
user:      augustss <augustss%NetBSD.org@localhost>
date:      Tue May 17 14:53:06 2005 +0000

description:
Allow multiple opens of the control endpoint.  This is unproblematic since
the control endpoint is in some sense always open to the device.

>From wulf%ping.net.au@localhost.

diffstat:

 sys/dev/usb/ugen.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 888610fa171a -r 5a79cbbed538 sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c        Tue May 17 14:08:36 2005 +0000
+++ b/sys/dev/usb/ugen.c        Tue May 17 14:53:06 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ugen.c,v 1.72 2005/05/11 10:02:28 augustss Exp $       */
+/*     $NetBSD: ugen.c,v 1.73 2005/05/17 14:53:06 augustss Exp $       */
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.72 2005/05/11 10:02:28 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.73 2005/05/17 14:53:06 augustss Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -333,14 +333,15 @@
        if (sc == NULL || sc->sc_dying)
                return (ENXIO);
 
-       if (sc->sc_is_open[endpt])
-               return (EBUSY);
-
+       /* The control endpoint allows multiple opens. */
        if (endpt == USB_CONTROL_ENDPOINT) {
                sc->sc_is_open[USB_CONTROL_ENDPOINT] = 1;
                return (0);
        }
 
+       if (sc->sc_is_open[endpt])
+               return (EBUSY);
+
        /* Make sure there are pipes for all directions. */
        for (dir = OUT; dir <= IN; dir++) {
                if (flag & (dir == OUT ? FWRITE : FREAD)) {



Home | Main Index | Thread Index | Old Index