Changeset 20a3465 in mainline for uspace/drv/bus/usb/usbmid/explore.c
- Timestamp:
- 2011-10-30T19:50:54Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3ce78580, 48902fa
- Parents:
- 4c3ad56 (diff), 45bf63c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmid/explore.c
r4c3ad56 r20a3465 73 73 * @param list List where to add the interfaces. 74 74 */ 75 static void create_interfaces( uint8_t *config_descriptor,75 static void create_interfaces(const uint8_t *config_descriptor, 76 76 size_t config_descriptor_size, list_t *list) 77 77 { 78 usb_dp_parser_data_t data = {78 const usb_dp_parser_data_t data = { 79 79 .data = config_descriptor, 80 80 .size = config_descriptor_size, … … 86 86 }; 87 87 88 uint8_t *interface_ptr = usb_dp_get_nested_descriptor(&parser, &data,89 data.data);88 const uint8_t *interface_ptr = 89 usb_dp_get_nested_descriptor(&parser, &data, data.data); 90 90 if (interface_ptr == NULL) { 91 91 return; … … 149 149 150 150 /* Short cuts to save on typing ;-). */ 151 uint8_t*config_descriptor_raw = dev->descriptors.configuration;151 const void *config_descriptor_raw = dev->descriptors.configuration; 152 152 size_t config_descriptor_size = dev->descriptors.configuration_size; 153 usb_standard_configuration_descriptor_t *config_descriptor =154 (usb_standard_configuration_descriptor_t *)config_descriptor_raw;153 const usb_standard_configuration_descriptor_t *config_descriptor = 154 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 165 171 /* Create control function */ 166 ddf_fun_t *ctl_fun = ddf_fun_create(dev->ddf_dev, fun_exposed, "ctl");167 if ( ctl_fun == NULL) {172 usb_mid->ctl_fun = ddf_fun_create(dev->ddf_dev, fun_exposed, "ctl"); 173 if (usb_mid->ctl_fun == NULL) { 168 174 usb_log_error("Failed to create control function.\n"); 169 175 return false; 170 176 } 171 177 172 ctl_fun->ops = &mid_device_ops;173 174 rc = ddf_fun_bind( ctl_fun);178 usb_mid->ctl_fun->ops = &mid_device_ops; 179 180 rc = ddf_fun_bind(usb_mid->ctl_fun); 175 181 if (rc != EOK) { 176 182 usb_log_error("Failed to bind control function: %s.\n", 177 183 str_error(rc)); 178 return false; 179 } 184 ddf_fun_destroy(usb_mid->ctl_fun); 185 return false; 186 } 187 180 188 181 189 /* Create interface children. */ 182 list_t interface_list; 183 list_initialize(&interface_list); 190 list_initialize(&usb_mid->interface_list); 184 191 create_interfaces(config_descriptor_raw, config_descriptor_size, 185 & interface_list);186 187 list_foreach( interface_list, link) {192 &usb_mid->interface_list); 193 194 list_foreach(usb_mid->interface_list, link) { 188 195 usbmid_interface_t *iface = list_get_instance(link, 189 196 usbmid_interface_t, link);
Note:
See TracChangeset
for help on using the changeset viewer.