summaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorMarcus Glocker <mglocker@cvs.openbsd.org>2009-03-25 09:25:43 +0000
committerMarcus Glocker <mglocker@cvs.openbsd.org>2009-03-25 09:25:43 +0000
commit460adb7ee881cc97388d1e3da588348b4cb85a6a (patch)
treef220d782259a173f5f892f2066761b0367787667 /sys/dev/usb
parenta9a6ea62b135f36bb17c6c3a816f751db44279bd (diff)
Revert 1.119 bulk crash workaround, because it breaks Logitech QuickCam
9000 devices. Add a XXX comment that we need to fix the bulk issue properly instead.
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/uvideo.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/sys/dev/usb/uvideo.c b/sys/dev/usb/uvideo.c
index d6190d0317e..fba22d7a02d 100644
--- a/sys/dev/usb/uvideo.c
+++ b/sys/dev/usb/uvideo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvideo.c,v 1.121 2009/02/27 06:00:31 mglocker Exp $ */
+/* $OpenBSD: uvideo.c,v 1.122 2009/03/25 09:25:42 mglocker Exp $ */
/*
* Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
@@ -1672,14 +1672,15 @@ uvideo_vs_open(struct uvideo_softc *sc)
void
uvideo_vs_close(struct uvideo_softc *sc)
{
- sc->sc_vs_cur->bulk_running = 0;
-
/*
- * Some devices need time to shutdown before we switch back to
- * the default interface (0). Not doing so can leave the device
- * back in a undefined condition.
+ * XXX
+ * A bulk device will crash the kernel here, because in almost all
+ * cases we close the pipe before sc->sc_vs_cur->bulk_running = 0
+ * gets noticed in the thread loop of uvideo_vs_start_bulk_thread(),
+ * which make it access a closed pipe. We need to fix this
+ * properly.
*/
- usbd_delay_ms(sc->sc_udev, 100);
+ sc->sc_vs_cur->bulk_running = 0;
if (sc->sc_vs_cur->pipeh) {
usbd_abort_pipe(sc->sc_vs_cur->pipeh);
@@ -1687,6 +1688,13 @@ uvideo_vs_close(struct uvideo_softc *sc)
sc->sc_vs_cur->pipeh = NULL;
}
+ /*
+ * Some devices need time to shutdown before we switch back to
+ * the default interface (0). Not doing so can leave the device
+ * back in a undefined condition.
+ */
+ usbd_delay_ms(sc->sc_udev, 100);
+
/* switch back to default interface (turns off cam LED) */
(void)usbd_set_interface(sc->sc_vs_cur->ifaceh, 0);
}