From 36e939eaa1a7ee8a68b4bcd6ca4c92f18daf8203 Mon Sep 17 00:00:00 2001 From: augustss Date: Tue, 17 May 2005 14:53:06 +0000 Subject: 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. --- sys/dev/usb/ugen.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sys/dev') 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 -__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 #include @@ -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)) { -- cgit