Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/usbdrv.c

    r71ed4849 r97e660e  
    3535#include <usb/usbdrv.h>
    3636#include <usbhc_iface.h>
    37 #include <usb_iface.h>
    3837#include <errno.h>
    3938#include <str_error.h>
     
    5554} transfer_info_t;
    5655
    57 /** Find handle of host controller the device is physically attached to.
    58  *
    59  * @param[in] dev Device looking for its host controller.
    60  * @param[out] handle Host controller devman handle.
    61  * @return Error code.
    62  */
    63 int usb_drv_find_hc(device_t *dev, devman_handle_t *handle)
    64 {
    65         if (dev == NULL) {
    66                 return EBADMEM;
    67         }
    68         if (handle == NULL) {
    69                 return EBADMEM;
    70         }
    71 
    72         int parent_phone = devman_parent_device_connect(dev->handle,
    73             IPC_FLAG_BLOCKING);
    74         if (parent_phone < 0) {
    75                 return parent_phone;
    76         }
    77 
    78         devman_handle_t h;
    79         int rc = async_req_1_1(parent_phone, DEV_IFACE_ID(USB_DEV_IFACE),
    80             IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &h);
    81 
    82         ipc_hangup(parent_phone);
    83 
    84         if (rc != EOK) {
    85                 return rc;
    86         }
    87 
    88         *handle = h;
    89 
    90         return EOK;
    91 }
    92 
    93 /** Connect to host controller the device is physically attached to.
    94  *
    95  * @param dev Device asking for connection.
    96  * @param hc_handle Devman handle of the host controller.
    97  * @param flags Connection flags (blocking connection).
    98  * @return Phone to the HC or error code.
    99  */
    100 int usb_drv_hc_connect(device_t *dev, devman_handle_t hc_handle,
    101     unsigned int flags)
    102 {
    103         return devman_device_connect(hc_handle, flags);
    104 }
    105 
    10656/** Connect to host controller the device is physically attached to.
    10757 *
     
    11060 * @return Phone to corresponding HC or error code.
    11161 */
    112 int usb_drv_hc_connect_auto(device_t *dev, unsigned int flags)
    113 {
    114         int rc;
    115         devman_handle_t hc_handle;
    116 
     62int usb_drv_hc_connect(device_t *dev, unsigned int flags)
     63{
    11764        /*
    11865         * Call parent hub to obtain device handle of respective HC.
    11966         */
    120         rc = usb_drv_find_hc(dev, &hc_handle);
     67
     68        /*
     69         * FIXME: currently we connect always to virtual host controller.
     70         */
     71        int rc;
     72        devman_handle_t handle;
     73
     74        rc = devman_device_get_handle("/virt/usbhc", &handle, flags);
    12175        if (rc != EOK) {
    12276                return rc;
    12377        }
    12478       
    125         return usb_drv_hc_connect(dev, hc_handle, flags);
     79        int phone = devman_device_connect(handle, flags);
     80
     81        return phone;
    12682}
    12783
     
    13490usb_address_t usb_drv_get_my_address(int phone, device_t *dev)
    13591{
    136         sysarg_t address;
     92        ipcarg_t address;
    13793        int rc = async_req_2_1(phone, DEV_IFACE_ID(USBHC_DEV_IFACE),
    13894            IPC_M_USBHC_GET_ADDRESS,
     
    176132usb_address_t usb_drv_request_address(int phone)
    177133{
    178         sysarg_t address;
     134        ipcarg_t address;
    179135        int rc = async_req_1_1(phone, DEV_IFACE_ID(USBHC_DEV_IFACE),
    180136            IPC_M_USBHC_REQUEST_ADDRESS, &address);
     
    342298 * @return Error status.
    343299 */
    344 static int read_buffer_in(int phone, sysarg_t hash,
     300static int read_buffer_in(int phone, ipcarg_t hash,
    345301    void *buffer, size_t size, size_t *actual_size)
    346302{
    347303        ipc_call_t answer_data;
    348         sysarg_t answer_rc;
     304        ipcarg_t answer_rc;
    349305        aid_t req;
    350306        int rc;
     
    394350        transfer_info_t *transfer = (transfer_info_t *) handle;
    395351
    396         sysarg_t answer_rc;
     352        ipcarg_t answer_rc;
    397353        async_wait_for(transfer->request, &answer_rc);
    398354
     
    411367                 * We will use it when actually reading-in the data.
    412368                 */
    413                 sysarg_t buffer_hash = IPC_GET_ARG1(transfer->reply);
     369                ipcarg_t buffer_hash = IPC_GET_ARG1(transfer->reply);
    414370                if (buffer_hash == 0) {
    415371                        rc = ENOENT;
Note: See TracChangeset for help on using the changeset viewer.