Chapter 5 126 )GV5VCVWU Purpose: The host requests the status of the features of a device, interface, or endpoint. Request Number (bRequest): 00h Source of Data: device Data Length (wLength): 0002h Contents of wValue field: 0000h Contents of wIndex field: For a device, 0000h. For an interface, the interface number. For an endpoint, the endpoint number. Contents of data packet in the Data stage: the device, interface, or endpoint status. Supported states: Default: undefined. Address: OK for address zero, endpoint zero. Otherwise the device returns STALL. Configured: OK. Behavior on error: The device returns STALL if the target interface or endpoint doesn’t exist. Comments: For requests directed to devices operating at USB 2.0 speeds, two status bits are defined. Bit zero is the Self-Powered field: 0 = bus-powered, 1 = self-powered. The host can’t change this value. Bit 1 is the Remote Wakeup field. The default on reset is zero (disabled). SuperSpeed devices support the Self-Powered bit and use bits 2–4 for power-management options. Bit 2 = 1 means the device is enabled to initiate U1 entry. Bit 3 = 1 means the device is enabled to initiate U2 entry. Bit 4 = 1 means the device is enabled to send Latency Tolerance Messages. For request directed to the first interface in a function on a USB 3.0 bus, bit 0 = 1 if the function supports remote wakeup, and bit 1 = 1 if the host has enabled the func- tion for remote wakeup. For requests directed to an interface on a USB 2.0 bus, all bits are reserved. For requests directed to an endpoint, only bit zero is defined. Bit 0 = 1 indicates a Halt condition. See Set Feature and Clear Feature for more about Remote Wakeup and Halt. All non-assigned bits are reserved. Control Transfers: Structured Requests for Critical Data 127 %NGCT(GCVWTG Purpose: The host requests to disable a feature on a device, interface, or endpoint. Request Number (bRequest): 01h. Source of Data: no Data stage Data Length (wLength): 0000h Contents of wValue field: the feature to disable Contents of wIndex field: For a device feature, 0000h. For an interface feature, the interface number. For an endpoint feature, the endpoint number. Supported states: Default: undefined. Address: OK for address zero, endpoint zero. Otherwise the device returns a STALL. Configured: OK. Behavior on error: If the feature, device, or endpoint specified doesn’t exist, or if the feature can’t be cleared, the device responds with STALL. Behavior is undefined if wLength > 0000h. Comments: For USB 2.0, this request can clear the DEVICE_REMOTE_WAKEUP and ENDPOINT_HALT features. The request does not clear the TEST_MODE fea- ture. For SuperSpeed, this request can clear the ENDPOINT_HALT, LTM_ENABLE, U1_ENABLE, and U2_ENABLE features. (To clear the FUNCTION_SUSPEND feature, see Set Feature.) Clear Feature(ENDPOINT_HALT) resets a bulk, interrupt, or isochronous data tog- gle to DATA0 (USB 2.0) or Sequence Number to zero (SuperSpeed) and resets a SuperSpeed bulk endpoint’s burst size. Hubs support additional features. See also Set Feature and Get Status. Chapter 5 128 5GV(GCVWTG Purpose: The host requests to enable a feature on a device, interface, or endpoint. Request Number (bRequest): 03h Source of Data: no Data stage Data Length (wLength): 0000h Contents of wValue field: the feature to enable Contents of wIndex field: The low byte equals 00h for a device, the interface number for an interface, or the endpoint number for an endpoint. For a USB 3.0 FUNCTION_SUSPEND request, the high byte can request the Suspend state (bit 0 = 1) or normal operation (bit 0 = 1) and remote wakeup enabled (bit 1 = 1) or disabled (bit 1 = 0). Supported states: For features other than TEST_MODE: Default: undefined. Address: OK for address zero, endpoint zero. Otherwise the device returns STALL. Configured: OK. High speed must support the TEST_MODE feature in the Default, Address, and Configured states. Behavior on error: If the endpoint or interface specified doesn’t exist, the device responds with STALL. Comments: USB 2.0 defines these features: ENDPOINT_HALT (0000h) applies to endpoints. Bulk and interrupt endpoints must support the Halt condition. Events that cause a Halt condition are transmission errors and the device’s receiving a Set Feature request to halt the endpoint. DEVICE_REMOTE_WAKEUP (0001h) applies to devices. When the host has set this feature, a device in the Suspend state can request the host to resume communica- tions. TEST_MODE (0002h) applies to devices. Setting this feature causes an upstream-facing port to enter a test mode. Chapter 18 has more about test mode. SuperSpeed supports ENDPOINT_HALT and these features: FUNCTION_SUSPEND (00h) applies to interfaces and can place a function in the Suspend state and enable or disable remote wakeup. U1_ENABLE (30h) and U2_ENABLE (31h) apply to devices and enable the U1 and U2 low-power states. LTM_ENABLE (32h) applies to devices and enables sending Latency Tolerance Mes- sages, where a device provides information the host can use in power management. Chapter 16 has more about power management. Hubs support additional features.The Get Status request tells the host what features, if any, are enabled. Also see Clear Feature. Control Transfers: Structured Requests for Critical Data 129 5GV#FFTGUU Purpose: The host specifies an address to use in future communications with the device. Request Number (bRequest): 05h Source of Data: no Data stage Data Length (wLength): 0000h Contents of wValue field: new device address. Allowed values are 0001h–007Fh. Each device on the bus, including the root hub, has a unique address. Contents of wIndex field: 0000h Supported States: Default, Address. Behavior on error: not specified. Comments: When a hub enables a port after power-up or attachment, the port uses the default address of 0000h until completing a Set Address request from the host. This request is unlike most other requests because the device doesn’t carry out the request until the device has completed the Status stage of the request by sending a ZLP. The host sends the Status stage’s token packet to the default address, so the device must detect and respond to this packet before changing its address. After completing this request, all communications use the new address. A device using the default address of 0000h is in the Default state. After completing a Set_ Address request to set an address other than 0000h, the device enters the Address state. A device must send the handshake packet within 50 ms after receiving the request and must implement the request within 2 ms after completing the Status stage. Chapter 5 130 )GV&GUETKRVQT Purpose: The host requests a specific descriptor. Request Number (bRequest): 06h Source of Data: device Data Length (wLength): the number of bytes to return. If the descriptor is longer than wLength, the device returns up to wLength bytes. If the descriptor is shorter than wLength, the device returns the entire descriptor. If the descriptor is shorter than wLength and is an even multiple of the endpoint’s maximum packet size, the device returns a ZLP in response to a request for more data after the device has sent the descriptor. The host detects the end of the data on receiving either the requested amount of data or a data packet containing less than the maximum packet size (includ- ing a ZLP). Contents of wValue field: High byte: descriptor type. Low byte: descriptor index, to specify which descriptor to return when there are multiple descriptors of the same type. Contents of wIndex field: for String descriptors, Language ID. Otherwise 0000h. Contents of data packet in the Data stage: the requested descriptor. Supported states: Default, Address, Configured. Behavior on error: A device that doesn’t support the specified descriptor should return STALL. Comments: Hosts can request the following standard descriptor types: device, device_qualifier, configuration, other_speed configuration, BOS, and string. On receiving a request for a configuration or other_speed configuration descriptor, the device should return the requested descriptor followed by all of its subordinate inter- face, endpoint, endpoint companion, and class- and vendor-specific descriptors, up to the number of bytes requested. A class or vendor can define additional descriptors that the host can request, such as the HID-class report descriptor. See also Set Descriptor. Control Transfers: Structured Requests for Critical Data 131 5GV&GUETKRVQT Purpose: The host adds a descriptor or updates an existing descriptor. Request Number (bRequest): 07h Source of Data: host Data Length (wLength): The number of bytes the host will transfer to the device. Contents of wValue field: high byte: descriptor type. (See Get Descriptor). Low byte: a descriptor index that specifies which descriptor the device is sending when it has multiple descriptors of the same type. Contents of wIndex field: For string descriptors, Language ID. Otherwise 0000h. Contents of data packet in the Data stage: descriptor length. Supported states: Address and Configured. Behavior on error: A device that doesn’t support the request or the specified descrip- tor should return STALL. Comments: This request makes it possible for the host to add new descriptors or change an existing descriptor. Few devices support this request, which could enable errant code to place incorrect information in a descriptor. See also Get Descriptor. Chapter 5 132 )GV%QPHKIWTCVKQP Purpose: The host requests the value of the current device configuration. Request Number (bRequest): 08h Source of Data: device Data Length (wLength): 0001h Contents of wValue field: 0000h Contents of wIndex field: 0000h Contents of data packet in the Data stage: Configuration value Supported states: Address (returns zero), Configured Behavior on error: not specified. Comments: A device that isn’t configured returns 00h in the Data stage. See also Set Configuration. 5GV%QPHKIWTCVKQP Purpose: The host requests the device to use the specified configuration. Request Number (bRequest): 09h Source of Data: no Data stage Data Length (wLength): 0000h Contents of wValue field: The low byte specifies a configuration. If the value matches a configuration supported by the device, the device implements the requested configu- ration. A value of 00h indicates not configured, and the device should enter the Address state and wait for a new Set Configuration request to be configured. Contents of wIndex field: 0000h Supported states: Address, Configured. Behavior on error: If wValue isn’t equal to 0000h or a configuration supported by the device, the device returns STALL. Comments: After completing a Set Configuration request specifying a supported con- figuration, the device enters the Configured state. Many standard requests require the device to be in the Configured state. See also Get Configuration. This request resets bulk, interrupt, and isochronous data toggles to DATA0 (USB 2.0) or Sequence Num- bers to zero (SuperSpeed) and resets the burst size of SuperSpeed bulk endpoints. Control Transfers: Structured Requests for Critical Data 133 )GV+PVGTHCEG Purpose: For interfaces that have alternate, mutually exclusive settings, the host requests the currently active interface setting. Request Number (bRequest): 0Ah Source of Data: device Data Length (wLength): 0001h Contents of wValue field: 0000h Contents of wIndex field: interface number (bInterfaceNumber) Contents of data packet in the Data stage: the current setting (bAlternateSetting) Supported states: Configured Behavior on error: If the interface doesn’t exist, the device returns STALL. Comments: The wIndex value refers to the bInterfaceNumber value of an interface descriptor and indicates which interface the request applies to. In the Data stage, the device returns a bAlternateSetting value, which identifies which alternate interface set- ting the device is currently using. Each alternate interface has an interface descriptor and subordinate descriptors as needed. Many interfaces support only one interface set- ting. See also Set Interface. 5GV+PVGTHCEG Purpose: For interfaces that have alternate, mutually exclusive, settings, the host requests the device to use a specific interface setting. Request Number (bRequest): 0Bh Source of Data: no Data stage Data Length (wLength): 0000h Contents of wValue field: alternate setting to select (bAlternateSetting) Contents of wIndex field: interface number (bInterfaceNumber) Supported states: Configured Behavior on error: If the requested interface or setting doesn’t exist, the device returns STALL. Comments: This request resets bulk, interrupt, and isochronous data toggles to DATA0 (USB 2.0) or Sequence Numbers to zero (SuperSpeed) and resets the burst size of SuperSpeed bulk endpoints. See also Get Interface. Chapter 5 134 5[PEJ(TCOG Purpose: The device sets and reports an endpoint’s synchronization frame. Request Number (bRequest): 0Ch Source of Data: host Data Length (wLength): 0002h Contents of wValue field: 0000h Contents of wIndex field: endpoint number Contents of data packet in the Data stage: frame number Supported states: Default: undefined. Address: The device returns STALL. Config- ured: OK. Behavior on error: An endpoint that doesn’t support the request should return STALL. Comments: In isochronous transfers, a device endpoint may request data packets that vary in size according to a sequence. For example, an endpoint may send a repeating sequence of 8, 8, 8, 64 bytes. The Synch Frame request enables the host and endpoint to agree on which frame will begin the sequence. On receiving a Synch Frame request, an endpoint returns the number of the frame that will precede the beginning of a new sequence This request is rarely used because there is rarely a need for the information it provides. Control Transfers: Structured Requests for Critical Data 135 5GV5'. Purpose: For SuperSpeed devices, sets system exit latencies for power management. Request Number (bRequest): 31h Source of Data: host Data Length (wLength): 0006h Contents of wValue field: 0000h Contents of wIndex field: 0000h Contents of data packet in the Data stage: exit latency values. Supported states: Address, Configured. Behavior on error: A device that doesn’t support the request should return STALL. Comments: Chapter 16 has more on SuperSpeed power management. 5GV+UQEJTQPQWU&GNC[ Purpose: For SuperSpeed devices, specifies the amount of time between when a host transmits an isochronous packet and when a device will receive the packet. Request Number (bRequest): 30h Source of Data: host Data Length (wLength): 0000h Contents of wValue field: Delay in ns. Contents of wIndex field: 0000h. Supported states: Default, Address, Configured. Behavior on error: a device that doesn’t support the request should return STALL. Comments: the wValue field can range from 0000h to FFFFh. . function on a USB 3.0 bus, bit 0 = 1 if the function supports remote wakeup, and bit 1 = 1 if the host has enabled the func- tion for remote wakeup. For requests directed to an interface on a USB 2.0. target interface or endpoint doesn’t exist. Comments: For requests directed to devices operating at USB 2.0 speeds, two status bits are defined. Bit zero is the Self-Powered field: 0 = bus-powered,. cleared, the device responds with STALL. Behavior is undefined if wLength > 0000h. Comments: For USB 2.0, this request can clear the DEVICE_REMOTE_WAKEUP and ENDPOINT_HALT features. The request