diff options
| author | augustss <augustss@NetBSD.org> | 2005-05-17 14:53:06 +0000 |
|---|---|---|
| committer | augustss <augustss@NetBSD.org> | 2005-05-17 14:53:06 +0000 |
| commit | 36e939eaa1a7ee8a68b4bcd6ca4c92f18daf8203 (patch) | |
| tree | a59695bbdeb35b4a19220086a36c461e89ac98bf /sys/dev | |
| parent | beb8d4ff57839c07ccad65e4cdb5617a4bb7b460 (diff) | |
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.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/ugen.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/usb/ugen.c b/sys/dev/usb/ugen.c index ad85b24b8a1..b4a3d9955a0 100644 --- a/sys/dev/usb/ugen.c +++ b/sys/dev/usb/ugen.c @@ -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 @@ ugenopen(dev_t dev, int flag, int mode, usb_proc_ptr p) 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)) { |
