Changes in uspace/drv/bus/usb/usbmid/explore.c [065064e6:5203e256] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmid/explore.c
r065064e6 r5203e256 73 73 * @param list List where to add the interfaces. 74 74 */ 75 static void create_interfaces( constuint8_t *config_descriptor,75 static void create_interfaces(uint8_t *config_descriptor, 76 76 size_t config_descriptor_size, list_t *list) 77 77 { 78 constusb_dp_parser_data_t data = {78 usb_dp_parser_data_t data = { 79 79 .data = config_descriptor, 80 80 .size = config_descriptor_size, … … 86 86 }; 87 87 88 const uint8_t *interface_ptr =89 usb_dp_get_nested_descriptor(&parser, &data,data.data);88 uint8_t *interface_ptr = usb_dp_get_nested_descriptor(&parser, &data, 89 data.data); 90 90 if (interface_ptr == NULL) { 91 91 return; … … 149 149 150 150 /* Short cuts to save on typing ;-). */ 151 const void*config_descriptor_raw = dev->descriptors.configuration;151 uint8_t *config_descriptor_raw = dev->descriptors.configuration; 152 152 size_t config_descriptor_size = dev->descriptors.configuration_size; 153 constusb_standard_configuration_descriptor_t *config_descriptor =154 config_descriptor_raw;153 usb_standard_configuration_descriptor_t *config_descriptor = 154 (usb_standard_configuration_descriptor_t *) config_descriptor_raw; 155 155 156 156 /* Select the first configuration */ … … 163 163 } 164 164 165 usb_mid_t *usb_mid = usb_device_data_alloc(dev, sizeof(usb_mid_t));166 if (!usb_mid) {167 usb_log_error("Failed to create USB MID structure.\n");168 return false;169 }170 171 165 /* Create control function */ 172 usb_mid->ctl_fun = ddf_fun_create(dev->ddf_dev, fun_exposed, "ctl");173 if ( usb_mid->ctl_fun == NULL) {166 ddf_fun_t *ctl_fun = ddf_fun_create(dev->ddf_dev, fun_exposed, "ctl"); 167 if (ctl_fun == NULL) { 174 168 usb_log_error("Failed to create control function.\n"); 175 169 return false; 176 170 } 177 171 178 usb_mid->ctl_fun->ops = &mid_device_ops;179 180 rc = ddf_fun_bind( usb_mid->ctl_fun);172 ctl_fun->ops = &mid_device_ops; 173 174 rc = ddf_fun_bind(ctl_fun); 181 175 if (rc != EOK) { 182 176 usb_log_error("Failed to bind control function: %s.\n", 183 177 str_error(rc)); 184 ddf_fun_destroy(usb_mid->ctl_fun); 185 return false; 186 } 187 178 return false; 179 } 188 180 189 181 /* Create interface children. */ 190 list_initialize(&usb_mid->interface_list); 182 list_t interface_list; 183 list_initialize(&interface_list); 191 184 create_interfaces(config_descriptor_raw, config_descriptor_size, 192 & usb_mid->interface_list);193 194 list_foreach( usb_mid->interface_list, link) {185 &interface_list); 186 187 list_foreach(interface_list, link) { 195 188 usbmid_interface_t *iface = list_get_instance(link, 196 189 usbmid_interface_t, link);
Note:
See TracChangeset
for help on using the changeset viewer.