Changeset 27a0012 in mainline


Ignore:
Timestamp:
2011-02-20T17:01:39Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
18cb870
Parents:
95120c3
Message:

Add local implementation of get_interface

Location:
uspace/lib/usb
Files:
2 edited

Legend:

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

    r95120c3 r27a0012  
    122122    devman_handle_t, usb_address_t);
    123123
     124int usb_device_get_assigned_interface(device_t *);
     125
    124126int usb_endpoint_pipe_initialize(usb_endpoint_pipe_t *,
    125127    usb_device_connection_t *,
  • uspace/lib/usb/src/pipes.c

    r95120c3 r27a0012  
    6060}
    6161
     62/** Tell USB interface assigned to given device.
     63 *
     64 * @param device Device in question.
     65 * @return Interface number (negative code means any).
     66 */
     67int usb_device_get_assigned_interface(device_t *device)
     68{
     69        int parent_phone = devman_parent_device_connect(device->handle,
     70            IPC_FLAG_BLOCKING);
     71        if (parent_phone < 0) {
     72                return -1;
     73        }
     74
     75        sysarg_t iface_no;
     76        int rc = async_req_2_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE),
     77            IPC_M_USB_GET_INTERFACE,
     78            device->handle, &iface_no);
     79
     80        async_hangup(parent_phone);
     81
     82        if (rc != EOK) {
     83                return -1;
     84        }
     85
     86        return (int) iface_no;
     87}
     88
    6289/** Initialize connection to USB device.
    6390 *
Note: See TracChangeset for help on using the changeset viewer.