Changeset 441633f in mainline
- Timestamp:
- 2011-12-14T21:47:24Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 64e3dad
- Parents:
- 6883abfa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/devdrv.c
r6883abfa r441633f 107 107 } 108 108 109 usb_endpoint_mapping_t *pipes ;110 size_t pipes_count ;111 112 int rc = usb_device_create_pipes(&dev->wire, endpoints,109 usb_endpoint_mapping_t *pipes = NULL; 110 size_t pipes_count = 0; 111 112 const int rc = usb_device_create_pipes(&dev->wire, endpoints, 113 113 dev->descriptors.configuration, dev->descriptors.configuration_size, 114 114 dev->interface_no, alternate_setting, &pipes, &pipes_count); 115 115 116 if (rc != EOK) { 117 return rc; 118 } 119 120 dev->pipes = pipes; 121 dev->pipes_count = pipes_count; 122 123 return EOK; 116 if (rc == EOK) { 117 dev->pipes = pipes; 118 dev->pipes_count = pipes_count; 119 } 120 121 return rc; 124 122 } 125 123 /*----------------------------------------------------------------------------*/ … … 238 236 } 239 237 240 int rc;241 242 238 /* Destroy existing pipes. */ 243 239 destroy_current_pipes(dev); 244 240 245 241 /* Change the interface itself. */ 246 rc = usb_request_set_interface(&dev->ctrl_pipe, dev->interface_no,242 int rc = usb_request_set_interface(&dev->ctrl_pipe, dev->interface_no, 247 243 alternate_setting); 248 244 if (rc != EOK) { … … 309 305 * - registers endpoints with the host controller 310 306 * 311 * @param[in] dev Generic DDF device backing the USB one.312 307 * @param[in] wire Initialized backing connection to the host controller. 313 308 * @param[in] endpoints Endpoints description, NULL terminated. … … 351 346 } 352 347 353 /* Now allocate and fullyinitialize. */348 /* Now initialize. */ 354 349 for (i = 0; i < pipe_count; i++) { 355 350 pipes[i].description = endpoints[i]; … … 362 357 config_descr, config_descr_size, wire); 363 358 if (rc != EOK) { 364 goto rollback_free_only; 365 } 366 359 free(pipes); 360 return rc; 361 } 362 363 /* Register created pipes. */ 367 364 for (i = 0; i < pipe_count; i++) { 368 365 if (pipes[i].present) { … … 395 392 } 396 393 397 /*398 * Jump here if something went wrong before some actual communication399 * with HC. Then the only thing that needs to be done is to free400 * allocated memory.401 */402 rollback_free_only:403 394 free(pipes); 404 405 395 return rc; 406 396 } … … 408 398 /** Destroy pipes previously created by usb_device_create_pipes. 409 399 * 410 * @param[in] dev Generic DDF device backing the USB one.411 400 * @param[in] pipes Endpoint mapping to be destroyed. 412 401 * @param[in] pipes_count Number of endpoints.
Note:
See TracChangeset
for help on using the changeset viewer.