Changeset c280d7e in mainline for uspace/lib/usbhost/src/ddf_helpers.c


Ignore:
Timestamp:
2018-01-20T03:02:36Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
60d3f35
Parents:
3cdaa7f
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-20 03:02:32)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-20 03:02:36)
Message:

libdrv: usb iface callbacks joined

In addition to handle and current interface, it is good for the device
to know its address and speed. Also, it is expected to add some other
fields (stats, info tied to devices of specific speed and so on) in the
future. Instead of adding yet another call, join those two and let HC
fill a description structure.

File:
1 edited

Legend:

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

    r3cdaa7f rc280d7e  
    224224}
    225225
    226 /** Gets handle of the respective device.
     226/**
     227 * Gets description of the device that is calling.
    227228 *
    228229 * @param[in] fun Device function.
    229  * @param[out] handle Place to write the handle.
     230 * @param[out] desc Device descriptor to be filled.
    230231 * @return Error code.
    231232 */
    232 static int get_my_device_handle(ddf_fun_t *fun, devman_handle_t *handle)
    233 {
    234         assert(fun);
    235         if (handle)
    236                 *handle = ddf_fun_get_handle(fun);
     233static int get_device_description(ddf_fun_t *fun, usb_device_desc_t *desc)
     234{
     235        assert(fun);
     236        device_t *dev = ddf_fun_data_get(fun);
     237        assert(dev);
     238
     239        if (!desc)
     240                return EOK;
     241
     242        *desc = (usb_device_desc_t) {
     243                .address = dev->address,
     244                .speed = dev->speed,
     245                .handle = ddf_fun_get_handle(fun),
     246                .iface = -1,
     247        };
    237248        return EOK;
    238249}
     
    290301/** USB device interface */
    291302static usb_iface_t usb_iface = {
    292         .get_my_device_handle = get_my_device_handle,
     303        .get_my_description = get_device_description,
    293304};
    294305
Note: See TracChangeset for help on using the changeset viewer.