Changes in uspace/lib/usbdev/src/hub.c [56fd7cf:1ab8539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/hub.c
r56fd7cf r1ab8539 155 155 * request or requests for descriptors when creating match ids). 156 156 */ 157 int usb_hc_new_device_wrapper(ddf_dev_t *parent, 157 int usb_hc_new_device_wrapper(ddf_dev_t *parent, ddf_fun_t *fun, 158 158 usb_hc_connection_t *hc_conn, usb_speed_t dev_speed, 159 159 int (*enable_port)(void *arg), void *arg, usb_address_t *assigned_address, 160 ddf_dev_ops_t *dev_ops , void *new_dev_data, ddf_fun_t **new_fun)160 ddf_dev_ops_t *dev_ops) 161 161 { 162 if ( (new_fun == NULL) || (hc_conn == NULL))162 if (hc_conn == NULL) 163 163 return EINVAL; 164 165 int rc; 164 166 165 struct timeval start_time; 167 168 rc = gettimeofday(&start_time, NULL); 169 if (rc != EOK) { 166 gettimeofday(&start_time, NULL); 167 168 /* We are gona do a lot of communication better open it in advance. */ 169 int rc = usb_hc_connection_open(hc_conn); 170 if (rc != EOK) 170 171 return rc; 171 } 172 173 /* We are gona do a lot of communication better open it in advance. */ 174 rc = usb_hc_connection_open(hc_conn); 175 if (rc != EOK) { 176 return rc; 177 } 178 172 179 173 /* Request a new address. */ 180 174 usb_address_t dev_addr = … … 226 220 goto leave_release_default_address; 227 221 } 228 222 229 223 struct timeval end_time; 230 rc = gettimeofday(&end_time, NULL); 231 if (rc != EOK) { 232 goto leave_release_default_address; 233 } 234 224 gettimeofday(&end_time, NULL); 225 235 226 /* According to the USB spec part 9.1.2 host allows 100ms time for 236 227 * the insertion process to complete. According to 7.1.7.1 this is the … … 271 262 /* Register the device with devman. */ 272 263 /* FIXME: create device_register that will get opened ctrl pipe. */ 273 ddf_fun_t *child_fun;274 264 rc = usb_device_register_child_in_devman(&ctrl_pipe, 275 parent, dev_ops, new_dev_data, &child_fun);265 parent, fun, dev_ops); 276 266 if (rc != EOK) { 277 267 goto leave_release_free_address; … … 280 270 const usb_hub_attached_device_t new_device = { 281 271 .address = dev_addr, 282 .fun = child_fun,272 .fun = fun, 283 273 }; 284 274 … … 288 278 if (rc != EOK) { 289 279 /* The child function is already created. */ 290 ddf_fun_destroy(child_fun);291 280 rc = EDESTADDRREQ; 292 281 goto leave_release_free_address; … … 296 285 *assigned_address = dev_addr; 297 286 } 298 299 *new_fun = child_fun;300 287 301 288 rc = EOK;
Note:
See TracChangeset
for help on using the changeset viewer.