Changes in uspace/lib/usbdev/src/request.c [9d58539:1cf26ab] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/request.c
r9d58539 r1cf26ab 39 39 40 40 #define MAX_DATA_LENGTH ((size_t)(0xFFFF)) 41 42 static_assert(sizeof(usb_device_request_setup_packet_t) == 8); 41 43 42 44 /** Generic wrapper for SET requests using standard control request format. … … 114 116 * (in native endianness). 115 117 * @param actual_data_size Actual size of transfered data 116 * 118 * (in native endianness). 117 119 * @return Error code. 118 120 * @retval EBADMEM @p pipe is NULL. … … 147 149 | (request_type << 5) | recipient, 148 150 .request = request, 149 .value = value,150 .index = index,151 .length = (uint16_t) data_size,151 .value = uint16_host2usb(value), 152 .index = uint16_host2usb(index), 153 .length = uint16_host2usb(data_size), 152 154 }; 153 155 … … 375 377 usb_standard_device_descriptor_t descriptor_tmp; 376 378 int rc = usb_request_get_descriptor(pipe, 377 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 379 USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE, 378 380 USB_DESCTYPE_DEVICE, 0, 0, 379 381 &descriptor_tmp, sizeof(descriptor_tmp), … … 435 437 /* Everything is okay, copy the descriptor. */ 436 438 memcpy(descriptor, &descriptor_tmp, sizeof(descriptor_tmp)); 437 438 439 return EOK; 439 440 } … … 495 496 return ENOENT; 496 497 } 497 if (bare_config.total_length < sizeof(bare_config)) { 498 499 const size_t total_length = uint16_usb2host(bare_config.total_length); 500 if (total_length < sizeof(bare_config)) { 498 501 return ELIMIT; 499 502 } 500 503 501 void *buffer = malloc( bare_config.total_length);504 void *buffer = malloc(total_length); 502 505 if (buffer == NULL) { 503 506 return ENOMEM; … … 506 509 size_t transferred = 0; 507 510 rc = usb_request_get_full_configuration_descriptor(pipe, index, 508 buffer, bare_config.total_length, &transferred);511 buffer, total_length, &transferred); 509 512 if (rc != EOK) { 510 513 free(buffer); … … 512 515 } 513 516 514 if (transferred != bare_config.total_length) {517 if (transferred != total_length) { 515 518 free(buffer); 516 519 return ELIMIT; … … 522 525 523 526 if (descriptor_size != NULL) { 524 *descriptor_size = bare_config.total_length;527 *descriptor_size = total_length; 525 528 } 526 529
Note:
See TracChangeset
for help on using the changeset viewer.