Changeset 41e645c in mainline for uspace/lib/drv/generic/remote_usb.c


Ignore:
Timestamp:
2011-02-20T21:43:50Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
070f11e, ace12560
Parents:
423e8c81 (diff), 063ead6f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Add simple USB multi interface device driver

The MID driver serves as a mini bus driver for devices with several
interfaces or for devices with classes defined at interface level.

The keyboard driver is working with this driver with the same problems
as before introduction of USB MID driver.

The merge also includes addition of bulk transfers.

File:
1 edited

Legend:

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

    r423e8c81 r41e645c  
    4040
    4141
     42static void remote_usb_get_address(device_t *, void *, ipc_callid_t, ipc_call_t *);
     43static void remote_usb_get_interface(device_t *, void *, ipc_callid_t, ipc_call_t *);
    4244static void remote_usb_get_hc_handle(device_t *, void *, ipc_callid_t, ipc_call_t *);
    4345//static void remote_usb(device_t *, void *, ipc_callid_t, ipc_call_t *);
     
    4547/** Remote USB interface operations. */
    4648static remote_iface_func_ptr_t remote_usb_iface_ops [] = {
     49        remote_usb_get_address,
     50        remote_usb_get_interface,
    4751        remote_usb_get_hc_handle
    4852};
     
    5660};
    5761
     62
     63void remote_usb_get_address(device_t *device, void *iface,
     64    ipc_callid_t callid, ipc_call_t *call)
     65{
     66        usb_iface_t *usb_iface = (usb_iface_t *) iface;
     67
     68        if (usb_iface->get_address == NULL) {
     69                async_answer_0(callid, ENOTSUP);
     70                return;
     71        }
     72
     73        devman_handle_t handle = DEV_IPC_GET_ARG1(*call);
     74
     75        usb_address_t address;
     76        int rc = usb_iface->get_address(device, handle, &address);
     77        if (rc != EOK) {
     78                async_answer_0(callid, rc);
     79        } else {
     80                async_answer_1(callid, EOK, address);
     81        }
     82}
     83
     84void remote_usb_get_interface(device_t *device, void *iface,
     85    ipc_callid_t callid, ipc_call_t *call)
     86{
     87        usb_iface_t *usb_iface = (usb_iface_t *) iface;
     88
     89        if (usb_iface->get_interface == NULL) {
     90                async_answer_0(callid, ENOTSUP);
     91                return;
     92        }
     93
     94        devman_handle_t handle = DEV_IPC_GET_ARG1(*call);
     95
     96        int iface_no;
     97        int rc = usb_iface->get_interface(device, handle, &iface_no);
     98        if (rc != EOK) {
     99                async_answer_0(callid, rc);
     100        } else {
     101                async_answer_1(callid, EOK, iface_no);
     102        }
     103}
    58104
    59105void remote_usb_get_hc_handle(device_t *device, void *iface,
Note: See TracChangeset for help on using the changeset viewer.