Ignore:
File:
1 edited

Legend:

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

    rad4562c2 r37b4794e  
    3636#include <errno.h>
    3737#include <assert.h>
    38 #include <usb/debug.h>
    3938
    4039#define MAX_DATA_LENGTH ((size_t)(0xFFFF))
     
    210209 */
    211210int usb_request_get_descriptor(usb_endpoint_pipe_t *pipe,
    212     usb_request_type_t request_type, usb_request_recipient_t recipient,
     211    usb_request_type_t request_type,
    213212    uint8_t descriptor_type, uint8_t descriptor_index,
    214213    uint16_t language,
     
    225224
    226225        return usb_control_request_get(pipe,
    227             request_type, recipient,
     226            request_type, USB_REQUEST_RECIPIENT_DEVICE,
    228227            USB_DEVREQ_GET_DESCRIPTOR,
    229228            wValue, language,
     
    243242 */
    244243int usb_request_get_descriptor_alloc(usb_endpoint_pipe_t * pipe,
    245     usb_request_type_t request_type, usb_request_recipient_t recipient,
     244    usb_request_type_t request_type,
    246245    uint8_t descriptor_type, uint8_t descriptor_index,
    247246    uint16_t language,
     
    259258        uint8_t tmp_buffer[1];
    260259        size_t bytes_transfered;
    261         rc = usb_request_get_descriptor(pipe, request_type, recipient,
     260        rc = usb_request_get_descriptor(pipe, request_type,
    262261            descriptor_type, descriptor_index, language,
    263262            &tmp_buffer, 1, &bytes_transfered);
     
    284283        }
    285284
    286         rc = usb_request_get_descriptor(pipe, request_type, recipient,
     285        rc = usb_request_get_descriptor(pipe, request_type,
    287286            descriptor_type, descriptor_index, language,
    288287            buffer, size, &bytes_transfered);
     
    321320        usb_standard_device_descriptor_t descriptor_tmp;
    322321        int rc = usb_request_get_descriptor(pipe,
    323             USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
    324             USB_DESCTYPE_DEVICE, 0, 0,
     322            USB_REQUEST_TYPE_STANDARD, USB_DESCTYPE_DEVICE,
     323            0, 0,
    325324            &descriptor_tmp, sizeof(descriptor_tmp),
    326325            &actually_transferred);
     
    367366        usb_standard_configuration_descriptor_t descriptor_tmp;
    368367        int rc = usb_request_get_descriptor(pipe,
    369             USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
    370             USB_DESCTYPE_CONFIGURATION, index, 0,
     368            USB_REQUEST_TYPE_STANDARD, USB_DESCTYPE_CONFIGURATION,
     369            index, 0,
    371370            &descriptor_tmp, sizeof(descriptor_tmp),
    372371            &actually_transferred);
     
    407406
    408407        return usb_request_get_descriptor(pipe,
    409             USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
    410             USB_DESCTYPE_CONFIGURATION, index, 0,
     408            USB_REQUEST_TYPE_STANDARD, USB_DESCTYPE_CONFIGURATION,
     409            index, 0,
    411410            descriptor, descriptor_size, actual_size);
    412411}
     
    453452        size_t string_descriptor_size = 0;
    454453        rc = usb_request_get_descriptor_alloc(pipe,
    455             USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
    456             USB_DESCTYPE_STRING, 0, 0,
     454            USB_REQUEST_TYPE_STANDARD, USB_DESCTYPE_STRING, 0, 0,
    457455            (void **) &string_descriptor, &string_descriptor_size);
    458456        if (rc != EOK) {
     
    504502 *
    505503 * @param[in] pipe Control endpoint pipe (session must be already started).
    506  * @param[in] index String index (in native endianess).
     504 * @param[in] index String index (in native endianess),
     505 *      first index has number 1 (index from descriptors can be used directly).
    507506 * @param[in] lang String language (in native endianess).
    508507 * @param[out] string_ptr Where to store allocated string in native encoding.
     
    515514                return EBADMEM;
    516515        }
    517         /* Index is actually one byte value. */
    518         if (index > 0xFF) {
     516        /*
     517         * Index is actually one byte value and zero index is used
     518         * to retrieve list of supported languages.
     519         */
     520        if ((index < 1) || (index > 0xFF)) {
    519521                return ERANGE;
    520522        }
     
    533535        size_t string_size;
    534536        rc = usb_request_get_descriptor_alloc(pipe,
    535             USB_REQUEST_TYPE_STANDARD, USB_REQUEST_RECIPIENT_DEVICE,
    536             USB_DESCTYPE_STRING, index, uint16_host2usb(lang),
     537            USB_REQUEST_TYPE_STANDARD, USB_DESCTYPE_STRING,
     538            index, uint16_host2usb(lang),
    537539            (void **) &string, &string_size);
    538540        if (rc != EOK) {
Note: See TracChangeset for help on using the changeset viewer.