Changeset b6812a1 in mainline
- Timestamp:
- 2013-01-26T17:25:05Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ad97131
- Parents:
- 6785b538
- Location:
- uspace/lib/usbdev
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/include/usb/dev/driver.h
r6785b538 rb6812a1 59 59 typedef struct { 60 60 /** Array of alternate interfaces descriptions. */ 61 usb_alternate_interface_descriptors_t *alternatives;61 const usb_alternate_interface_descriptors_t *alternatives; 62 62 /** Size of @c alternatives array. */ 63 63 size_t alternative_count; … … 89 89 */ 90 90 int interface_no; 91 92 91 /** Alternative interfaces. */ 93 92 usb_alternate_interfaces_t alternate_interfaces; -
uspace/lib/usbdev/src/altiface.c
r6785b538 rb6812a1 105 105 } 106 106 107 alternates->alternative_count 108 = usb_interface_count_alternates(config_descr, config_descr_size, 109 interface_number); 107 const size_t alt_count =usb_interface_count_alternates(config_descr, 108 config_descr_size, interface_number); 110 109 111 if (alt ernates->alternative_count == 0) {110 if (alt_count == 0) { 112 111 return ENOENT; 113 112 } 114 113 115 alternates->alternatives = calloc(alternates->alternative_count,114 usb_alternate_interface_descriptors_t *alts = calloc(alt_count, 116 115 sizeof(usb_alternate_interface_descriptors_t)); 117 if (alt ernates->alternatives == NULL) {116 if (alts == NULL) { 118 117 return ENOMEM; 119 118 } … … 128 127 }; 129 128 130 usb_alternate_interface_descriptors_t *iterator131 = &alternates->alternatives[0];132 133 const usb_alternate_interface_descriptors_t *end134 = &alternates->alternatives[alternates->alternative_count];135 129 136 130 const void *iface_ptr = 137 131 usb_dp_get_nested_descriptor(&dp_parser, &dp_data, dp_data.data); 138 132 139 while (iface_ptr != NULL && iterator < end) { 133 usb_alternate_interface_descriptors_t *iterator = alts; 134 for (; iface_ptr != NULL && iterator < &alts[alt_count]; ++iterator) { 140 135 const usb_standard_interface_descriptor_t *iface = iface_ptr; 141 136 … … 165 160 } 166 161 162 alternates->alternatives = alts; 163 alternates->alternative_count = alt_count; 164 167 165 return EOK; 168 166 }
Note:
See TracChangeset
for help on using the changeset viewer.