Ignore:
File:
1 edited

Legend:

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

    re484f3b r3954a63b  
    137137        }
    138138
    139         rc = usb_pipe_initialize_from_configuration(dev->pipes, pipe_count,
    140             dev->descriptors.configuration, dev->descriptors.configuration_size,
    141             &dev->wire);
     139        void *config_descriptor;
     140        size_t config_descriptor_size;
     141        rc = usb_request_get_full_configuration_descriptor_alloc(
     142            &dev->ctrl_pipe, 0, &config_descriptor, &config_descriptor_size);
     143        if (rc != EOK) {
     144                usb_log_error("Failed retrieving configuration of `%s': %s.\n",
     145                    dev->ddf_dev->name, str_error(rc));
     146                goto rollback;
     147        }
     148
     149        rc = usb_pipe_initialize_from_configuration(dev->pipes,
     150           pipe_count, config_descriptor, config_descriptor_size, &dev->wire);
    142151        if (rc != EOK) {
    143152                usb_log_error("Failed initializing USB endpoints: %s.\n",
     
    228237
    229238        /*
    230          * For further actions, we need open session on default control pipe.
     239         * Initialization of other pipes requires open session on
     240         * default control pipe.
    231241         */
    232242        rc = usb_pipe_start_session(&dev->ctrl_pipe);
     
    237247        }
    238248
    239         /* Get the device descriptor. */
    240         rc = usb_request_get_device_descriptor(&dev->ctrl_pipe,
    241             &dev->descriptors.device);
    242         if (rc != EOK) {
    243                 usb_log_error("Failed to retrieve device descriptor: %s.\n",
    244                     str_error(rc));
    245                 return rc;
    246         }
    247 
    248         /* Get the full configuration descriptor. */
    249         rc = usb_request_get_full_configuration_descriptor_alloc(
    250             &dev->ctrl_pipe, 0, (void **) &dev->descriptors.configuration,
    251             &dev->descriptors.configuration_size);
    252         if (rc != EOK) {
    253                 usb_log_error("Failed retrieving configuration descriptor: %s.\n",
    254                     dev->ddf_dev->name, str_error(rc));
    255                 return rc;
    256         }
    257 
    258249        if (driver->endpoints != NULL) {
    259250                rc = initialize_other_pipes(driver, dev);
     
    262253        /* No checking here. */
    263254        usb_pipe_end_session(&dev->ctrl_pipe);
    264 
    265         /* Rollback actions. */
    266         if (rc != EOK) {
    267                 if (dev->descriptors.configuration != NULL) {
    268                         free(dev->descriptors.configuration);
    269                 }
    270         }
    271255
    272256        return rc;
     
    299283        dev->ddf_dev->driver_data = dev;
    300284        dev->driver_data = NULL;
    301         dev->descriptors.configuration = NULL;
    302285
    303286        rc = initialize_pipes(dev);
Note: See TracChangeset for help on using the changeset viewer.