Changeset da68871a in mainline for uspace/lib/usbdev/src/request.c
- Timestamp:
- 2012-08-08T08:46:22Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 30c0826
- Parents:
- bc216a0 (diff), 1d01cca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/request.c
rbc216a0 rda68871a 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 = value,150 .index = index,151 .length = (uint16_t) data_size,149 .value = uint16_host2usb(value), 150 .index = uint16_host2usb(index), 151 .length = uint16_host2usb(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 438 437 return EOK; 439 438 } … … 495 494 return ENOENT; 496 495 } 497 if (bare_config.total_length < sizeof(bare_config)) { 496 497 const size_t total_length = uint16_usb2host(bare_config.total_length); 498 if (total_length < sizeof(bare_config)) { 498 499 return ELIMIT; 499 500 } 500 501 501 void *buffer = malloc( bare_config.total_length);502 void *buffer = malloc(total_length); 502 503 if (buffer == NULL) { 503 504 return ENOMEM; … … 506 507 size_t transferred = 0; 507 508 rc = usb_request_get_full_configuration_descriptor(pipe, index, 508 buffer, bare_config.total_length, &transferred);509 buffer, total_length, &transferred); 509 510 if (rc != EOK) { 510 511 free(buffer); … … 512 513 } 513 514 514 if (transferred != bare_config.total_length) {515 if (transferred != total_length) { 515 516 free(buffer); 516 517 return ELIMIT; … … 522 523 523 524 if (descriptor_size != NULL) { 524 *descriptor_size = bare_config.total_length;525 *descriptor_size = total_length; 525 526 } 526 527
Note:
See TracChangeset
for help on using the changeset viewer.