From owner-p4-projects@FreeBSD.ORG Sat Jun 13 09:31:00 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id F1C6E1065670; Sat, 13 Jun 2009 09:30:59 +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 B1820106566C for ; Sat, 13 Jun 2009 09:30:59 +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 857468FC1A for ; Sat, 13 Jun 2009 09:30:59 +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 n5D9Uxuk085540 for ; Sat, 13 Jun 2009 09:30:59 GMT (envelope-from syl@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5D9UxPx085538 for perforce@freebsd.org; Sat, 13 Jun 2009 09:30:59 GMT (envelope-from syl@FreeBSD.org) Date: Sat, 13 Jun 2009 09:30:59 GMT Message-Id: <200906130930.n5D9UxPx085538@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 164249 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: Sat, 13 Jun 2009 09:31:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=164249 Change 164249 by syl@syl_atuin on 2009/06/13 09:30:26 Update libusb_get_config_descriptor to work with more complex configurations. Affected files ... .. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.c#27 edit .. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_desc.c#13 edit .. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_io.c#9 edit Differences ... ==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.c#27 (text+ko) ==== ==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_desc.c#13 (text+ko) ==== @@ -118,6 +118,8 @@ nend += pconf->interface[i].num_endpoints; } + printf("nif : %i nalt : %i nend : %i\n", nif, nalt, nend); + *config = malloc(sizeof(libusb_config_descriptor) + (nif * sizeof(libusb_interface)) + (nalt * sizeof(libusb_interface_descriptor)) + @@ -168,12 +170,14 @@ if ((*config)->extra_length != 0) (*config)->extra = pconf->extra.ptr; + printf("nif : %i nalt : %i nend : %i\n", nif, nalt, nend); + for (i = 0 ; i < nif ; i++) { pinf = &pconf->interface[i]; (*config)->interface[i].num_altsetting = pinf->num_altsetting + 1; - for (j = 0 ; j <= pinf->num_altsetting ; j++) { + for (j = 0 ; j < (*config)->interface[i].num_altsetting ; j++) { if (j != 0) - pinf = &pconf->interface[i].altsetting[j]; + pinf = &pconf->interface[i].altsetting[j - 1]; ifd = &(*config)->interface[i].altsetting[j]; ifd->bLength = pinf->desc.bLength; ifd->bDescriptorType = pinf->desc.bDescriptorType; @@ -187,9 +191,9 @@ ifd->extra_length = pinf->extra.len; if (ifd->extra_length != 0) ifd->extra = pinf->extra.ptr; - for (j = 0 ; j < pinf->num_endpoints ; j++) { - pend = &pinf->endpoints[j]; - endd = &ifd->endpoint[j]; + for (k = 0 ; k < pinf->num_endpoints ; k++) { + pend = &pinf->endpoints[k]; + endd = &ifd->endpoint[k]; endd->bLength = pend->desc.bLength; endd->bDescriptorType = pend->desc.bDescriptorType; endd->bEndpointAddress = pend->desc.bEndpointAddress; ==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_io.c#9 (text+ko) ====