## The FEATURE Sample

The FEATURE Sample accompanies Chapter 12 and illustrates how to set and clear device features.

The sample includes three components:

- FEATURE.SYS (SYS subdirectory) is a WDM driver for a USB device based on the Anchor Chips development board.
- TEST.EXE (TEST subdirectory) is a Win32 console application for testing FEATURE.SYS.
- FEATURE.HEX (EZUSB subdirectory) is the firmware image for the FEATURE device.

### Building FEATURE

To build FEATURE.SYS, follow the general instructions for building a WDM sample. The Microsoft Visual C++ project file is named FEATURE.DSP in the SYS subdirectory.

To build TEST.EXE, follow the general instructions for building user-mode programs. The Microsoft Visual C++ project file is named TEST.DSP in the TEST subdirectory.

### Testing FEATURE

First follow the general instructions for testing USB samples to install the device firmware (FEATURE.HEX in the EZUSB subdirectory) and the driver. Then open a command prompt and run TEST.EXE from the TEST\DEBUG subdirectory a few times. Each time TEST runs, the LED display on the development board will display a digit for about five seconds. The digit will increase each time you run TEST.

### Special note about power management

This driver doesn't automatically repower the device when the computer comes out of standby. I recommend not putting the computer through a power cycle with this device connected. A more realistic driver would establish some sort of policy about when the device should be powered and would use techinques like shown in the WAKEUP sample to enforce that policy.

### What to look for

The various IOCTL handlers in control.cpp illustrate how to create URBs to perform the tasks this sample illustrates.