Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbmid/usbmid.c

    ra821f05 rb7fd2a0  
    4545#include "usbmid.h"
    4646
    47 /**
    48  * Get USB device description by calling HC and altering the interface field.
     47/** Get USB device handle by calling the parent usb_device_t.
    4948 *
    5049 * @param[in] fun Device function the operation is running on.
    51  * @param[out] desc Device descriptor.
     50 * @param[out] handle Device handle.
    5251 * @return Error code.
    5352 */
    54 static errno_t usb_iface_description(ddf_fun_t *fun, usb_device_desc_t *desc)
     53static errno_t usb_iface_device_handle(ddf_fun_t *fun, devman_handle_t *handle)
     54{
     55        assert(fun);
     56        assert(handle);
     57        usb_device_t *usb_dev = usb_device_get(ddf_fun_get_dev(fun));
     58        *handle = usb_device_get_devman_handle(usb_dev);
     59        return EOK;
     60}
     61
     62/** Callback for DDF USB get interface. */
     63static errno_t usb_iface_iface_no(ddf_fun_t *fun, int *iface_no)
    5564{
    5665        usbmid_interface_t *iface = ddf_fun_data_get(fun);
    5766        assert(iface);
    58         usb_device_t *usb_dev = ddf_dev_data_get(ddf_fun_get_dev(fun));
    59         assert(usb_dev);
    6067
    61         async_exch_t *exch = usb_device_bus_exchange_begin(usb_dev);
    62         if (!exch)
    63                 return EPARTY;
    64 
    65         usb_device_desc_t tmp_desc;
    66         const errno_t ret = usb_get_my_description(exch, &tmp_desc);
    67 
    68         if (ret == EOK && desc) {
    69                 *desc = tmp_desc;
    70                 desc->iface = iface->interface_no;
    71         }
    72 
    73         usb_device_bus_exchange_end(exch);
     68        if (iface_no)
     69                *iface_no = iface->interface_no;
    7470
    7571        return EOK;
     
    7874/** DDF interface of the child - USB functions. */
    7975static usb_iface_t child_usb_iface = {
    80         .get_my_description = usb_iface_description,
     76        .get_my_device_handle = usb_iface_device_handle,
     77        .get_my_interface = usb_iface_iface_no,
    8178};
    8279
     
    120117         * class name something humanly understandable.
    121118         */
    122         errno_t ret = asprintf(&child_name, "%s%hhu",
     119        int ret = asprintf(&child_name, "%s%hhu",
    123120            usb_str_class(interface_descriptor->interface_class),
    124121            interface_descriptor->interface_number);
Note: See TracChangeset for help on using the changeset viewer.