Changeset f4138ac in mainline
- Timestamp:
- 2013-01-26T19:22:41Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b06d35a
- Parents:
- 2dc5a9f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/devdrv.c
r2dc5a9f rf4138ac 76 76 * @return Error code. 77 77 */ 78 int usb_device_select_interface(usb_device_t *dev, uint8_t alternate_setting, 79 const usb_endpoint_description_t **endpoints) 80 { 81 if (dev->interface_no < 0) { 78 int usb_device_select_interface(usb_device_t *usb_dev, 79 uint8_t alternate_setting, const usb_endpoint_description_t **endpoints) 80 { 81 assert(usb_dev); 82 83 if (usb_dev->interface_no < 0) { 82 84 return EINVAL; 83 85 } 84 86 87 /* Change the interface itself. */ 88 int rc = usb_request_set_interface(&usb_dev->ctrl_pipe, 89 usb_dev->interface_no, alternate_setting); 90 if (rc != EOK) { 91 return rc; 92 } 93 94 /* Change current alternative */ 95 usb_dev->alternate_interfaces.current = alternate_setting; 96 85 97 /* Destroy existing pipes. */ 86 usb_device_destroy_pipes(dev); 87 88 /* Change the interface itself. */ 89 int rc = usb_request_set_interface(&dev->ctrl_pipe, dev->interface_no, 90 alternate_setting); 91 if (rc != EOK) { 92 return rc; 93 } 98 usb_device_destroy_pipes(usb_dev); 94 99 95 100 /* Create new pipes. */ 96 rc = usb_device_create_pipes(&dev->wire, endpoints, 97 dev->descriptors.configuration, dev->descriptors.configuration_size, 98 dev->interface_no, (int)alternate_setting, 99 &dev->pipes, &dev->pipes_count); 101 rc = usb_device_create_pipes(&usb_dev->wire, endpoints, 102 usb_dev->descriptors.configuration, 103 usb_dev->descriptors.configuration_size, 104 usb_dev->interface_no, usb_dev->alternate_interfaces.current, 105 &usb_dev->pipes, &usb_dev->pipes_count); 100 106 101 107 return rc; … … 381 387 usb_dev->descriptors.configuration, 382 388 usb_dev->descriptors.configuration_size, usb_dev->interface_no); 383 const int alternate_iface =384 (rc == EOK) ? usb_dev->alternate_interfaces.current : 0;385 389 386 390 /* Create and register other pipes than default control (EP 0) */ … … 388 392 usb_dev->descriptors.configuration, 389 393 usb_dev->descriptors.configuration_size, 390 usb_dev->interface_no, (int)alternate_iface,394 usb_dev->interface_no, usb_dev->alternate_interfaces.current, 391 395 &usb_dev->pipes, &usb_dev->pipes_count); 392 396 if (rc != EOK) {
Note:
See TracChangeset
for help on using the changeset viewer.