Changeset 229629d in mainline
- Timestamp:
- 2011-10-13T21:24:40Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 344a0ac
- Parents:
- 359d96f
- Location:
- uspace/drv/bus/usb/usbmid
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmid/explore.c
r359d96f r229629d 163 163 } 164 164 165 usb_mid_t *usb_mid = malloc(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 return false; 170 } 171 172 ctl_fun->ops = &mid_device_ops; 173 174 rc = ddf_fun_bind(ctl_fun); 175 free(usb_mid); 176 return false; 177 } 178 179 usb_mid->ctl_fun->ops = &mid_device_ops; 180 181 rc = ddf_fun_bind(usb_mid->ctl_fun); 175 182 if (rc != EOK) { 176 ddf_fun_destroy(ctl_fun);177 183 usb_log_error("Failed to bind control function: %s.\n", 178 184 str_error(rc)); 179 return false; 180 } 185 ddf_fun_destroy(usb_mid->ctl_fun); 186 free(usb_mid); 187 return false; 188 } 189 181 190 182 191 /* Create interface children. */ 183 list_t interface_list; 184 list_initialize(&interface_list); 192 list_initialize(&usb_mid->interface_list); 185 193 create_interfaces(config_descriptor_raw, config_descriptor_size, 186 & interface_list);187 188 list_foreach( interface_list, link) {194 &usb_mid->interface_list); 195 196 list_foreach(usb_mid->interface_list, link) { 189 197 usbmid_interface_t *iface = list_get_instance(link, 190 198 usbmid_interface_t, link); … … 201 209 } 202 210 } 211 dev->driver_data = usb_mid; 203 212 204 213 return true; -
uspace/drv/bus/usb/usbmid/usbmid.h
r359d96f r229629d 58 58 } usbmid_interface_t; 59 59 60 /** Container to hold all the function pointers */ 61 typedef struct usb_mid { 62 ddf_fun_t *ctl_fun; 63 list_t interface_list; 64 } usb_mid_t; 65 60 66 bool usbmid_explore_device(usb_device_t *); 61 67 int usbmid_spawn_interface_child(usb_device_t *, usbmid_interface_t *,
Note:
See TracChangeset
for help on using the changeset viewer.