Changes in uspace/lib/usbdev/src/request.c [12e689f:095bddfc] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/request.c
r12e689f r095bddfc 114 114 * (in native endianness). 115 115 * @param actual_data_size Actual size of transfered data 116 * 116 * (in native endianness). 117 117 * @return Error code. 118 118 * @retval EBADMEM @p pipe is NULL. … … 147 147 | (request_type << 5) | recipient, 148 148 .request = request, 149 .value = uint16_host2usb(value),150 .index = uint16_host2usb(index),151 .length = uint16_host2usb(data_size),149 .value = value, 150 .index = index, 151 .length = (uint16_t) data_size, 152 152 }; 153 153 … … 375 375 usb_standard_device_descriptor_t descriptor_tmp; 376 376 int rc = usb_request_get_descriptor(pipe, 377 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 377 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 378 378 USB_DESCTYPE_DEVICE, 0, 0, 379 379 &descriptor_tmp, sizeof(descriptor_tmp), … … 435 435 /* Everything is okay, copy the descriptor. */ 436 436 memcpy(descriptor, &descriptor_tmp, sizeof(descriptor_tmp)); 437 437 438 return EOK; 438 439 } … … 494 495 return ENOENT; 495 496 } 496 497 const size_t total_length = uint16_usb2host(bare_config.total_length); 498 if (total_length < sizeof(bare_config)) { 497 if (bare_config.total_length < sizeof(bare_config)) { 499 498 return ELIMIT; 500 499 } 501 500 502 void *buffer = malloc( total_length);501 void *buffer = malloc(bare_config.total_length); 503 502 if (buffer == NULL) { 504 503 return ENOMEM; … … 507 506 size_t transferred = 0; 508 507 rc = usb_request_get_full_configuration_descriptor(pipe, index, 509 buffer, total_length, &transferred);508 buffer, bare_config.total_length, &transferred); 510 509 if (rc != EOK) { 511 510 free(buffer); … … 513 512 } 514 513 515 if (transferred != total_length) {514 if (transferred != bare_config.total_length) { 516 515 free(buffer); 517 516 return ELIMIT; … … 523 522 524 523 if (descriptor_size != NULL) { 525 *descriptor_size = total_length;524 *descriptor_size = bare_config.total_length; 526 525 } 527 526
Note:
See TracChangeset
for help on using the changeset viewer.