Changeset 3bacee1 in mainline for uspace/lib/usb/src/dump.c
- Timestamp:
- 2018-04-12T16:27:17Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3cf22f9
- Parents:
- 76d0981d
- git-author:
- Jiri Svoboda <jiri@…> (2018-04-11 19:25:33)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-04-12 16:27:17)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/dump.c
r76d0981d r3bacee1 140 140 const uint8_t *descriptor, size_t descriptor_length) 141 141 { 142 usb_standard_device_descriptor_t *d 143 =(usb_standard_device_descriptor_t *) descriptor;142 usb_standard_device_descriptor_t *d = 143 (usb_standard_device_descriptor_t *) descriptor; 144 144 if (descriptor_length < sizeof(*d)) { 145 145 return; … … 167 167 const uint8_t *descriptor, size_t descriptor_length) 168 168 { 169 usb_standard_configuration_descriptor_t *d 170 =(usb_standard_configuration_descriptor_t *) descriptor;169 usb_standard_configuration_descriptor_t *d = 170 (usb_standard_configuration_descriptor_t *) descriptor; 171 171 if (descriptor_length < sizeof(*d)) { 172 172 return; … … 194 194 const uint8_t *descriptor, size_t descriptor_length) 195 195 { 196 usb_standard_interface_descriptor_t *d 197 =(usb_standard_interface_descriptor_t *) descriptor;196 usb_standard_interface_descriptor_t *d = 197 (usb_standard_interface_descriptor_t *) descriptor; 198 198 if (descriptor_length < sizeof(*d)) { 199 199 return; … … 205 205 PRINTLINE("bAlternateSetting = %d", d->alternate_setting); 206 206 PRINTLINE("bNumEndpoints = %d", d->endpoint_count); 207 PRINTLINE("bInterfaceClass = %s", d->interface_class == 0 208 ?"reserved (0)" : usb_str_class(d->interface_class));207 PRINTLINE("bInterfaceClass = %s", d->interface_class == 0 ? 208 "reserved (0)" : usb_str_class(d->interface_class)); 209 209 PRINTLINE("bInterfaceSubClass = %d", d->interface_subclass); 210 210 PRINTLINE("bInterfaceProtocol = %d", d->interface_protocol); … … 222 222 const uint8_t *descriptor, size_t descriptor_length) 223 223 { 224 usb_standard_endpoint_descriptor_t *d 225 =(usb_standard_endpoint_descriptor_t *) descriptor;224 usb_standard_endpoint_descriptor_t *d = 225 (usb_standard_endpoint_descriptor_t *) descriptor; 226 226 if (descriptor_length < sizeof(*d)) { 227 227 return; … … 229 229 230 230 int endpoint = d->endpoint_address & 15; 231 usb_direction_t direction = d->endpoint_address & 128 232 ?USB_DIRECTION_IN : USB_DIRECTION_OUT;231 usb_direction_t direction = d->endpoint_address & 128 ? 232 USB_DIRECTION_IN : USB_DIRECTION_OUT; 233 233 usb_transfer_type_t transfer_type = d->attributes & 3; 234 234 … … 248 248 const uint8_t *descriptor, size_t descriptor_length) 249 249 { 250 usb_superspeed_endpoint_companion_descriptor_t *d 251 =(usb_superspeed_endpoint_companion_descriptor_t *) descriptor;250 usb_superspeed_endpoint_companion_descriptor_t *d = 251 (usb_superspeed_endpoint_companion_descriptor_t *) descriptor; 252 252 if (descriptor_length < sizeof(*d)) { 253 253 return; … … 265 265 const uint8_t *descriptor, size_t descriptor_length) 266 266 { 267 usb_standard_hid_descriptor_t *d 268 =(usb_standard_hid_descriptor_t *) descriptor;267 usb_standard_hid_descriptor_t *d = 268 (usb_standard_hid_descriptor_t *) descriptor; 269 269 if (descriptor_length < sizeof(*d)) { 270 270 return; … … 282 282 /* Print info about report descriptors. */ 283 283 size_t i; 284 size_t count = (descriptor_length - sizeof(*d)) 285 /sizeof(usb_standard_hid_class_descriptor_info_t);286 usb_standard_hid_class_descriptor_info_t *d2 287 =(usb_standard_hid_class_descriptor_info_t *)284 size_t count = (descriptor_length - sizeof(*d)) / 285 sizeof(usb_standard_hid_class_descriptor_info_t); 286 usb_standard_hid_class_descriptor_info_t *d2 = 287 (usb_standard_hid_class_descriptor_info_t *) 288 288 (descriptor + sizeof(*d)); 289 289 for (i = 0; i < count; i++, d2++) { … … 308 308 d->characteristics_reserved, d->characteristics, 309 309 (d->characteristics & HUB_CHAR_NO_POWER_SWITCH_FLAG) ? 310 311 312 310 "No Power Switching" : 311 ((d->characteristics & HUB_CHAR_POWER_PER_PORT_FLAG) ? 312 "Per-Port Switching" : "Ganged Power Switching"), 313 313 (d->characteristics & HUB_CHAR_COMPOUND_DEVICE) ? 314 314 "Compound Device;" : "", 315 315 (d->characteristics & HUB_CHAR_NO_OC_FLAG) ? 316 "No OC Protection" : 317 ((d->characteristics & HUB_CHAR_OC_PER_PORT_FLAG) ? 318 "Individual Port OC Protection" : 319 "Global OC Protection") 320 ); 316 "No OC Protection" : 317 ((d->characteristics & HUB_CHAR_OC_PER_PORT_FLAG) ? 318 "Individual Port OC Protection" : 319 "Global OC Protection")); 321 320 PRINTLINE("bPwrOn2PwrGood = %d (%d ms)", 322 321 d->power_good_time, d->power_good_time * 2); … … 327 326 const uint8_t *powered_mask = descriptor + sizeof(*d) + port_bytes; 328 327 329 if (port_bytes == 0 330 ||port_bytes > (((d->port_count / (unsigned)8) + 1) * 2)) {328 if (port_bytes == 0 || 329 port_bytes > (((d->port_count / (unsigned)8) + 1) * 2)) { 331 330 PRINTLINE("::CORRUPTED DESCRIPTOR:: (%zu bytes remain)", 332 331 port_bytes * 2);
Note:
See TracChangeset
for help on using the changeset viewer.