Changeset e484f3b in mainline
- Timestamp:
- 2011-03-21T16:27:49Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 625f1ba
- Parents:
- 34eb135
- Location:
- uspace/lib/usb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/devdrv.h
r34eb135 re484f3b 38 38 #include <usb/pipes.h> 39 39 40 /** Descriptors for USB device. */ 41 typedef struct { 42 /** Standard device descriptor. */ 43 usb_standard_device_descriptor_t device; 44 /** Full configuration descriptor of current configuration. */ 45 uint8_t *configuration; 46 size_t configuration_size; 47 } usb_device_descriptors_t; 48 40 49 /** USB device structure. */ 41 50 typedef struct { … … 52 61 */ 53 62 int interface_no; 63 64 /** Some useful descriptors. */ 65 usb_device_descriptors_t descriptors; 66 54 67 /** Generic DDF device backing this one. */ 55 68 ddf_dev_t *ddf_dev; -
uspace/lib/usb/src/devdrv.c
r34eb135 re484f3b 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_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", … … 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 232 rc = usb_pipe_start_session(&dev->ctrl_pipe); … … 247 237 } 248 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 return rc; 256 } 257 249 258 if (driver->endpoints != NULL) { 250 259 rc = initialize_other_pipes(driver, dev); … … 253 262 /* No checking here. */ 254 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.