Changeset 9d15d1b in mainline


Ignore:
Timestamp:
2013-08-02T13:04:47Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8e4219ab
Parents:
7c10198
Message:

libdrv: add device handle query

Location:
uspace/lib/drv
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_usb.c

    r7c10198 r9d15d1b  
    7070        IPC_M_USB_GET_MY_INTERFACE,
    7171        IPC_M_USB_GET_HOST_CONTROLLER_HANDLE,
     72        IPC_M_USB_GET_DEVICE_HANDLE,
    7273        IPC_M_USB_RESERVE_DEFAULT_ADDRESS,
    7374        IPC_M_USB_RELEASE_DEFAULT_ADDRESS,
     
    131132}
    132133
     134/** Tell devman handle of the usb device function.
     135 * @param[in] exch IPC communication exchange
     136 * @param[out] handle devman handle of the HC used by the target device.
     137 * @return Error code.
     138 */
     139int usb_get_device_handle(async_exch_t *exch, devman_handle_t *handle)
     140{
     141        devman_handle_t h = 0;
     142        const int ret = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
     143            IPC_M_USB_GET_DEVICE_HANDLE, &h);
     144        if (ret == EOK && handle)
     145                *handle = (devman_handle_t)h;
     146        return ret;
     147}
     148
    133149/** Reserve default USB address.
    134150 * @param[in] exch IPC communication exchange
     
    213229static void remote_usb_get_my_interface(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    214230static void remote_usb_get_hc_handle(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     231static void remote_usb_get_device_handle(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    215232
    216233static void remote_usb_reserve_default_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     
    226243        [IPC_M_USB_GET_MY_INTERFACE] = remote_usb_get_my_interface,
    227244        [IPC_M_USB_GET_HOST_CONTROLLER_HANDLE] = remote_usb_get_hc_handle,
     245        [IPC_M_USB_GET_DEVICE_HANDLE] = remote_usb_get_device_handle,
    228246        [IPC_M_USB_RESERVE_DEFAULT_ADDRESS] = remote_usb_reserve_default_address,
    229247        [IPC_M_USB_RELEASE_DEFAULT_ADDRESS] = remote_usb_release_default_address,
     
    299317}
    300318
     319void remote_usb_get_device_handle(ddf_fun_t *fun, void *iface,
     320    ipc_callid_t callid, ipc_call_t *call)
     321{
     322        const usb_iface_t *usb_iface = (usb_iface_t *) iface;
     323
     324        if (usb_iface->get_device_handle == NULL) {
     325                async_answer_0(callid, ENOTSUP);
     326                return;
     327        }
     328
     329        devman_handle_t handle;
     330        const int ret = usb_iface->get_device_handle(fun, &handle);
     331        if (ret != EOK) {
     332                async_answer_0(callid, ret);
     333        }
     334
     335        async_answer_1(callid, EOK, (sysarg_t) handle);
     336}
     337
    301338void remote_usb_reserve_default_address(ddf_fun_t *fun, void *iface,
    302339    ipc_callid_t callid, ipc_call_t *call)
  • uspace/lib/drv/include/usb_iface.h

    r7c10198 r9d15d1b  
    5555int usb_get_my_interface(async_exch_t *, int *);
    5656int usb_get_hc_handle(async_exch_t *, devman_handle_t *);
     57int usb_get_device_handle(async_exch_t *, devman_handle_t *);
    5758
    5859int usb_reserve_default_address(async_exch_t *, usb_speed_t);
     
    7273        int (*get_hc_handle)(ddf_fun_t *, devman_handle_t *);
    7374
     75        int (*get_device_handle)(ddf_fun_t *, devman_handle_t *);
     76
    7477        int (*reserve_default_address)(ddf_fun_t *, usb_speed_t);
    7578        int (*release_default_address)(ddf_fun_t *);
Note: See TracChangeset for help on using the changeset viewer.