Responsibilities of the USB Client Device Driver

The USB client driver or the USB class-specific driver is loaded when the operating system first detects the corresponding class-specific device. It remains loaded until the last device of the corresponding class is removed from the system.

Upon loading, the client driver adds its functions to the kernel device switch table. This step provides the rest of the operating system with the file-oriented software interface to a current USB device class. It registers with the USB system driver (USBD) to determine whether the device is attached and configured. The client driver provides a callback to the USB system driver for attach and disconnect events. Upon detach, the device driver must stop pending IO and return an error to the IO requester. On attachment, the driver must be able to make the device ready to use.

During the operation, the client or class device driver recognizes the file-oriented requests by operating system on a current device and converts them into class-specific requests that the device understands. It uses the uniform call vector interface (USBDI) provided by the USBD to pass these class-specific requests to the device. It is responsible for timing the outstanding requests and performing an error recovery. The error recovery techniques include trying the failed requests again, gathering the sense data, stopping the outstanding requests and resetting the device and the associated pipes.