Changeset 1a02517 in mainline for uspace/lib/usbhost/src/iface.c


Ignore:
Timestamp:
2011-08-25T08:53:14Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
32e093e
Parents:
3afb758
Message:

libusbhost: Streamline new hcd arch. UHCI: follow changes in libusbhost

Add endpoint registration hook.
Remove batch private data dtor from hcd_t (it should be set during initialization)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/iface.c

    r3afb758 r1a02517  
    7878        }
    7979
     80        /* No private data and no private data_dtor, these should be set by
     81         * batch_init_hook*/
    8082        usb_transfer_batch_init(batch, ep, data, NULL, size, setup_data,
    81             setup_size, in, out, arg, fun, NULL, hcd->batch_private_dtor);
    82         if (hcd->batch_private_ctor) {
    83                 batch->private_data = hcd->batch_private_ctor(batch);
    84                 if (!batch->private_data) {
    85                         ret = ENOMEM;
     83            setup_size, in, out, arg, fun, NULL, NULL);
     84        if (hcd->batch_init_hook) {
     85                ret = hcd->batch_init_hook(batch);
     86                if (ret != EOK)
    8687                        goto out;
    87                 }
    8888        } else {
    8989                usb_log_warning("Missing batch_private_data constructor!\n");
     
    199199            max_packet_size, interval);
    200200
    201         return usb_endpoint_manager_add_ep(&hcd->ep_manager, address, endpoint,
    202             direction, transfer_type, speed, max_packet_size, size);
     201        endpoint_t *ep = endpoint_get(
     202            address, endpoint, direction, transfer_type, speed, max_packet_size);
     203        if (!ep)
     204                return ENOMEM;
     205        int ret = EOK;
     206        if (hcd->ep_add_hook) {
     207                ret = hcd->ep_add_hook(ep);
     208        }
     209        if (ret != EOK) {
     210                endpoint_destroy(ep);
     211                return ret;
     212        }
     213
     214        ret = usb_endpoint_manager_register_ep(&hcd->ep_manager, ep, size);
     215        if (ret != EOK) {
     216                endpoint_destroy(ep);
     217        }
     218        return ret;
    203219}
    204220/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.