Changeset eb2f7dd in mainline


Ignore:
Timestamp:
2011-05-08T13:37:51Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
df25ab6
Parents:
84de606d
Message:

Add getting handle by address over USBHC iface

Location:
uspace/lib
Files:
4 edited

Legend:

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

    r84de606d reb2f7dd  
    5252static void remote_usbhc_request_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5353static void remote_usbhc_bind_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     54static void remote_usbhc_find_by_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5455static void remote_usbhc_release_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
    5556static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     
    6162        remote_usbhc_request_address,
    6263        remote_usbhc_bind_address,
     64        remote_usbhc_find_by_address,
    6365        remote_usbhc_release_address,
    6466
     
    161163
    162164        async_answer_0(callid, rc);
     165}
     166
     167void remote_usbhc_find_by_address(ddf_fun_t *fun, void *iface,
     168    ipc_callid_t callid, ipc_call_t *call)
     169{
     170        usbhc_iface_t *usb_iface = (usbhc_iface_t *) iface;
     171
     172        if (!usb_iface->find_by_address) {
     173                async_answer_0(callid, ENOTSUP);
     174                return;
     175        }
     176
     177        usb_address_t address = (usb_address_t) DEV_IPC_GET_ARG1(*call);
     178        devman_handle_t handle;
     179        int rc = usb_iface->find_by_address(fun, address, &handle);
     180
     181        if (rc == EOK) {
     182                async_answer_1(callid, EOK, handle);
     183        } else {
     184                async_answer_0(callid, rc);
     185        }
    163186}
    164187
  • uspace/lib/drv/include/usbhc_iface.h

    r84de606d reb2f7dd  
    105105        IPC_M_USBHC_BIND_ADDRESS,
    106106
     107        /** Get handle binded with given USB address.
     108         * Parameters
     109         * - USB address
     110         * Answer:
     111         * - EOK - address binded, first parameter is the devman handle
     112         * - ENOENT - address is not in use at the moment
     113         */
     114        IPC_M_USBHC_GET_HANDLE_BY_ADDRESS,
     115
    107116        /** Release address in use.
    108117         * Arguments:
     
    207216        int (*request_address)(ddf_fun_t *, usb_speed_t, usb_address_t *);
    208217        int (*bind_address)(ddf_fun_t *, usb_address_t, devman_handle_t);
     218        int (*find_by_address)(ddf_fun_t *, usb_address_t, devman_handle_t *);
    209219        int (*release_address)(ddf_fun_t *, usb_address_t);
    210220
  • uspace/lib/usb/include/usb/hub.h

    r84de606d reb2f7dd  
    6363    const usb_hc_attached_device_t *);
    6464int usb_hc_unregister_device(usb_hc_connection_t *, usb_address_t);
     65int usb_hc_get_handle_by_address(usb_hc_connection_t *, usb_address_t,
     66    devman_handle_t *);
    6567
    6668#endif
  • uspace/lib/usb/src/hub.c

    r84de606d reb2f7dd  
    117117            DEV_IFACE_ID(USBHC_DEV_IFACE),
    118118            IPC_M_USBHC_RELEASE_ADDRESS, address);
     119}
     120
     121/** Get handle of USB device with given address.
     122 *
     123 * @param[in] connection Opened connection to host controller.
     124 * @param[in] address Address of device in question.
     125 * @param[out] handle Where to write the device handle.
     126 * @return Error code.
     127 */
     128int usb_hc_get_handle_by_address(usb_hc_connection_t *connection,
     129    usb_address_t address, devman_handle_t *handle)
     130{
     131        CHECK_CONNECTION(connection);
     132
     133        sysarg_t tmp;
     134        int rc = async_req_2_1(connection->hc_phone,
     135            DEV_IFACE_ID(USBHC_DEV_IFACE),
     136            IPC_M_USBHC_GET_HANDLE_BY_ADDRESS,
     137            address, &tmp);
     138        if ((rc == EOK) && (handle != NULL)) {
     139                *handle = tmp;
     140        }
     141
     142        return rc;
    119143}
    120144
Note: See TracChangeset for help on using the changeset viewer.