USB standard request command

Source: Internet
Author: User

The standard USB device Request command is used in the data packet phase (data0, consisting of eight bytes) in the "Initial setup step" of the control transmission ). Common Request commands for standard USB devices

11, 8 bytes in size, with the same structure, consisting of five fields (the field is the data part of the standard request command), the structure is as follows (the number in the brackets indicates the number of bytes, first word

The mother BM, B, and W indicate bitmap, byte, and dual-byte respectively ):

Bmrequesttype (1) + brequest (1) + wvalue (2) + Windex (2) + wlength (2)

The meaning of each field is as follows:

1. bmrequesttype: d7d6d5d4d3d2d1d0

D7 = 0 host to Device
= 1 device to host;

D6d5 = 00 Standard Request command
= 01 request commands
= 10 user-defined commands
= 11 reserved value

D4d3d2d1d0 = 00000 the receiver is a device
= 00001 the recipient is a device
= 00010 the receiver is the endpoint
= 00011 the recipient is another receiver
= Other values are retained.

2. brequest: Request command code. In the standard USB command, each command defines a number, and the value of the number is the value of the field, the number and command name are as follows (note that the command code here should be used with other fields. It can be said that the command code is the core of the Standard Request command code, these command codes determine 11 USB standard request commands ):

1. Get the status get status (00 h)
A: [To device:
*. Bit 0: Self-powered (0 indicates bus power supply; 1 indicates self-powered ).
*. Bit 1: Remote Wake-up (0 indicates that Remote Wake-up is not supported; 1 indicates Remote Wake-up ).
*. 2-bit ~ 15: Reserved.
* Generally, the bus is used for power supply and remote wakeup is not supported. Therefore, the returned data is 0x0000.
B: [to interface:
*. All 16-bit bytes in the interface status are retained, so the returned data is 0x0000.
C: [to endpoint] obtain the endpoint status:
*. Bit 0: Halt (0 indicates that the endpoint is allowed; 1 indicates that the endpoint is disabled ).
*. Bit 1 ~ 15: Reserved (reset to 0 ).

2. Clear the clear feature (01 H)
A: [To device] clears the Remote Wake-up function of the device and returns an empty package.
B: [to endpoint] unban an endpoint.

3. Set feature set feature (03 h)
A: [To device] sets the device's remote Wakeup function and returns an empty package.
B: [to endpoint] disable the endpoint.

4. Set address (05 h)
A: set the device address.

5. Get the descriptor get Descriptor (06 h)
A: [To device] Get the device descriptor:
*. Description of the current USB Protocol version. The FIFO size of the device endpoint 0. the ID of the USB device.
B: [To configuration] Get the configuration descriptor:
* Describes the number of interfaces of the USB device and whether the interface is self-supplied.
C: [to interface] Get the interface descriptor:
* Describes the number of physical endpoints other than the number of physical endpoints.
D: [to endpoint] obtain the endpoint descriptor:
* Describes the transmission type of each endpoint of endpoint 0 and the transmission direction (in/out) of the maximum packet size and endpoint ).

6. Set the descriptor (optional, cannot be updated) set Descriptor (07 h)

7. Get configuration information get configuration (08 h)

8. Set Configuration (09 h)
A: [To configuration] sets the configuration descriptor.
B: [to interface] sets the interface descriptor.
C: [to endpoint] set the endpoint descriptor.

9. Get the interface information get interface (0ah)
10. Set interface (0bh)

11. synch_frame (0ch)
Used by devices to set and report synchronization frames of an endpoint.

Descriptor in the standard USB Request command
Descriptor is a complete data structure, which can be implemented by programming in C language and stored in a USB device. It is used to describe all attributes of a USB device, a usb host uses a series of commands to require devices to send this information. It uses the get descriptor command in the Q & A section to send information to the host, this allows the host to know what functions the device has, which type of devices it belongs to, how much bandwidth it will occupy, what transmission modes it uses, and the size of the data volume. After the host determines the information, the device can really get started, so the descriptor is also a very important part. There are 5 standard descriptors, and USB defines numbers for these descriptors:

1 -- device descriptor
2 -- configuration Descriptor
3 -- character Descriptor
4 -- interface Descriptor
5 -- endpoint Descriptor

There is a certain relationship between the descriptors above. A device has only one device descriptor, while a device descriptor can contain multiple configuration descriptors, and a configuration descriptor can contain multiple interface descriptors, when an interface uses several endpoints, there are several endpoints descriptor. This descriptor is composed of certain fields.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.