Changeset c2343cc in mainline


Ignore:
Timestamp:
2011-03-14T22:22:16Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7ffe82f
Parents:
206f71a
Message:

Add function for getting USB address of a device

Location:
uspace/lib/usb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/pipes.h

    r206f71a rc2343cc  
    123123
    124124int usb_device_get_assigned_interface(ddf_dev_t *);
     125usb_address_t usb_device_get_assigned_address(devman_handle_t);
    125126
    126127int usb_endpoint_pipe_initialize(usb_endpoint_pipe_t *,
  • uspace/lib/usb/src/pipes.c

    r206f71a rc2343cc  
    5252        sysarg_t address;
    5353
    54 
    5554        /*
    5655         * We are sending special value as a handle - zero - to get
     
    9493
    9594        return (int) iface_no;
     95}
     96
     97/** Tell USB address assigned to given device.
     98 *
     99 * @param dev_handle Devman handle of the USB device in question.
     100 * @return USB address or negative error code.
     101 */
     102usb_address_t usb_device_get_assigned_address(devman_handle_t dev_handle)
     103{
     104        int parent_phone = devman_parent_device_connect(dev_handle,
     105            IPC_FLAG_BLOCKING);
     106        if (parent_phone < 0) {
     107                return parent_phone;
     108        }
     109
     110        sysarg_t address;
     111
     112        int rc = async_req_2_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE),
     113            IPC_M_USB_GET_ADDRESS,
     114            dev_handle, &address);
     115
     116        if (rc != EOK) {
     117                return rc;
     118        }
     119
     120        async_hangup(parent_phone);
     121
     122        return (usb_address_t) address;
    96123}
    97124
Note: See TracChangeset for help on using the changeset viewer.