Changeset 3f2af64 in mainline
- Timestamp:
- 2011-04-10T14:08:12Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4776ba9, d8b275d
- Parents:
- 231748a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified uspace/lib/usb/src/devdrv.c ¶
r231748a r3f2af64 180 180 * with usb_pipe_initialize_from_configuration(). 181 181 * 182 * @warning This is a wrapper function that does several operations that 183 * can fail and that cannot be rollbacked easily. That means that a failure 184 * during the SET_INTERFACE request would result in having a device with 185 * no pipes at all (except the default control one). That is because the old 186 * pipes needs to be unregistered at HC first and the new ones could not 187 * be created. 188 * 182 189 * @param dev USB device. 183 190 * @param alternate_setting Alternate setting to choose. … … 193 200 194 201 int rc; 195 196 /* TODO: more transactional behavior. */197 202 198 203 /* Destroy existing pipes. */ … … 431 436 } 432 437 433 /** Initialize control pipe and device descriptors. */ 434 static int initialize_ctrl_pipe_and_descriptors(usb_device_t *dev, 435 const char **errmsg) 438 /** Initialize control pipe in a device. 439 * 440 * @param dev USB device in question. 441 * @param errmsg Where to store error context. 442 * @return 443 */ 444 static int init_wire_and_ctrl_pipe(usb_device_t *dev, const char **errmsg) 436 445 { 437 446 int rc; … … 451 460 } 452 461 453 /* Get our interface. */ 454 dev->interface_no = usb_device_get_assigned_interface(dev->ddf_dev); 455 456 /* Retrieve the descriptors. */ 457 rc = usb_device_retrieve_descriptors(&dev->ctrl_pipe, 458 &dev->descriptors); 459 if (rc != EOK) { 460 *errmsg = "descriptor retrieval"; 461 } 462 463 return rc; 462 return EOK; 464 463 } 465 464 … … 489 488 } 490 489 490 // FIXME: proper deallocation in case of errors 491 491 492 dev->ddf_dev = ddf_dev; 492 493 dev->driver_data = NULL; … … 497 498 dev->pipes = NULL; 498 499 499 rc = initialize_ctrl_pipe_and_descriptors(dev, errstr_ptr); 500 if (rc != EOK) { 501 return rc; 502 } 503 500 /* Initialize backing wire and control pipe. */ 501 rc = init_wire_and_ctrl_pipe(dev, errstr_ptr); 502 if (rc != EOK) { 503 return rc; 504 } 505 506 /* Get our interface. */ 507 dev->interface_no = usb_device_get_assigned_interface(dev->ddf_dev); 508 509 /* Retrieve standard descriptors. */ 510 rc = usb_device_retrieve_descriptors(&dev->ctrl_pipe, 511 &dev->descriptors); 512 if (rc != EOK) { 513 *errstr_ptr = "descriptor retrieval"; 514 return rc; 515 } 516 517 /* Create alternate interfaces. */ 504 518 rc = usb_alternate_interfaces_create(dev->descriptors.configuration, 505 519 dev->descriptors.configuration_size, dev->interface_no, … … 513 527 if (rc != EOK) { 514 528 *errstr_ptr = "pipes initialization"; 515 /* TODO: deallocate */516 529 return rc; 517 530 }
Note:
See TracChangeset
for help on using the changeset viewer.