Changeset fb2ef35 in mainline


Ignore:
Timestamp:
2011-12-11T20:17:05Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4c67e52
Parents:
c6d5f08
Message:

usbhub: Use usb_device_T provided hc_connection.

Start long transfer on control pipe before descriptor and settings manipulation.

Location:
uspace/drv/bus/usb/usbhub
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/port.c

    rc6d5f08 rfb2ef35  
    288288        port->attached_device.fun = NULL;
    289289
    290         ret = usb_hc_connection_open(&hub->connection);
    291         if (ret == EOK) {
    292                 ret = usb_hc_unregister_device(&hub->connection,
    293                     port->attached_device.address);
    294                 if (ret != EOK) {
    295                         usb_log_warning("Failed to unregister address of the "
    296                             "removed device: %s.\n", str_error(ret));
    297                 }
    298                 ret = usb_hc_connection_close(&hub->connection);
    299                 if (ret != EOK) {
    300                         usb_log_warning("Failed to close hc connection %s.\n",
    301                             str_error(ret));
    302                 }
    303 
    304         } else {
    305                 usb_log_warning("Failed to open hc connection %s.\n",
    306                     str_error(ret));
     290        ret = usb_hc_unregister_device(&hub->usb_device->hc_conn,
     291            port->attached_device.address);
     292        if (ret != EOK) {
     293                usb_log_warning("Failed to unregister address of the "
     294                    "removed device: %s.\n", str_error(ret));
    307295        }
    308296
     
    438426
    439427        const int rc = usb_hc_new_device_wrapper(data->hub->usb_device->ddf_dev,
    440             &data->hub->connection, data->speed, enable_port_callback,
     428            &data->hub->usb_device->hc_conn, data->speed, enable_port_callback,
    441429            data->port, &new_address, NULL, NULL, &child_fun);
    442430
  • uspace/drv/bus/usb/usbhub/usbhub.c

    rc6d5f08 rfb2ef35  
    9999        fibril_condvar_initialize(&hub_dev->pending_ops_cv);
    100100
    101         /* Create hc connection */
    102         usb_log_debug("Initializing USB wire abstraction.\n");
    103         int opResult = usb_hc_connection_initialize_from_device(
    104             &hub_dev->connection, hub_dev->usb_device->ddf_dev);
    105         if (opResult != EOK) {
    106                 usb_log_error("Could not initialize connection to device: %s\n",
     101
     102        int opResult = usb_pipe_start_long_transfer(&usb_dev->ctrl_pipe);
     103        if (opResult != EOK) {
     104                usb_log_error("Failed to start long ctrl pipe transfer: %s\n",
    107105                    str_error(opResult));
    108106                return opResult;
     
    112110        opResult = usb_set_first_configuration(usb_dev);
    113111        if (opResult != EOK) {
     112                usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    114113                usb_log_error("Could not set hub configuration: %s\n",
    115114                    str_error(opResult));
     
    120119        opResult = usb_hub_process_hub_specific_info(hub_dev);
    121120        if (opResult != EOK) {
     121                usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    122122                usb_log_error("Could process hub specific info, %s\n",
    123123                    str_error(opResult));
     
    130130            fun_exposed, HUB_FNC_NAME);
    131131        if (hub_dev->hub_fun == NULL) {
     132                usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    132133                usb_log_error("Failed to create hub function.\n");
    133134                return ENOMEM;
     
    137138        opResult = ddf_fun_bind(hub_dev->hub_fun);
    138139        if (opResult != EOK) {
     140                usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    139141                usb_log_error("Failed to bind hub function: %s.\n",
    140142                   str_error(opResult));
     
    148150            usb_hub_polling_terminated_callback, hub_dev);
    149151        if (opResult != EOK) {
     152                usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    150153                /* Function is already bound */
    151154                ddf_fun_unbind(hub_dev->hub_fun);
     
    159162            hub_dev->usb_device->ddf_dev->name, hub_dev->port_count);
    160163
     164        usb_pipe_end_long_transfer(&usb_dev->ctrl_pipe);
    161165        return EOK;
    162166}
  • uspace/drv/bus/usb/usbhub/usbhub.h

    rc6d5f08 rfb2ef35  
    5757        /** Port structures, one for each port */
    5858        usb_hub_port_t *ports;
    59         /** Connection to hcd */
    60         usb_hc_connection_t connection;
    6159        /** Generic usb device data*/
    6260        usb_device_t *usb_device;
Note: See TracChangeset for help on using the changeset viewer.