Changes in uspace/lib/usb/src/devdrv.c [e484f3b:09daa8b] in mainline
- File:
-
- 1 edited
-
uspace/lib/usb/src/devdrv.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/devdrv.c
re484f3b r09daa8b 126 126 127 127 for (i = 0; i < pipe_count; i++) { 128 dev->pipes[i].pipe = malloc(sizeof(usb_ pipe_t));128 dev->pipes[i].pipe = malloc(sizeof(usb_endpoint_pipe_t)); 129 129 if (dev->pipes[i].pipe == NULL) { 130 130 usb_log_oom(dev->ddf_dev); … … 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_endpoint_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", … … 163 172 for (i = 0; i < pipe_count; i++) { 164 173 if (dev->pipes[i].present) { 165 rc = usb_ pipe_register(dev->pipes[i].pipe,174 rc = usb_endpoint_pipe_register(dev->pipes[i].pipe, 166 175 dev->pipes[i].descriptor->poll_interval, 167 176 &hc_conn); … … 210 219 } 211 220 212 rc = usb_ pipe_initialize_default_control(&dev->ctrl_pipe,221 rc = usb_endpoint_pipe_initialize_default_control(&dev->ctrl_pipe, 213 222 &dev->wire); 214 223 if (rc != EOK) { … … 219 228 } 220 229 221 rc = usb_ pipe_probe_default_control(&dev->ctrl_pipe);230 rc = usb_endpoint_pipe_probe_default_control(&dev->ctrl_pipe); 222 231 if (rc != EOK) { 223 232 usb_log_error( … … 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 rc = usb_ pipe_start_session(&dev->ctrl_pipe);242 rc = usb_endpoint_pipe_start_session(&dev->ctrl_pipe); 233 243 if (rc != EOK) { 234 244 usb_log_error("Failed to start an IPC session: %s.\n", 235 245 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));255 246 return rc; 256 247 } … … 261 252 262 253 /* No checking here. */ 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 } 254 usb_endpoint_pipe_end_session(&dev->ctrl_pipe); 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.
