summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/usb/usb.h4
-rw-r--r--usr.sbin/usbd/usbd.c8
2 files changed, 12 insertions, 0 deletions
diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h
index 7c48ed28..40f5d55 100644
--- a/sys/dev/usb/usb.h
+++ b/sys/dev/usb/usb.h
@@ -64,6 +64,10 @@ MALLOC_DECLARE(M_USBHC);
#endif /* _KERNEL */
#endif /* __FreeBSD__ */
+/* these three defines are used by usbd to autoload the usb kld */
+#define USB_KLD "usb"
+#define USB_OHCI "ohci/usb"
+#define USB_UHCI "uhci/usb"
#define USB_MAX_DEVICES 128
#define USB_START_ADDR 0
diff --git a/usr.sbin/usbd/usbd.c b/usr.sbin/usbd/usbd.c
index 09190c9..b866eca 100644
--- a/usr.sbin/usbd/usbd.c
+++ b/usr.sbin/usbd/usbd.c
@@ -896,6 +896,14 @@ main(int argc, char **argv)
int itimeout = TIMEOUT; /* timeout for select */
struct timeval tv;
+ if (modfind(USB_OHCI) < 0 && modfind(USB_UHCI) < 0) {
+ if (kldload(USB_KLD) < 0 ||
+ (modfind(USB_OHCI) < 0 && modfind(USB_UHCI) < 0)) {
+ perror(USB_KLD ": Kernel module not available");
+ return 1;
+ }
+ }
+
while ((ch = getopt(argc, argv, "c:def:nt:v")) != -1) {
switch(ch) {
case 'c':
OpenPOWER on IntegriCloud