Changeset 2c5cefa in mainline for uspace/app/usbinfo/dump.c
- Timestamp:
- 2010-12-09T14:25:39Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 99ea659c
- Parents:
- f5e39475
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/usbinfo/dump.c
rf5e39475 r2c5cefa 47 47 48 48 #define INDENT " " 49 #define BYTES_PER_LINE 12 49 50 50 51 #define BCD_INT(a) (((unsigned int)(a)) / 256) … … 53 54 #define BCD_FMT "%x.%x" 54 55 #define BCD_ARGS(a) BCD_INT((a)), BCD_FRAC((a)) 56 57 void dump_buffer(const char *msg, const uint8_t *buffer, size_t length) 58 { 59 printf("%s\n", msg); 60 61 size_t i; 62 for (i = 0; i < length; i++) { 63 printf(" 0x%02X", buffer[i]); 64 if (((i > 0) && (((i+1) % BYTES_PER_LINE) == 0)) 65 || (i + 1 == length)) { 66 printf("\n"); 67 } 68 } 69 } 55 70 56 71 void dump_standard_device_descriptor(usb_standard_device_descriptor_t *d) … … 75 90 } 76 91 92 void dump_standard_configuration_descriptor( 93 int index, usb_standard_configuration_descriptor_t *d) 94 { 95 bool self_powered = d->attributes & 64; 96 bool remote_wakeup = d->attributes & 32; 97 98 printf("Standard configuration descriptor #%d\n", index); 99 printf(INDENT "bLength = %d\n", d->length); 100 printf(INDENT "bDescriptorType = 0x%02x\n", d->descriptor_type); 101 printf(INDENT "wTotalLength = %d\n", d->total_length); 102 printf(INDENT "bNumInterfaces = %d\n", d->interface_count); 103 printf(INDENT "bConfigurationValue = %d\n", d->configuration_number); 104 printf(INDENT "iConfiguration = %d\n", d->str_configuration); 105 printf(INDENT "bmAttributes = %d [%s%s%s]\n", d->attributes, 106 self_powered ? "self-powered" : "", 107 (self_powered & remote_wakeup) ? ", " : "", 108 remote_wakeup ? "remote-wakeup" : ""); 109 printf(INDENT "MaxPower = %d (%dmA)\n", d->max_power, 110 2 * d->max_power); 111 // printf(INDENT " = %d\n", d->); 112 } 113 114 77 115 /** @} 78 116 */
Note:
See TracChangeset
for help on using the changeset viewer.