Ignore:
Timestamp:
2013-07-26T13:29:05Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
059d507
Parents:
f3922c2
Message:

libusb, libdrv, libusbhost: Remove searching for dev handle by usb address

File:
1 edited

Legend:

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

    rf3922c2 rb0fc92c  
    8484 */
    8585typedef enum {
    86         /** Get handle binded with given USB address.
    87          * Parameters
    88          * - USB address
    89          * Answer:
    90          * - EOK - address binded, first parameter is the devman handle
    91          * - ENOENT - address is not in use at the moment
    92          */
    93         IPC_M_USBHC_GET_HANDLE_BY_ADDRESS,
    94 
    9586        /** Register endpoint attributes at host controller.
    9687         * This is used to reserve portion of USB bandwidth.
     
    131122} usbhc_iface_funcs_t;
    132123
    133 
    134 
    135 int usbhc_get_handle(async_exch_t *exch, usb_address_t address,
    136     devman_handle_t *handle)
    137 {
    138         if (!exch)
    139                 return EBADMEM;
    140         sysarg_t h;
    141         const int ret = async_req_2_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    142             IPC_M_USBHC_GET_HANDLE_BY_ADDRESS, address, &h);
    143         if (ret == EOK && handle)
    144                 *handle = (devman_handle_t)h;
    145         return ret;
    146 }
    147 
    148124int usbhc_register_endpoint(async_exch_t *exch, usb_address_t address,
    149125    usb_endpoint_t endpoint, usb_transfer_type_t type,
     
    265241
    266242
    267 static void remote_usbhc_get_handle(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    268243static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    269244static void remote_usbhc_unregister_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     
    274249/** Remote USB host controller interface operations. */
    275250static remote_iface_func_ptr_t remote_usbhc_iface_ops[] = {
    276         [IPC_M_USBHC_GET_HANDLE_BY_ADDRESS] = remote_usbhc_get_handle,
    277 
    278251        [IPC_M_USBHC_REGISTER_ENDPOINT] = remote_usbhc_register_endpoint,
    279252        [IPC_M_USBHC_UNREGISTER_ENDPOINT] = remote_usbhc_unregister_endpoint,
     
    322295        return trans;
    323296}
    324 
    325 
    326 void remote_usbhc_get_handle(ddf_fun_t *fun, void *iface,
    327     ipc_callid_t callid, ipc_call_t *call)
    328 {
    329         const usbhc_iface_t *usb_iface = iface;
    330 
    331         if (!usb_iface->get_handle) {
    332                 async_answer_0(callid, ENOTSUP);
    333                 return;
    334         }
    335 
    336         const usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
    337         devman_handle_t handle;
    338         const int ret = usb_iface->get_handle(fun, address, &handle);
    339 
    340         if (ret == EOK) {
    341                 async_answer_1(callid, ret, handle);
    342         } else {
    343                 async_answer_0(callid, ret);
    344         }
    345 }
    346 
    347297
    348298static void callback_out(int outcome, void *arg)
Note: See TracChangeset for help on using the changeset viewer.