April 2012
Intermediate to advanced
352 pages
8h
English
Now that you’re familiar with the usb_* structures and their management routines, let’s dissect a real-world USB driver.
Example 15-1 provides a terse, source-level overview of ulpt(4), the USB printer driver.
To improve readability, some of the variables and functions presented in this section have been renamed and restructured from their counterparts in the FreeBSD source.
Example 15-1. ulpt.c
#include <sys/param.h> #include <sys/module.h> #include <sys/kernel.h> #include <sys/systm.h> #include <sys/conf.h> #include <sys/bus.h> #include <sys/lock.h> #include <sys/mutex.h> #include <sys/syslog.h> #include <sys/fcntl.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> #include <dev/usb/usbdi_util.h> #define ULPT_BUF_SIZE ...