tailieunhanh - USB Complete fourth- P17

USB Complete fourth- P17:This book focuses on Windows programming for PCs, but other computers and operating systems also have USB support, including Linux and Apple Computer’s Macintosh. Some real-time kernels also support USB. | Chapter 5 Other Requests In addition to the requests defined in the USB and USB specifications a device may respond to class-specific and vendor-specific control requests. Class-Specific Requests A class can define mandatory and optional requests. Class drivers on the host should support the mandatory requests and may support optional requests. Some requests are unrelated to the standard requests while others build on standard requests by defining class-specific fields. An example of a request that s unrelated to standard requests is the Get_Max_LUN request supported by some mass-storage devices. The host uses this request to find out the number of logical units the interface supports. An example of a request that builds on an existing request is the Get Port Status request for hubs. This request is structured like the standard Get Status request but bits 00011 indicate that the request applies to a unit other than the device an interface or an endpoint. The request applies to a port on a hub. The wIndex field contains the port number. Vendor-Defined Requests Implementing a vendor-defined request in a control transfer requires all of the following Vendor-defined fields as needed in the Setup and Data stages of the request. Bits in the Setup stage s data packet are set to 10 to indicate a vendor-defined request. In the device code that detects the request number in the Setup packet and knows how to respond. In the host a vendor-specific device driver that supports the request. The driver can expose a function that enables applications to initiate the request. 136 6 Chip Choices This chapter is a guide to selecting a device controller. The chips covered include USB controllers with basic USB support as well as more full-featured high-end chips. Chapter 20 discusses controllers for use in USB On-The-Go devices. For information on USB controllers as they become available visit www. Lvr. com Components of a USB Device Every USB device must have .