Changeset 58563585 in mainline for uspace/lib/usbdev/src/request.c
- Timestamp:
- 2016-08-31T11:15:39Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 10cb47e
- Parents:
- 7a67416
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/request.c
r7a67416 r58563585 50 50 * @see usb_pipe_control_write 51 51 * 52 * @param pipe Pipe used for the communication.52 * @param pipe Pipe used for the communication. 53 53 * @param request_type Request type (standard/class/vendor). 54 * @param recipient Request recipient (e.g. device or endpoint). 55 * @param request Actual request (e.g. GET_DESCRIPTOR). 56 * @param value Value of @c wValue field of setup packet 57 * (must be in USB endianness). 58 * @param index Value of @c wIndex field of setup packet 59 * (must be in USB endianness). 60 * @param data Data to be sent during DATA stage 61 * (expected to be in USB endianness). 62 * @param data_size Size of the @p data buffer (in native endianness). 54 * @param recipient Request recipient (e.g. device or endpoint). 55 * @param request Actual request (e.g. GET_DESCRIPTOR). 56 * @param value Value of @c wValue field of setup packet 57 * (must be in USB endianness). 58 * @param index Value of @c wIndex field of setup packet 59 * (must be in USB endianness). 60 * @param data Data to be sent during DATA stage 61 * (expected to be in USB endianness). 62 * @param data_size Size of the @p data buffer (in native endianness). 63 * 63 64 * @return Error code. 64 65 * @retval EBADMEM @p pipe is NULL. 65 66 * @retval EBADMEM @p data is NULL and @p data_size is not zero. 66 67 * @retval ERANGE Data buffer too large. 68 * 67 69 */ 68 70 int usb_control_request_set(usb_pipe_t *pipe, … … 100 102 } 101 103 102 /** Generic wrapper for GET requests using standard control request format. 103 * 104 * @see usb_pipe_control_read 105 * 106 * @param pipe Pipe used for the communication. 107 * @param request_type Request type (standard/class/vendor). 108 * @param recipient Request recipient (e.g. device or endpoint). 109 * @param request Actual request (e.g. GET_DESCRIPTOR). 110 * @param value Value of @c wValue field of setup packet 111 * (must be in USB endianness). 112 * @param index Value of @c wIndex field of setup packet 113 * (must be in USB endianness). 114 * @param data Buffer where to store data accepted during the DATA stage. 115 * (they will come in USB endianness). 116 * @param data_size Size of the @p data buffer 117 * (in native endianness). 118 * @param actual_data_size Actual size of transfered data 119 * (in native endianness). 120 * @return Error code. 121 * @retval EBADMEM @p pipe is NULL. 122 * @retval EBADMEM @p data is NULL and @p data_size is not zero. 123 * @retval ERANGE Data buffer too large. 124 */ 104 /** Generic wrapper for GET requests using standard control request format. 105 * 106 * @see usb_pipe_control_read 107 * 108 * @param pipe Pipe used for the communication. 109 * @param request_type Request type (standard/class/vendor). 110 * @param recipient Request recipient (e.g. device or endpoint). 111 * @param request Actual request (e.g. GET_DESCRIPTOR). 112 * @param value Value of @c wValue field of setup packet 113 * (must be in USB endianness). 114 * @param index Value of @c wIndex field of setup packet 115 * (must be in USB endianness). 116 * @param data Buffer where to store data accepted during 117 * the DATA stage (they will come in USB endianness). 118 * @param data_size Size of the @p data buffer 119 * (in native endianness). 120 * @param actual_data_size Actual size of transfered data 121 * (in native endianness). 122 * 123 * @return Error code. 124 * @retval EBADMEM @p pipe is NULL. 125 * @retval EBADMEM @p data is NULL and @p data_size is not zero. 126 * @retval ERANGE Data buffer too large. 127 * 128 */ 125 129 int usb_control_request_get(usb_pipe_t *pipe, 126 130 usb_request_type_t request_type, usb_request_recipient_t recipient, … … 209 213 { 210 214 if (request_type == USB_REQUEST_TYPE_STANDARD) { 211 if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) 212 { 215 if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) { 213 216 return EINVAL; 214 217 } … … 234 237 { 235 238 if (request_type == USB_REQUEST_TYPE_STANDARD) { 236 if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) 237 { 239 if ((recipient == USB_REQUEST_RECIPIENT_DEVICE) && (index != 0)) { 238 240 return EINVAL; 239 241 } … … 271 273 } 272 274 273 /* The wValue field specifies the descriptor type in the high byte 275 /* 276 * The wValue field specifies the descriptor type in the high byte 274 277 * and the descriptor index in the low byte. USB 1.1 spec p. 189 275 278 */
Note:
See TracChangeset
for help on using the changeset viewer.