Changes in uspace/drv/bus/usb/usbmid/usbmid.c [b7fd2a0:a821f05] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmid/usbmid.c
rb7fd2a0 ra821f05 45 45 #include "usbmid.h" 46 46 47 /** Get USB device handle by calling the parent usb_device_t. 47 /** 48 * Get USB device description by calling HC and altering the interface field. 48 49 * 49 50 * @param[in] fun Device function the operation is running on. 50 * @param[out] handle Device handle.51 * @param[out] desc Device descriptor. 51 52 * @return Error code. 52 53 */ 53 static 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. */ 63 static errno_t usb_iface_iface_no(ddf_fun_t *fun, int *iface_no) 54 static errno_t usb_iface_description(ddf_fun_t *fun, usb_device_desc_t *desc) 64 55 { 65 56 usbmid_interface_t *iface = ddf_fun_data_get(fun); 66 57 assert(iface); 58 usb_device_t *usb_dev = ddf_dev_data_get(ddf_fun_get_dev(fun)); 59 assert(usb_dev); 67 60 68 if (iface_no) 69 *iface_no = iface->interface_no; 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); 70 74 71 75 return EOK; … … 74 78 /** DDF interface of the child - USB functions. */ 75 79 static usb_iface_t child_usb_iface = { 76 .get_my_device_handle = usb_iface_device_handle, 77 .get_my_interface = usb_iface_iface_no, 80 .get_my_description = usb_iface_description, 78 81 }; 79 82 … … 117 120 * class name something humanly understandable. 118 121 */ 119 int ret = asprintf(&child_name, "%s%hhu",122 errno_t ret = asprintf(&child_name, "%s%hhu", 120 123 usb_str_class(interface_descriptor->interface_class), 121 124 interface_descriptor->interface_number);
Note:
See TracChangeset
for help on using the changeset viewer.