Changes in uspace/lib/usb/src/request.c [37b4794e:ad4562c2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/request.c
r37b4794e rad4562c2 36 36 #include <errno.h> 37 37 #include <assert.h> 38 #include <usb/debug.h> 38 39 39 40 #define MAX_DATA_LENGTH ((size_t)(0xFFFF)) … … 209 210 */ 210 211 int usb_request_get_descriptor(usb_endpoint_pipe_t *pipe, 211 usb_request_type_t request_type, 212 usb_request_type_t request_type, usb_request_recipient_t recipient, 212 213 uint8_t descriptor_type, uint8_t descriptor_index, 213 214 uint16_t language, … … 224 225 225 226 return usb_control_request_get(pipe, 226 request_type, USB_REQUEST_RECIPIENT_DEVICE,227 request_type, recipient, 227 228 USB_DEVREQ_GET_DESCRIPTOR, 228 229 wValue, language, … … 242 243 */ 243 244 int usb_request_get_descriptor_alloc(usb_endpoint_pipe_t * pipe, 244 usb_request_type_t request_type, 245 usb_request_type_t request_type, usb_request_recipient_t recipient, 245 246 uint8_t descriptor_type, uint8_t descriptor_index, 246 247 uint16_t language, … … 258 259 uint8_t tmp_buffer[1]; 259 260 size_t bytes_transfered; 260 rc = usb_request_get_descriptor(pipe, request_type, 261 rc = usb_request_get_descriptor(pipe, request_type, recipient, 261 262 descriptor_type, descriptor_index, language, 262 263 &tmp_buffer, 1, &bytes_transfered); … … 283 284 } 284 285 285 rc = usb_request_get_descriptor(pipe, request_type, 286 rc = usb_request_get_descriptor(pipe, request_type, recipient, 286 287 descriptor_type, descriptor_index, language, 287 288 buffer, size, &bytes_transfered); … … 320 321 usb_standard_device_descriptor_t descriptor_tmp; 321 322 int rc = usb_request_get_descriptor(pipe, 322 USB_REQUEST_TYPE_STANDARD, USB_ DESCTYPE_DEVICE,323 0, 0,323 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 324 USB_DESCTYPE_DEVICE, 0, 0, 324 325 &descriptor_tmp, sizeof(descriptor_tmp), 325 326 &actually_transferred); … … 366 367 usb_standard_configuration_descriptor_t descriptor_tmp; 367 368 int rc = usb_request_get_descriptor(pipe, 368 USB_REQUEST_TYPE_STANDARD, USB_ DESCTYPE_CONFIGURATION,369 index, 0,369 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 370 USB_DESCTYPE_CONFIGURATION, index, 0, 370 371 &descriptor_tmp, sizeof(descriptor_tmp), 371 372 &actually_transferred); … … 406 407 407 408 return usb_request_get_descriptor(pipe, 408 USB_REQUEST_TYPE_STANDARD, USB_ DESCTYPE_CONFIGURATION,409 index, 0,409 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 410 USB_DESCTYPE_CONFIGURATION, index, 0, 410 411 descriptor, descriptor_size, actual_size); 411 412 } … … 452 453 size_t string_descriptor_size = 0; 453 454 rc = usb_request_get_descriptor_alloc(pipe, 454 USB_REQUEST_TYPE_STANDARD, USB_DESCTYPE_STRING, 0, 0, 455 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 456 USB_DESCTYPE_STRING, 0, 0, 455 457 (void **) &string_descriptor, &string_descriptor_size); 456 458 if (rc != EOK) { … … 502 504 * 503 505 * @param[in] pipe Control endpoint pipe (session must be already started). 504 * @param[in] index String index (in native endianess), 505 * first index has number 1 (index from descriptors can be used directly). 506 * @param[in] index String index (in native endianess). 506 507 * @param[in] lang String language (in native endianess). 507 508 * @param[out] string_ptr Where to store allocated string in native encoding. … … 514 515 return EBADMEM; 515 516 } 516 /* 517 * Index is actually one byte value and zero index is used 518 * to retrieve list of supported languages. 519 */ 520 if ((index < 1) || (index > 0xFF)) { 517 /* Index is actually one byte value. */ 518 if (index > 0xFF) { 521 519 return ERANGE; 522 520 } … … 535 533 size_t string_size; 536 534 rc = usb_request_get_descriptor_alloc(pipe, 537 USB_REQUEST_TYPE_STANDARD, USB_ DESCTYPE_STRING,538 index, uint16_host2usb(lang),535 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 536 USB_DESCTYPE_STRING, index, uint16_host2usb(lang), 539 537 (void **) &string, &string_size); 540 538 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.