Changeset 6f53811 in mainline
- Timestamp:
- 2013-01-06T00:28:15Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f3185a5
- Parents:
- 1da979d
- Location:
- uspace/lib/usb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/classes/hub.h
r1da979d r6f53811 75 75 #define HUB_CHAR_POWER_PER_PORT_FLAG (1 << 0) 76 76 #define HUB_CHAR_NO_POWER_SWITCH_FLAG (1 << 1) 77 #define HUB_CHAR_COMP UND_DEVICE(1 << 2)77 #define HUB_CHAR_COMPOUND_DEVICE (1 << 2) 78 78 #define HUB_CHAR_OC_PER_PORT_FLAG (1 << 3) 79 79 #define HUB_CHAR_NO_OC_FLAG (1 << 4) -
uspace/lib/usb/src/dump.c
r1da979d r6f53811 41 41 #include <usb/descriptor.h> 42 42 #include <usb/classes/classes.h> 43 #include <usb/classes/hub.h> 43 44 44 45 /** Mapping between descriptor id and dumping function. */ … … 276 277 const uint8_t *descriptor, size_t descriptor_length) 277 278 { 278 /* TODO */ 279 usb_hub_descriptor_header_t *d = 280 (usb_hub_descriptor_header_t *) descriptor; 281 if (descriptor_length < sizeof(d)) 282 return; 283 284 PRINTLINE("bDescLength: = %d", d->length); 285 PRINTLINE("bDescriptorType = 0x%02x", d->descriptor_type); 286 PRINTLINE("bNbrPorts = %d", d->port_count); 287 PRINTLINE("bHubCharacteristics = 0x%02x%02x (%s;%s%s)", 288 d->characteristics_reserved, d->characteristics, 289 (d->characteristics & HUB_CHAR_NO_POWER_SWITCH_FLAG) ? 290 "No Power Switching" : 291 ((d->characteristics & HUB_CHAR_POWER_PER_PORT_FLAG) ? 292 "Per-Port Switching" : "Ganged Power Switching"), 293 (d->characteristics & HUB_CHAR_COMPOUND_DEVICE) ? 294 "Compound Device;" : "", 295 (d->characteristics & HUB_CHAR_NO_OC_FLAG) ? 296 "No OC Protection" : 297 ((d->characteristics & HUB_CHAR_OC_PER_PORT_FLAG) ? 298 "Individual Port OC Protection" : 299 "Global OC Protection") 300 ); 301 PRINTLINE("bPwrOn2PwrGood = %d (%d ms)", 302 d->power_good_time, d->power_good_time * 2); 303 PRINTLINE("bHubContrCurrent = %d (%d mA)", 304 d->max_current, d->max_current); 305 const size_t port_bytes = (descriptor_length - sizeof(*d)) / 2; 306 const uint8_t *removable_mask = descriptor + sizeof(*d); 307 const uint8_t *powered_mask = descriptor + sizeof(*d) + port_bytes; 308 309 if (port_bytes == 0 310 || port_bytes > (((d->port_count / (unsigned)8) + 1) * 2)) { 311 PRINTLINE("::CORRUPTED DESCRIPTOR:: (%zu bytes remain)", 312 port_bytes * 2); 313 } 314 315 fprintf(output, "%sDeviceRemovable = 0x", 316 line_prefix ? line_prefix : " - "); 317 for (unsigned i = port_bytes; i > 0; --i) 318 fprintf(output, "%02x", removable_mask[i - 1]); 319 fprintf(output, " (0b1 - Device non-removable)%s", 320 line_suffix ? line_suffix : "\n"); 321 322 fprintf(output, "%sPortPwrCtrlMask = 0x", 323 line_prefix ? line_prefix : " - "); 324 for (unsigned i = port_bytes; i > 0; --i) 325 fprintf(output, "%02x", powered_mask[i - 1]); 326 fprintf(output, " (Legacy - All should be 0b1)%s", 327 line_suffix ? line_suffix : "\n"); 279 328 } 280 329
Note:
See TracChangeset
for help on using the changeset viewer.