Changes in uspace/lib/usb/src/devdrv.c [e484f3b:3954a63b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/devdrv.c
re484f3b r3954a63b 137 137 } 138 138 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); 142 151 if (rc != EOK) { 143 152 usb_log_error("Failed initializing USB endpoints: %s.\n", … … 228 237 229 238 /* 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. 231 241 */ 232 242 rc = usb_pipe_start_session(&dev->ctrl_pipe); … … 237 247 } 238 248 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 258 249 if (driver->endpoints != NULL) { 259 250 rc = initialize_other_pipes(driver, dev); … … 262 253 /* No checking here. */ 263 254 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 }271 255 272 256 return rc; … … 299 283 dev->ddf_dev->driver_data = dev; 300 284 dev->driver_data = NULL; 301 dev->descriptors.configuration = NULL;302 285 303 286 rc = initialize_pipes(dev);
Note:
See TracChangeset
for help on using the changeset viewer.