Changeset 9f807c3 in mainline


Ignore:
Timestamp:
2012-02-24T04:41:23Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7f7e6f5
Parents:
dd93bb2
Message:

ohci, lib/usbdev: Fix few endian issues in descriptor retrieving.

Qemu mouse is found and initialized, can be queried via usbinfo, HID driver not working yet.

Location:
uspace
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/root_hub.c

    rdd93bb2 r9f807c3  
    347347            instance->interrupt_mask_size;
    348348
    349         instance->descriptors.configuration.total_length =
     349        instance->descriptors.configuration.total_length = uint16_host2usb(
    350350            sizeof(usb_standard_configuration_descriptor_t) +
    351351            sizeof(usb_standard_endpoint_descriptor_t) +
    352352            sizeof(usb_standard_interface_descriptor_t) +
    353             instance->hub_descriptor_size;
     353            instance->hub_descriptor_size);
    354354}
    355355/*----------------------------------------------------------------------------*/
     
    492492        usb_device_request_setup_packet_t *setup_request =
    493493            (usb_device_request_setup_packet_t *) request->setup_buffer;
    494         const int setup_request_value = uint16_usb2host(setup_request->value);
    495         switch (setup_request_value)
     494        /* "The wValue field specifies the descriptor type in the high byte
     495         * and the descriptor index in the low byte (refer to Table 9-5)." */
     496        const int desc_type = uint16_usb2host(setup_request->value) >> 8;
     497        switch (desc_type)
    496498        {
    497499        case USB_DESCTYPE_HUB:
     
    540542                    setup_request->value,
    541543                    setup_request->request_type, setup_request->request,
    542                     setup_request_value, setup_request->index,
     544                    desc_type, setup_request->index,
    543545                    setup_request->length);
    544546                TRANSFER_END(request, EINVAL);
  • uspace/lib/usbdev/src/request.c

    rdd93bb2 r9f807c3  
    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 
     437        descriptor->total_length = uint16_usb2host(descriptor_tmp.total_length);
    438438        return EOK;
    439439}
Note: See TracChangeset for help on using the changeset viewer.