Changes in uspace/drv/bus/usb/usbmid/usbmid.c [4c3fef4:d5c1051] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmid/usbmid.c
r4c3fef4 rd5c1051 45 45 #include "usbmid.h" 46 46 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. 49 48 * 50 49 * @param[in] fun Device function the operation is running on. 51 * @param[out] desc Device descriptor.50 * @param[out] handle Device handle. 52 51 * @return Error code. 53 52 */ 54 static int usb_iface_description(ddf_fun_t *fun, usb_device_desc_t *desc) 53 static int 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 int usb_iface_iface_no(ddf_fun_t *fun, int *iface_no) 55 64 { 56 65 usbmid_interface_t *iface = ddf_fun_data_get(fun); 57 66 assert(iface); 58 usb_device_t *usb_dev = ddf_dev_data_get(ddf_fun_get_dev(fun));59 assert(usb_dev);60 67 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 int 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; 74 70 75 71 return EOK; … … 78 74 /** DDF interface of the child - USB functions. */ 79 75 static 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, 81 78 }; 82 79 … … 120 117 * class name something humanly understandable. 121 118 */ 122 rc= asprintf(&child_name, "%s%hhu",119 int ret = asprintf(&child_name, "%s%hhu", 123 120 usb_str_class(interface_descriptor->interface_class), 124 121 interface_descriptor->interface_number); 125 if (r c< 0) {122 if (ret < 0) { 126 123 return ENOMEM; 127 124 }
Note:
See TracChangeset
for help on using the changeset viewer.