Changeset bf4cc3e in mainline


Ignore:
Timestamp:
2011-03-11T17:32:16Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
df949c5, fb1d4990
Parents:
71b6e92
Message:

Get bMaxPacketSize0 when initializing default pipe

File:
1 edited

Legend:

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

    r71b6e92 rbf4cc3e  
    3737#include <usb/pipes.h>
    3838#include <usb/dp.h>
     39#include <usb/request.h>
    3940#include <errno.h>
    4041#include <assert.h>
     
    370371        int rc = usb_endpoint_pipe_initialize(pipe, connection,
    371372            0, USB_TRANSFER_CONTROL, 8, USB_DIRECTION_BOTH);
    372 
     373        if (rc != EOK) {
     374                return rc;
     375        }
     376        rc = usb_endpoint_pipe_start_session(pipe);
     377        if (rc != EOK) {
     378                return rc;
     379        }
     380
     381        uint8_t first[8];
     382        size_t size = 0;
     383        rc = usb_control_request_get(pipe, USB_REQUEST_TYPE_STANDARD,
     384            USB_REQUEST_RECIPIENT_DEVICE, USB_DEVREQ_GET_DESCRIPTOR, 1 << 8,
     385                        0, first, 8, &size);
     386        usb_endpoint_pipe_end_session(pipe);
     387        if (rc != EOK || size  != 8) {
     388                return rc;
     389        }
     390
     391        pipe->max_packet_size = first[7];
    373392        return rc;
    374393}
Note: See TracChangeset for help on using the changeset viewer.