Changeset a045ab1 in mainline
- Timestamp:
- 2011-12-11T13:55:20Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c202c5
- Parents:
- 6df14c5
- Location:
- uspace/lib/usb
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/Makefile
r6df14c5 ra045ab1 37 37 src/class.c \ 38 38 src/ddfiface.c \ 39 src/dev.c \ 39 40 src/debug.c \ 40 41 src/dump.c \ -
uspace/lib/usb/include/usb/hc.h
r6df14c5 ra045ab1 114 114 } 115 115 116 usb_address_t usb_get_address_by_handle(devman_handle_t);117 118 int usb_find_hc(devman_handle_t, devman_handle_t *);119 120 int usb_resolve_device_handle(const char *, devman_handle_t *, usb_address_t *,121 devman_handle_t *);122 123 116 int usb_ddf_get_hc_handle_by_sid(service_id_t, devman_handle_t *); 124 117 -
uspace/lib/usb/include/usb/usb.h
r6df14c5 ra045ab1 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 29 28 /** @addtogroup libusb 30 29 * @{ -
uspace/lib/usb/src/ddfiface.c
r6df14c5 ra045ab1 43 43 #include <errno.h> 44 44 #include <assert.h> 45 46 #include <usb/dev.h> 45 47 46 48 /** DDF interface for USB device, implementation for typical hub. */ … … 134 136 assert(fun); 135 137 assert(fun->driver_data); 136 usb_hub_attached_device_t *device = fun->driver_data;138 const usb_hub_attached_device_t *device = fun->driver_data; 137 139 assert(device->fun == fun); 138 140 if (address) -
uspace/lib/usb/src/hc.c
r6df14c5 ra045ab1 37 37 #include <async.h> 38 38 #include <dev_iface.h> 39 #include <usb_iface.h>40 39 #include <usbhc_iface.h> 41 40 #include <usb/hc.h> 42 41 #include <usb/debug.h> 42 #include <usb/dev.h> 43 43 #include <errno.h> 44 44 #include <assert.h> … … 288 288 return ret; 289 289 } 290 /*----------------------------------------------------------------------------*/291 /** Tell USB address assigned to device with given handle.292 *293 * @param dev_handle Devman handle of the USB device in question.294 * @return USB address or negative error code.295 */296 usb_address_t usb_get_address_by_handle(devman_handle_t dev_handle)297 {298 async_sess_t *parent_sess =299 devman_parent_device_connect(EXCHANGE_ATOMIC, dev_handle,300 IPC_FLAG_BLOCKING);301 if (!parent_sess)302 return ENOMEM;303 304 async_exch_t *exch = async_exchange_begin(parent_sess);305 if (!exch) {306 async_hangup(parent_sess);307 return ENOMEM;308 }309 usb_address_t address;310 const int ret = usb_get_my_address(exch, &address);311 312 async_exchange_end(exch);313 async_hangup(parent_sess);314 315 if (ret != EOK)316 return ret;317 318 return address;319 }320 321 /** Find host controller handle for the device.322 *323 * @param[in] device_handle Device devman handle.324 * @param[out] hc_handle Where to store handle of host controller325 * controlling device with @p device_handle handle.326 * @return Error code.327 */328 int usb_find_hc(devman_handle_t device_handle, devman_handle_t *hc_handle)329 {330 async_sess_t *parent_sess =331 devman_parent_device_connect(EXCHANGE_ATOMIC, device_handle,332 IPC_FLAG_BLOCKING);333 if (!parent_sess)334 return ENOMEM;335 336 async_exch_t *exch = async_exchange_begin(parent_sess);337 if (!exch) {338 async_hangup(parent_sess);339 return ENOMEM;340 }341 const int ret = usb_get_hc_handle(exch, hc_handle);342 343 async_exchange_end(exch);344 async_hangup(parent_sess);345 346 return ret;347 }348 290 349 291 /** -
uspace/lib/usb/src/resolve.c
r6df14c5 ra045ab1 34 34 */ 35 35 #include <inttypes.h> 36 #include <usb/dev.h> 36 37 #include <usb/hc.h> 37 38 #include <devman.h> … … 77 78 devman_handle_t *dev_handle) 78 79 { 79 int rc;80 80 usb_hc_connection_t conn; 81 82 81 usb_hc_connection_initialize(&conn, hc_handle); 83 rc = usb_hc_connection_open(&conn); 84 if (rc != EOK) { 85 return rc; 86 } 87 88 rc = usb_hc_get_handle_by_address(&conn, addr, dev_handle); 89 90 usb_hc_connection_close(&conn); 82 83 const int rc = usb_hc_get_handle_by_address(&conn, addr, dev_handle); 91 84 92 85 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.