Changeset a4e18e1 in mainline for uspace/lib/usb/src/hub.c


Ignore:
Timestamp:
2011-04-07T15:04:16Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
36cd378
Parents:
9d06563 (diff), a82889e (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:

partial merge form usb/development

File:
1 edited

Legend:

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

    r9d06563 ra4e18e1  
    142142            DEV_IFACE_ID(USBHC_DEV_IFACE),
    143143            IPC_M_USBHC_RELEASE_ADDRESS, address);
     144}
     145
     146static void unregister_control_endpoint_on_default_address(
     147    usb_hc_connection_t *connection)
     148{
     149        usb_device_connection_t dev_conn;
     150        int rc = usb_device_connection_initialize_on_default_address(&dev_conn,
     151            connection);
     152        if (rc != EOK) {
     153                return;
     154        }
     155
     156        usb_pipe_t ctrl_pipe;
     157        rc = usb_pipe_initialize_default_control(&ctrl_pipe, &dev_conn);
     158        if (rc != EOK) {
     159                return;
     160        }
     161
     162        usb_pipe_unregister(&ctrl_pipe, connection);
    144163}
    145164
     
    235254                goto leave_release_default_address;
    236255        }
     256
     257        /* Before sending any traffic, we need to register this
     258         * endpoint.
     259         */
     260        rc = usb_pipe_register(&ctrl_pipe, 0, connection);
     261        if (rc != EOK) {
     262                rc = EREFUSED;
     263                goto leave_release_default_address;
     264        }
    237265        rc = usb_pipe_probe_default_control(&ctrl_pipe);
    238266        if (rc != EOK) {
     
    244272        if (rc != EOK) {
    245273                rc = ENOTCONN;
    246                 goto leave_release_default_address;
     274                goto leave_unregister_endpoint;
    247275        }
    248276
     
    256284
    257285        /*
     286         * Register the control endpoint for the new device.
     287         */
     288        rc = usb_pipe_register(&ctrl_pipe, 0, connection);
     289        if (rc != EOK) {
     290                rc = EREFUSED;
     291                goto leave_unregister_endpoint;
     292        }
     293
     294        /*
     295         * Release the original endpoint.
     296         */
     297        unregister_control_endpoint_on_default_address(connection);
     298
     299        /*
    258300         * Once the address is changed, we can return the default address.
    259301         */
    260302        usb_hc_release_default_address(connection);
     303
    261304
    262305        /*
     
    273316        }
    274317
     318
     319
    275320        /*
    276321         * And now inform the host controller about the handle.
     
    308353        usb_pipe_end_session(&ctrl_pipe);
    309354
     355leave_unregister_endpoint:
     356        usb_pipe_unregister(&ctrl_pipe, connection);
     357
    310358leave_release_default_address:
    311359        usb_hc_release_default_address(connection);
Note: See TracChangeset for help on using the changeset viewer.