Changeset b828907 in mainline for uspace/lib/usbdev/src/request.c


Ignore:
Timestamp:
2012-07-20T20:29:54Z (12 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
34bc2fe
Parents:
4cdac68 (diff), 6de2d766 (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.
Message:

Merge with mainline

File:
1 edited

Legend:

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

    r4cdac68 rb828907  
    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 = 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),
    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 
    438437        return EOK;
    439438}
     
    495494                return ENOENT;
    496495        }
    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)) {
    498499                return ELIMIT;
    499500        }
    500501
    501         void *buffer = malloc(bare_config.total_length);
     502        void *buffer = malloc(total_length);
    502503        if (buffer == NULL) {
    503504                return ENOMEM;
     
    506507        size_t transferred = 0;
    507508        rc = usb_request_get_full_configuration_descriptor(pipe, index,
    508             buffer, bare_config.total_length, &transferred);
     509            buffer, total_length, &transferred);
    509510        if (rc != EOK) {
    510511                free(buffer);
     
    512513        }
    513514
    514         if (transferred != bare_config.total_length) {
     515        if (transferred != total_length) {
    515516                free(buffer);
    516517                return ELIMIT;
     
    522523
    523524        if (descriptor_size != NULL) {
    524                 *descriptor_size = bare_config.total_length;
     525                *descriptor_size = total_length;
    525526        }
    526527
Note: See TracChangeset for help on using the changeset viewer.