Changeset 54464f6a in mainline for uspace/lib/usb/src


Ignore:
Timestamp:
2011-11-11T19:48:33Z (14 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
50a01a9
Parents:
c2e50d7 (diff), 747ef72 (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:

merge mainline changes

Location:
uspace/lib/usb/src
Files:
4 edited

Legend:

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

    rc2e50d7 r54464f6a  
    8181                        return "application";
    8282                case USB_CLASS_VENDOR_SPECIFIC:
    83                         return "vendor";
     83                        return "vendor-specific";
    8484                default:
    8585                        return "unknown";
  • uspace/lib/usb/src/ddfiface.c

    rc2e50d7 r54464f6a  
    3939#include <usb/hc.h>
    4040#include <usb/debug.h>
     41#include <usb/dev/hub.h>
    4142#include <errno.h>
    4243#include <assert.h>
    4344
    4445/** DDF interface for USB device, implementation for typical hub. */
    45 usb_iface_t  usb_iface_hub_impl = {
    46         .get_hc_handle = usb_iface_get_hc_handle_hub_impl,
    47         .get_address = usb_iface_get_address_hub_impl
     46usb_iface_t usb_iface_hub_impl = {
     47        .get_hc_handle = usb_iface_get_hc_handle_device_impl,
     48        .get_my_address = usb_iface_get_my_address_forward_impl,
    4849};
    4950
    5051/** DDF interface for USB device, implementation for child of a typical hub. */
    51 usb_iface_t  usb_iface_hub_child_impl = {
    52         .get_hc_handle = usb_iface_get_hc_handle_hub_child_impl,
    53         .get_address = usb_iface_get_address_hub_child_impl
     52usb_iface_t usb_iface_hub_child_impl = {
     53        .get_hc_handle = usb_iface_get_hc_handle_device_impl,
     54        .get_my_address = usb_iface_get_my_address_from_device_data,
    5455};
    5556
     
    6162 * @return Error code.
    6263 */
    63 int usb_iface_get_hc_handle_hub_impl(ddf_fun_t *fun, devman_handle_t *handle)
     64int usb_iface_get_hc_handle_device_impl(ddf_fun_t *fun, devman_handle_t *handle)
    6465{
    6566        assert(fun);
    6667        return usb_hc_find(fun->handle, handle);
    67 }
    68 
    69 /** Get host controller handle, interface implementation for child of
    70  * a hub driver.
    71  *
    72  * @param[in] fun Device function the operation is running on.
    73  * @param[out] handle Storage for the host controller handle.
    74  * @return Error code.
    75  */
    76 int usb_iface_get_hc_handle_hub_child_impl(ddf_fun_t *fun,
    77     devman_handle_t *handle)
    78 {
    79         assert(fun != NULL);
    80        
    81         async_sess_t *parent_sess =
    82             devman_parent_device_connect(EXCHANGE_SERIALIZE, fun->handle,
    83             IPC_FLAG_BLOCKING);
    84         if (!parent_sess)
    85                 return ENOMEM;
    86        
    87         async_exch_t *exch = async_exchange_begin(parent_sess);
    88        
    89         sysarg_t hc_handle;
    90         int rc = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
    91             IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &hc_handle);
    92        
    93         async_exchange_end(exch);
    94         async_hangup(parent_sess);
    95        
    96         if (rc != EOK)
    97                 return rc;
    98        
    99         *handle = hc_handle;
    100         return EOK;
    10168}
    10269
     
    12592 * @return Error code.
    12693 */
    127 int usb_iface_get_address_hub_impl(ddf_fun_t *fun, devman_handle_t handle,
     94int usb_iface_get_my_address_forward_impl(ddf_fun_t *fun,
    12895    usb_address_t *address)
    12996{
    13097        assert(fun);
    131        
     98
    13299        async_sess_t *parent_sess =
    133100            devman_parent_device_connect(EXCHANGE_SERIALIZE, fun->handle,
     
    135102        if (!parent_sess)
    136103                return ENOMEM;
    137        
     104
    138105        async_exch_t *exch = async_exchange_begin(parent_sess);
    139        
     106
    140107        sysarg_t addr;
    141         int rc = async_req_2_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
    142             IPC_M_USB_GET_ADDRESS, handle, &addr);
    143        
     108        int rc = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
     109            IPC_M_USB_GET_MY_ADDRESS, &addr);
     110
    144111        async_exchange_end(exch);
    145112        async_hangup(parent_sess);
    146        
     113
    147114        if (rc != EOK)
    148115                return rc;
    149        
     116
    150117        if (address != NULL)
    151118                *address = (usb_address_t) addr;
    152        
     119
    153120        return EOK;
    154121}
     
    157124 * a hub driver.
    158125 *
     126 * This implementation eccepts 0 as valid handle and replaces it with fun's
     127 * handle.
     128 *
    159129 * @param[in] fun Device function the operation is running on.
    160130 * @param[in] handle Devman handle of USB device we want address of.
     
    162132 * @return Error code.
    163133 */
    164 int usb_iface_get_address_hub_child_impl(ddf_fun_t *fun,
    165     devman_handle_t handle, usb_address_t *address)
     134int usb_iface_get_my_address_from_device_data(ddf_fun_t *fun,
     135    usb_address_t *address)
    166136{
    167         if (handle == 0) {
    168                 handle = fun->handle;
    169         }
    170         return usb_iface_get_address_hub_impl(fun, handle, address);
     137        assert(fun);
     138        assert(fun->driver_data);
     139        usb_hub_attached_device_t *device = fun->driver_data;
     140        assert(device->fun == fun);
     141        if (address)
     142                *address = device->address;
     143        return EOK;
    171144}
    172145
  • uspace/lib/usb/src/hc.c

    rc2e50d7 r54464f6a  
    174174 * @return USB address or negative error code.
    175175 */
    176 usb_address_t usb_hc_get_address_by_handle(devman_handle_t dev_handle)
     176usb_address_t usb_get_address_by_handle(devman_handle_t dev_handle)
    177177{
    178178        async_sess_t *parent_sess =
     
    185185       
    186186        sysarg_t address;
    187         int rc = async_req_2_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
    188             IPC_M_USB_GET_ADDRESS,
    189             dev_handle, &address);
     187        int rc = async_req_1_1(exch, DEV_IFACE_ID(USB_DEV_IFACE),
     188            IPC_M_USB_GET_MY_ADDRESS, &address);
    190189       
    191190        async_exchange_end(exch);
  • uspace/lib/usb/src/resolve.c

    rc2e50d7 r54464f6a  
    200200                /* Try to get its address. */
    201201                if (!found_addr) {
    202                         dev_addr = usb_hc_get_address_by_handle(tmp_handle);
     202                        dev_addr = usb_get_address_by_handle(tmp_handle);
    203203                        if (dev_addr >= 0) {
    204204                                found_addr = true;
Note: See TracChangeset for help on using the changeset viewer.