aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/usb/usb.c23
-rw-r--r--sys/dev/usb/usb_port.h6
2 files changed, 24 insertions, 5 deletions
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index c35d679012db..6c915e7fb0d7 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.33 1999/11/22 21:57:09 augustss Exp $ */
+/* $NetBSD: usb.c,v 1.37 2000/01/24 18:35:51 thorpej Exp $ */
/* $FreeBSD$ */
/*
@@ -222,6 +222,10 @@ USB_ATTACH(usb)
}
printf("\n");
+ /* Make sure not to use tsleep() if we are cold booting. */
+ if (cold)
+ sc->sc_bus->use_polling++;
+
err = usbd_new_device(USBDEV(sc->sc_dev), sc->sc_bus, 0, 0, 0,
&sc->sc_port);
if (!err) {
@@ -239,18 +243,22 @@ USB_ATTACH(usb)
* until the USB event thread is running, which means that
* the keyboard will not work until after cold boot.
*/
- if (cold) {
- sc->sc_bus->use_polling++;
+#if defined(__FreeBSD__)
+ if (cold)
+#else
+ if (cold && (sc->sc_dev.dv_cfdata->cf_flags & 1))
+#endif
dev->hub->explore(sc->sc_bus->root_hub);
- sc->sc_bus->use_polling--;
- }
#endif
} else {
printf("%s: root hub problem, error=%d\n",
USBDEVNAME(sc->sc_dev), err);
sc->sc_dying = 1;
}
+ if (cold)
+ sc->sc_bus->use_polling--;
+ config_pending_incr();
#if defined(__NetBSD__) || defined(__OpenBSD__)
kthread_create(usb_create_event_thread, sc);
#endif
@@ -290,6 +298,7 @@ usb_event_thread(void *arg)
{
struct usb_softc *sc = arg;
int to;
+ int first = 1;
#ifdef __FreeBSD__
mtx_lock(&Giant);
@@ -302,6 +311,10 @@ usb_event_thread(void *arg)
if (usb_noexplore < 2)
#endif
usb_discover(sc);
+ if (first) {
+ config_pending_decr();
+ first = 0;
+ }
to = hz * 60;
#ifdef USB_DEBUG
if (usb_noexplore)
diff --git a/sys/dev/usb/usb_port.h b/sys/dev/usb/usb_port.h
index 21cb9868c465..3f7842250bc9 100644
--- a/sys/dev/usb/usb_port.h
+++ b/sys/dev/usb/usb_port.h
@@ -177,6 +177,9 @@ typedef struct proc *usb_proc_ptr;
#define kthread_create1 kthread_create
#define kthread_create kthread_create_deferred
+#define config_pending_incr()
+#define config_pending_decr()
+
#define usbpoll usbselect
#define uhidpoll uhidselect
#define ugenpoll ugenselect
@@ -303,6 +306,9 @@ typedef struct thread *usb_proc_ptr;
#define kthread_create1(f, s, p, a0, a1) \
kthread_create((f), (s), (p), RFHIGHPID, (a0), (a1))
+#define config_pending_incr()
+#define config_pending_decr()
+
#define usb_timeout(f, d, t, h) ((h) = timeout((f), (d), (t)))
#define usb_untimeout(f, d, h) untimeout((f), (d), (h))