From owner-p4-projects@FreeBSD.ORG Wed Jul 15 18:54:11 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 561531065673; Wed, 15 Jul 2009 18:54:11 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15C0D106566C for ; Wed, 15 Jul 2009 18:54:11 +0000 (UTC) (envelope-from syl@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 02C3F8FC15 for ; Wed, 15 Jul 2009 18:54:11 +0000 (UTC) (envelope-from syl@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n6FIsAmS028271 for ; Wed, 15 Jul 2009 18:54:10 GMT (envelope-from syl@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n6FIsAuv028269 for perforce@freebsd.org; Wed, 15 Jul 2009 18:54:10 GMT (envelope-from syl@FreeBSD.org) Date: Wed, 15 Jul 2009 18:54:10 GMT Message-Id: <200907151854.n6FIsAuv028269@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to syl@FreeBSD.org using -f From: Sylvestre Gallon To: Perforce Change Reviews Cc: Subject: PERFORCE change 166146 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jul 2009 18:54:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=166146 Change 166146 by syl@syl_atuin on 2009/07/15 18:53:49 Update testing for dumping extra_descriptors. Affected files ... .. //depot/projects/soc2009/syl_usb/libusb-tests/descriptors/test2/test2.c#5 edit .. //depot/projects/soc2009/syl_usb/libusb-tests/descriptors/test3/test3.c#4 edit .. //depot/projects/soc2009/syl_usb/libusb-tests/descriptors/test4/test4.c#3 edit .. //depot/projects/soc2009/syl_usb/libusb-tests/descriptors/test5/test5.c#4 edit Differences ... ==== //depot/projects/soc2009/syl_usb/libusb-tests/descriptors/test2/test2.c#5 (text+ko) ==== @@ -5,6 +5,24 @@ libusb_context *ctx; +void +dump_extra(char *str, uint8_t *extra, int extra_length) +{ + int i; + + if (extra_length == 0) + return ; + printf("%sextra descriptor\n%s0x%.4x : ", str, str, 0); + for (i = 0 ; i < extra_length ; ) { + printf("0x%.2x ", extra[i]); + i++; + if (i != 0 && (i % 0x10) == 0) { + printf("\n%s0x%.4x : ", str, i); + } + } + printf("\n"); +} + int main(int ac, const char *av[]) { @@ -48,7 +66,9 @@ printf("|---- bConfigurationValue : 0x%.2x\n", cdesc->bConfigurationValue); printf("|---- iConfiguration : 0x%.2x\n", cdesc->iConfiguration); printf("|---- bmAttributes : 0x%.2x\n", cdesc->bmAttributes); - printf("|---- MaxPower : 0x%.2x\n|\n", cdesc->MaxPower); + printf("|---- MaxPower : 0x%.2x\n", cdesc->MaxPower); + dump_extra("|---- ", cdesc->extra, cdesc->extra_length); + printf("|\n"); for (j = 0 ; j < cdesc->bNumInterfaces ; j++) { for (k = 0 ; k < cdesc->interface[j].num_altsetting ; k++) { idesc = &cdesc->interface[j].altsetting[k]; @@ -62,7 +82,9 @@ printf("|------ bInterfaceClass 0x%.2x\n", idesc->bInterfaceClass); printf("|------ bInterfaceSubClass 0x%.2x\n", idesc->bInterfaceSubClass); printf("|------ bInterfaceProtocol 0x%.2x\n", idesc->bInterfaceProtocol); - printf("|------ iInterface 0x%.2x\n|\n", idesc->iInterface); + printf("|------ iInterface 0x%.2x\n", idesc->iInterface); + dump_extra("|------ ", idesc->extra, idesc->extra_length); + printf("|\n"); for (l = 0 ; l < idesc->bNumEndpoints ; l++) { edesc = &idesc->endpoint[l]; printf("|-------- DESCRIPTOR :\n"); @@ -73,7 +95,9 @@ printf("|-------- wMaxPacketSize 0x%.4x\n", edesc->wMaxPacketSize); printf("|-------- bInterval 0x%.2x\n", edesc->bInterval); printf("|-------- bRefresh 0x%.2x\n", edesc->bRefresh); - printf("|-------- bSynchAddress 0x%.2x\n|\n", edesc->bSynchAddress); + printf("|-------- bSynchAddress 0x%.2x\n", edesc->bSynchAddress); + dump_extra("|-------- ", edesc->extra, edesc->extra_length); + printf("|\n"); } } } ==== //depot/projects/soc2009/syl_usb/libusb-tests/descriptors/test3/test3.c#4 (text+ko) ==== @@ -5,6 +5,24 @@ libusb_context *ctx; +void +dump_extra(char *str, uint8_t *extra, int extra_length) +{ + int i; + + if (extra_length == 0) + return ; + printf("%sextra descriptor\n%s0x%.4x : ", str, str, 0); + for (i = 0 ; i < extra_length ; ) { + printf("0x%.2x ", extra[i]); + i++; + if (i != 0 && (i % 0x10) == 0) { + printf("\n%s0x%.4x : ", str, i); + } + } + printf("\n"); +} + int main(int ac, const char *av[]) { @@ -57,7 +75,9 @@ printf("|---- bConfigurationValue : 0x%.2x\n", cdesc->bConfigurationValue); printf("|---- iConfiguration : 0x%.2x\n", cdesc->iConfiguration); printf("|---- bmAttributes : 0x%.2x\n", cdesc->bmAttributes); - printf("|---- MaxPower : 0x%.2x\n|\n", cdesc->MaxPower); + printf("|---- MaxPower : 0x%.2x\n", cdesc->MaxPower); + dump_extra("|---- ", cdesc->extra, cdesc->extra_length); + printf("|\n"); for (j = 0 ; j < cdesc->bNumInterfaces ; j++) { for (k = 0 ; k < cdesc->interface[j].num_altsetting ; k++) { idesc = &cdesc->interface[j].altsetting[k]; @@ -71,7 +91,9 @@ printf("|------ bInterfaceClass 0x%.2x\n", idesc->bInterfaceClass); printf("|------ bInterfaceSubClass 0x%.2x\n", idesc->bInterfaceSubClass); printf("|------ bInterfaceProtocol 0x%.2x\n", idesc->bInterfaceProtocol); - printf("|------ iInterface 0x%.2x\n|\n", idesc->iInterface); + printf("|------ iInterface 0x%.2x\n", idesc->iInterface); + dump_extra("|------ ", idesc->extra, idesc->extra_length); + printf("|\n"); for (l = 0 ; l < idesc->bNumEndpoints ; l++) { edesc = &idesc->endpoint[l]; printf("|-------- DESCRIPTOR :\n"); @@ -82,7 +104,9 @@ printf("|-------- wMaxPacketSize 0x%.4x\n", edesc->wMaxPacketSize); printf("|-------- bInterval 0x%.2x\n", edesc->bInterval); printf("|-------- bRefresh 0x%.2x\n", edesc->bRefresh); - printf("|-------- bSynchAddress 0x%.2x\n|\n", edesc->bSynchAddress); + printf("|-------- bSynchAddress 0x%.2x\n", edesc->bSynchAddress); + dump_extra("|-------- ", edesc->extra, edesc->extra_length); + printf("|\n"); } } } ==== //depot/projects/soc2009/syl_usb/libusb-tests/descriptors/test4/test4.c#3 (text+ko) ==== @@ -5,6 +5,24 @@ libusb_context *ctx; +void +dump_extra(char *str, uint8_t *extra, int extra_length) +{ + int i; + + if (extra_length == 0) + return ; + printf("%sextra descriptor\n%s0x%.4x : ", str, str, 0); + for (i = 0 ; i < extra_length ; ) { + printf("0x%.2x ", extra[i]); + i++; + if (i != 0 && (i % 0x10) == 0) { + printf("\n%s0x%.4x : ", str, i); + } + } + printf("\n"); +} + int main(int ac, const char *av[]) { @@ -48,7 +66,9 @@ printf("|---- bConfigurationValue : 0x%.2x\n", cdesc->bConfigurationValue); printf("|---- iConfiguration : 0x%.2x\n", cdesc->iConfiguration); printf("|---- bmAttributes : 0x%.2x\n", cdesc->bmAttributes); - printf("|---- MaxPower : 0x%.2x\n|\n", cdesc->MaxPower); + printf("|---- MaxPower : 0x%.2x\n", cdesc->MaxPower); + dump_extra("|---- ", cdesc->extra, cdesc->extra_length); + printf("|\n"); for (j = 0 ; j < cdesc->bNumInterfaces ; j++) { for (k = 0 ; k < cdesc->interface[j].num_altsetting ; k++) { idesc = &cdesc->interface[j].altsetting[k]; @@ -62,7 +82,9 @@ printf("|------ bInterfaceClass 0x%.2x\n", idesc->bInterfaceClass); printf("|------ bInterfaceSubClass 0x%.2x\n", idesc->bInterfaceSubClass); printf("|------ bInterfaceProtocol 0x%.2x\n", idesc->bInterfaceProtocol); - printf("|------ iInterface 0x%.2x\n|\n", idesc->iInterface); + printf("|------ iInterface 0x%.2x\n", idesc->iInterface); + dump_extra("|------ ", idesc->extra, idesc->extra_length); + printf("|\n"); for (l = 0 ; l < idesc->bNumEndpoints ; l++) { edesc = &idesc->endpoint[l]; printf("|-------- DESCRIPTOR :\n"); @@ -73,7 +95,9 @@ printf("|-------- wMaxPacketSize 0x%.4x\n", edesc->wMaxPacketSize); printf("|-------- bInterval 0x%.2x\n", edesc->bInterval); printf("|-------- bRefresh 0x%.2x\n", edesc->bRefresh); - printf("|-------- bSynchAddress 0x%.2x\n|\n", edesc->bSynchAddress); + printf("|-------- bSynchAddress 0x%.2x\n", edesc->bSynchAddress); + dump_extra("|-------- ", edesc->extra, edesc->extra_length); + printf("|\n"); } } } ==== //depot/projects/soc2009/syl_usb/libusb-tests/descriptors/test5/test5.c#4 (text+ko) ====