FreeCalypso > hg > fc-usbser-tools
changeset 89:cddf60418f98
cp2102-decode-ee-desc: decode endpoint descriptors
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 27 Sep 2023 20:00:56 +0000 |
parents | ea7b411aad27 |
children | 3bde280f0986 |
files | cp2102/decode_usb_desc.c |
diffstat | 1 files changed, 23 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/cp2102/decode_usb_desc.c Wed Sep 27 19:39:44 2023 +0000 +++ b/cp2102/decode_usb_desc.c Wed Sep 27 20:00:56 2023 +0000 @@ -77,6 +77,24 @@ printf(" iInterface: %u\n", desc[8]); } +static void +print_endpoint_desc(desc) + u_char *desc; +{ + printf(" bLength: %u", desc[0]); + if (desc[0] != 7) + fputs(" (WRONG!)", stdout); + putchar('\n'); + printf(" bDescriptorType: 0x%02X", desc[1]); + if (desc[1] != 0x05) + fputs(" (WRONG!)", stdout); + putchar('\n'); + printf(" bEndpointAddress: 0x%02X\n", desc[2]); + printf(" bmAttributes: 0x%02X\n", desc[3]); + printf(" wMaxPacketSize: %u\n", desc[4] | (desc[5] << 8)); + printf(" bInterval: %u\n", desc[6]); +} + main(argc, argv) char **argv; { @@ -91,6 +109,10 @@ print_config_desc(eeprom + 0x39A); printf("USB interface descriptor at 0x39A3:\n"); print_interf_desc(eeprom + 0x3A3); - /* decoding of other descriptors remains to be implemented */ + printf("USB endpoint descriptor at 0x39AC:\n"); + print_endpoint_desc(eeprom + 0x3AC); + printf("USB endpoint descriptor at 0x39B3:\n"); + print_endpoint_desc(eeprom + 0x3B3); + /* decoding of string descriptors remains to be implemented */ exit(0); }