if USB support is not compiled into the kernel,

and has not been loaded via a kldload,
	running usbd(8) will autoload the "usb.ko" kld.

	thanks to Peter Wemm for enlightening me on the
	differences between kldfind(2) and modfind(2).
This commit is contained in:
Jonathan M. Bresler 2000-04-02 06:28:40 +00:00
parent f018cfad89
commit 0fe00f48d0
2 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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':