Changes in uspace/lib/usbdev/src/devdrv.c [816f5f4:2bdf92a5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/devdrv.c
r816f5f4 r2bdf92a5 53 53 54 54 /** USB device structure. */ 55 typedefstruct usb_device {55 struct usb_device { 56 56 /** Connection to device on USB bus */ 57 57 usb_dev_session_t *bus_session; 58 58 59 59 /** devman handle */ 60 60 devman_handle_t handle; 61 61 62 62 /** The default control pipe. */ 63 63 usb_pipe_t ctrl_pipe; 64 64 65 65 /** Other endpoint pipes. 66 66 * … … 69 69 */ 70 70 usb_endpoint_mapping_t *pipes; 71 71 72 72 /** Number of other endpoint pipes. */ 73 73 size_t pipes_count; 74 74 75 75 /** Current interface. 76 76 * … … 79 79 */ 80 80 int interface_no; 81 81 82 82 /** Alternative interfaces. */ 83 83 usb_alternate_interfaces_t alternate_interfaces; 84 84 85 85 /** Some useful descriptors for USB device. */ 86 86 usb_device_descriptors_t descriptors; 87 87 88 88 /** Generic DDF device backing this one. DO NOT TOUCH! */ 89 89 ddf_dev_t *ddf_dev; 90 90 91 91 /** Custom driver data. 92 92 * … … 95 95 */ 96 96 void *driver_data; 97 } usb_device_t;97 }; 98 98 99 99 /** Count number of pipes the driver expects. … … 146 146 return rc; 147 147 } 148 148 149 149 /* Change current alternative */ 150 150 usb_dev->alternate_interfaces.current = alternate_setting; … … 296 296 assert(usb_dev); 297 297 assert(usb_dev->pipes || usb_dev->pipes_count == 0); 298 298 299 299 /* Destroy the pipes. */ 300 300 for (size_t i = 0; i < usb_dev->pipes_count; ++i) { … … 304 304 usb_pipe_unregister(&usb_dev->pipes[i].pipe); 305 305 } 306 306 307 307 free(usb_dev->pipes); 308 308 usb_dev->pipes = NULL; … … 332 332 assert(usb_dev); 333 333 for (unsigned i = 0; i < usb_dev->pipes_count; ++i) { 334 if (usb_dev->pipes[i].pipe. desc.endpoint_no == ep)334 if (usb_dev->pipes[i].pipe.endpoint_no == ep) 335 335 return &usb_dev->pipes[i]; 336 336 } … … 462 462 assert(handle); 463 463 assert(iface_no); 464 464 465 465 async_exch_t *exch = async_exchange_begin(sess); 466 466 if (!exch) 467 467 return EPARTY; 468 468 469 469 int ret = usb_get_my_device_handle(exch, handle); 470 470 if (ret == EOK) { … … 475 475 } 476 476 } 477 477 478 478 async_exchange_end(exch); 479 479 return ret; … … 489 489 int iface_no = -1; 490 490 491 async_sess_t *sess = devman_parent_device_connect( 492 ddf_dev_get_handle(ddf_dev), IPC_FLAG_BLOCKING); 491 async_sess_t *sess = ddf_dev_parent_sess_get(ddf_dev); 493 492 if (sess == NULL) 494 493 return ENOMEM; 495 494 const int ret = usb_device_get_info(sess, &h, &iface_no); 496 async_hangup(sess);497 495 if (ret != EOK) 498 496 return ret; … … 504 502 return ENOMEM; 505 503 } 506 504 507 505 return usb_device_init(usb_dev, ddf_dev, desc, err, h, iface_no); 508 506 }
Note:
See TracChangeset
for help on using the changeset viewer.