First steps for USB client driver development
This section introduces USB driver development concepts and tools. The section applies to developers new to driver development that wish to implement a driver for a USB device that Microsoft does not provide an in-box driver for. These drivers are called a USB client driver in this documentation. The topics in this section describe high-level USB concepts and provide step-by-step instructions about performing common tasks of a USB client driver. For detailed information about those concepts see USB specifications at USB Documents.
Driver developers must have coding experience in the C++ programming language and understand the concepts of function pointers, callback functions, and event handlers. If writing a driver based on the User-Mode Driver Framework the developer must be familiar with C++ and COM.
Learning path for USB client driver developers
Read the USB Specification 3.2.
- Learn about the industry specification and different components (device, host controller, and hub) of the architecture. It's important to understand the data flow model, how the host and device communicate with each other, and the format of the requests that the device expects.
Obtain a test USB device.
Have a USB device and its hardware specification. The specification describes device capabilities and the supported vendor commands. Use the specification to determine the functionality of the device driver and the related design decisions.
Have the OSR USB FX2 learning kit if new to USB driver development. The kit is the most suitable to study USB samples included in this documentation set.
Have a Microsoft USB Test Tool (MUTT) devices. MUTT hardware can be purchased from JJG Technologies. The device does not have installed firmware installed. To install firmware, download the MUTT software package. For more information, see the documentation included with the package.
Study the USB device layout and the related USB descriptors.
- Describe your device capabilities by reading the configuration descriptor, interface descriptors for each supported alternate settings, and their endpoint descriptors. By using USBView, the developer can browse all USB controllers and the USB devices connected to them and also inspect the device configuration.
Choose a driver model for developing a USB client driver
- Determine if the driver should be a custom driver or use one of the Microsoft-provided drivers based on the design of the target device. Choose the best driver model and describe the features supported by each model.
Review the Microsoft-provided USB driver stack and driver development concepts.
- USB host-side drivers in Windows.
- Concepts for All Driver Developers.
- Concepts for all USB developers.
- Device nodes and device stacks.
- Developing Drivers with Windows Driver Foundation written by Penny Orwick and Guy Smith. For more information see Developing Drivers with WDF.
- USB driver samples.
- Understand the fundamentals of how drivers work in Windows operating systems. Knowing the fundamentals will help make appropriate design decisions and streamline the development process.
- Differentiate between user mode and kernel mode driver architecture models.
- Understand driver loading and how Windows organizes Plug and Play (PnP) devices in a device tree and device nodes. The developer should also understand how PnP manager builds device stacks and where the driver and its device objects are placed in the device stack.
Prepare the development and debugging environment.
- Install the latest Windows Driver Kit (WDK).
- Install Microsoft Visual Studio.
- Get Set Up for Debugging.
- Make sure the Headers and libraries required by a USB client driver are available.
- If writing a kernel-mode driver debugging on host and target computers over an Ethernet network, 1394 cable, USB 2.0 or 3.0 debug cable, or a null-modem cable must be configured.
- If writing a user-mode driver, user-mode debuggers available in the Microsoft Visual Studio environment. The developer should be familiar with how to attach to a process or launch a process under the debugger.
Write your first driver.
- How to write your first USB client driver (KMDF).
- How to write your first USB client driver (UMDF).
- Write, build, and install your first USB client driver by using the USB templates included with Visual Studio 2012. The developer should be able to describe framework driver, device, and queue objects and understand how the framework communicates with your driver.
Extend your driver by sending a USB control transfer request.
- Send standard control requests and vendor commands to your device. For more information, see How to send a USB control transfer.
Extend your driver to use WDF USB I/O target objects to perform USB data transfers.
- Extend your driver to perform common tasks as outlined in Common tasks for USB client drivers.
Community Resources for USB
Microsoft Windows USB Core Team Blog
Check out posts written by the Microsoft USB Team. The blog focuses on the Windows USB driver stack that works with various USB Host controllers and USB hubs found in Windows PC. A useful resource for USB client driver developers and USB hardware designers understand the driver stack implementation, resolve common issues, and explain how to use tools for gathering traces and log files.
-
Discussion list managed by OSR Online for kernel-mode driver developers.
Windows Dev-Center for Hardware Development
Windows Driver Kit, ensure that your product is reliable and compatible with Windows through the Windows Hardware Lab Kit, learn Windows driver samples.