Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/request.c

    r12e689f r095bddfc  
    114114  *     (in native endianness).
    115115  * @param actual_data_size Actual size of transfered data
    116   *        (in native endianness).
     116  *     (in native endianness).
    117117  * @return Error code.
    118118  * @retval EBADMEM @p pipe is NULL.
     
    147147                    | (request_type << 5) | recipient,
    148148                .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,
    152152        };
    153153
     
    375375        usb_standard_device_descriptor_t descriptor_tmp;
    376376        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, 
    378378            USB_DESCTYPE_DEVICE, 0, 0,
    379379            &descriptor_tmp, sizeof(descriptor_tmp),
     
    435435        /* Everything is okay, copy the descriptor. */
    436436        memcpy(descriptor, &descriptor_tmp, sizeof(descriptor_tmp));
     437
    437438        return EOK;
    438439}
     
    494495                return ENOENT;
    495496        }
    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)) {
    499498                return ELIMIT;
    500499        }
    501500
    502         void *buffer = malloc(total_length);
     501        void *buffer = malloc(bare_config.total_length);
    503502        if (buffer == NULL) {
    504503                return ENOMEM;
     
    507506        size_t transferred = 0;
    508507        rc = usb_request_get_full_configuration_descriptor(pipe, index,
    509             buffer, total_length, &transferred);
     508            buffer, bare_config.total_length, &transferred);
    510509        if (rc != EOK) {
    511510                free(buffer);
     
    513512        }
    514513
    515         if (transferred != total_length) {
     514        if (transferred != bare_config.total_length) {
    516515                free(buffer);
    517516                return ELIMIT;
     
    523522
    524523        if (descriptor_size != NULL) {
    525                 *descriptor_size = total_length;
     524                *descriptor_size = bare_config.total_length;
    526525        }
    527526
Note: See TracChangeset for help on using the changeset viewer.