Changeset 41ef5b9 in mainline for uspace/lib/usb/src/devdrv.c
- Timestamp:
- 2011-03-21T17:16:10Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4d0c40b
- Parents:
- fd9f6e4c (diff), 434ef65 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/devdrv.c
rfd9f6e4c r41ef5b9 126 126 127 127 for (i = 0; i < pipe_count; i++) { 128 dev->pipes[i].pipe = malloc(sizeof(usb_ endpoint_pipe_t));128 dev->pipes[i].pipe = malloc(sizeof(usb_pipe_t)); 129 129 if (dev->pipes[i].pipe == NULL) { 130 130 usb_log_oom(dev->ddf_dev); … … 137 137 } 138 138 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_endpoint_pipe_initialize_from_configuration(dev->pipes, 150 pipe_count, config_descriptor, config_descriptor_size, &dev->wire); 139 rc = usb_pipe_initialize_from_configuration(dev->pipes, pipe_count, 140 dev->descriptors.configuration, dev->descriptors.configuration_size, 141 &dev->wire); 151 142 if (rc != EOK) { 152 143 usb_log_error("Failed initializing USB endpoints: %s.\n", … … 172 163 for (i = 0; i < pipe_count; i++) { 173 164 if (dev->pipes[i].present) { 174 rc = usb_ endpoint_pipe_register(dev->pipes[i].pipe,165 rc = usb_pipe_register(dev->pipes[i].pipe, 175 166 dev->pipes[i].descriptor->poll_interval, 176 167 &hc_conn); … … 219 210 } 220 211 221 rc = usb_ endpoint_pipe_initialize_default_control(&dev->ctrl_pipe,212 rc = usb_pipe_initialize_default_control(&dev->ctrl_pipe, 222 213 &dev->wire); 223 214 if (rc != EOK) { … … 228 219 } 229 220 230 rc = usb_ endpoint_pipe_probe_default_control(&dev->ctrl_pipe);221 rc = usb_pipe_probe_default_control(&dev->ctrl_pipe); 231 222 if (rc != EOK) { 232 223 usb_log_error( … … 237 228 238 229 /* 239 * Initialization of other pipes requires open session on 240 * default control pipe. 230 * For further actions, we need open session on default control pipe. 241 231 */ 242 rc = usb_ endpoint_pipe_start_session(&dev->ctrl_pipe);232 rc = usb_pipe_start_session(&dev->ctrl_pipe); 243 233 if (rc != EOK) { 244 234 usb_log_error("Failed to start an IPC session: %s.\n", 245 235 str_error(rc)); 236 return rc; 237 } 238 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)); 246 255 return rc; 247 256 } … … 252 261 253 262 /* No checking here. */ 254 usb_endpoint_pipe_end_session(&dev->ctrl_pipe); 263 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 } 255 271 256 272 return rc; … … 283 299 dev->ddf_dev->driver_data = dev; 284 300 dev->driver_data = NULL; 301 dev->descriptors.configuration = NULL; 285 302 286 303 rc = initialize_pipes(dev);
Note:
See TracChangeset
for help on using the changeset viewer.