PERFORCE change 164249 for review

Sylvestre Gallon syl at FreeBSD.org
Sat Jun 13 09:31:01 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=164249

Change 164249 by syl at 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) ====



More information about the p4-projects mailing list