Changeset 9efad54 in mainline for uspace/lib/usbdev/src/devdrv.c


Ignore:
Timestamp:
2018-01-06T21:15:48Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
56257ba
Parents:
c901632
Message:

usb: move endpoint descriptor parsing to HC

This better separates responsibilities. Now the device driver does not
care about the contents of an endpoint descriptor, and HC can parse the
values according to device's actual speed.

Currently, it is device driver's responsibility to fetch endpoint
descriptors, map them and register pipes - sending the endpoint
descriptor back to HC. HC then parses it, and fills the pipe
description, which then sends back to device driver. We shall probably
fetch the endpoint descriptor from inside the HC (also fixing the USB
spec violation of communication with EP0).

File:
1 edited

Legend:

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

    rc901632 r9efad54  
    255255
    256256        /* Register created pipes. */
     257        unsigned pipes_registered = 0;
    257258        for (size_t i = 0; i < pipe_count; i++) {
    258259                if (pipes[i].present) {
    259                         rc = usb_pipe_register(&pipes[i].pipe);
     260                        rc = usb_pipe_register(&pipes[i].pipe, pipes[i].descriptor, pipes[i].companion_descriptor);
    260261                        if (rc != EOK) {
    261262                                goto rollback_unregister_endpoints;
    262263                        }
    263264                }
     265                pipes_registered++;
    264266        }
    265267
     
    276278         */
    277279rollback_unregister_endpoints:
    278         for (size_t i = 0; i < pipe_count; i++) {
     280        for (size_t i = 0; i < pipes_registered; i++) {
    279281                if (pipes[i].present) {
    280282                        usb_pipe_unregister(&pipes[i].pipe);
     
    419421        /* This pipe was registered by the hub driver,
    420422         * during device initialization. */
    421         int rc = usb_pipe_initialize_default_control(
    422             &usb_dev->ctrl_pipe, usb_dev->bus_session);
     423        int rc = usb_pipe_initialize_default_control(&usb_dev->ctrl_pipe, usb_dev->bus_session);
    423424        if (rc != EOK) {
    424425                usb_dev_disconnect(usb_dev->bus_session);
Note: See TracChangeset for help on using the changeset viewer.