Changeset 9e2132a in mainline
- Timestamp:
- 2012-12-30T20:14:13Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 17bbb28
- Parents:
- 6df4adc4
- Location:
- uspace/drv/bus/usb/usbmid
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmid/explore.c
r6df4adc4 r9e2132a 111 111 } 112 112 113 usbmid_interface_t *iface = malloc(sizeof(usbmid_interface_t));114 if (iface == NULL) {115 //TODO: Do something about that failure.116 break;117 }118 119 link_initialize(&iface->link);120 iface->fun = NULL;121 iface->interface_no = interface->interface_number;122 iface->interface = interface;123 124 list_append(&iface->link, list);125 113 126 114 usb_log_info("Creating child for interface %d (%s).\n", … … 128 116 usb_str_class(interface->interface_class)); 129 117 130 const int rc = usbmid_spawn_interface_child(usb_dev, iface, 118 usbmid_interface_t *iface = NULL; 119 const int rc = usbmid_spawn_interface_child(usb_dev, &iface, 131 120 &usb_dev->descriptors.device, interface); 132 121 if (rc != EOK) { 122 //TODO: Do something about that failure. 133 123 usb_log_error("Failed to create interface child for " 134 124 "%d (%s): %s.\n", interface->interface_number, 135 125 usb_str_class(interface->interface_class), 136 126 str_error(rc)); 127 } else { 128 list_append(&iface->link, list); 137 129 } 138 130 } -
uspace/drv/bus/usb/usbmid/usbmid.c
r6df4adc4 r9e2132a 30 30 * @{ 31 31 */ 32 33 /* XXX Fix this */34 #define _DDF_DATA_IMPLANT35 32 36 33 /** … … 81 78 return ret; 82 79 } 83 /* NOTE: usbmid->interface points somewhere, but we did not84 * allocate that space, so don't touch */85 80 ddf_fun_destroy(mid_iface->fun); 86 /* NOTE: mid_iface is invalid at this point, it was assigned to87 * mid_iface->fun->driver_data and freed in ddf_fun_destroy */88 81 return EOK; 89 82 } … … 98 91 */ 99 92 int usbmid_spawn_interface_child(usb_device_t *parent, 100 usbmid_interface_t * iface,93 usbmid_interface_t **iface_ret, 101 94 const usb_standard_device_descriptor_t *device_descriptor, 102 95 const usb_standard_interface_descriptor_t *interface_descriptor) … … 145 138 } 146 139 clean_match_ids(&match_ids); 140 ddf_fun_set_ops(child, &child_device_ops); 141 142 usbmid_interface_t *iface = ddf_fun_data_alloc(child, sizeof(*iface)); 143 144 iface->fun = child; 145 iface->interface_no = interface_descriptor->interface_number; 146 link_initialize(&iface->link); 147 147 148 148 rc = ddf_fun_bind(child); … … 152 152 return rc; 153 153 } 154 155 iface->fun = child; 156 ddf_fun_data_implant(child, iface); 157 ddf_fun_set_ops(child, &child_device_ops); 154 *iface_ret = iface; 158 155 159 156 return EOK; -
uspace/drv/bus/usb/usbmid/usbmid.h
r6df4adc4 r9e2132a 50 50 /** Function container. */ 51 51 ddf_fun_t *fun; 52 /** Interface descriptor. */53 const usb_standard_interface_descriptor_t *interface;54 52 /** Interface number. */ 55 53 int interface_no; … … 65 63 66 64 int usbmid_explore_device(usb_device_t *); 67 int usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t * ,65 int usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t **, 68 66 const usb_standard_device_descriptor_t *, 69 67 const usb_standard_interface_descriptor_t *);
Note:
See TracChangeset
for help on using the changeset viewer.