PERFORCE change 164613 for review

Sylvestre Gallon syl at FreeBSD.org
Wed Jun 17 19:29:15 UTC 2009


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

Change 164613 by syl at syl_atuin on 2009/06/17 19:29:13

	- Add skeleton to transfers unimplemented test to allow them to compile.
	- Implement transfer debug.

Affected files ...

.. //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test2/test2.c#2 edit
.. //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test3/test3.c#2 edit
.. //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test4/test4.c#2 edit
.. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb.h#12 edit
.. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.c#38 edit
.. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.h#8 edit
.. //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_io.c#13 edit

Differences ...

==== //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test2/test2.c#2 (text+ko) ====

@@ -1,0 +1,14 @@
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <libusb.h>
+
+#define PID_TEST	0x8300
+#define VID_TEST	0x05ac
+
+libusb_context *ctx;
+
+int main(int ac, char *av[])
+{
+	return (EXIT_SUCCESS);
+}

==== //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test3/test3.c#2 (text+ko) ====

@@ -1,0 +1,14 @@
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <libusb.h>
+
+#define PID_TEST	0x8300
+#define VID_TEST	0x05ac
+
+libusb_context *ctx;
+
+int main(int ac, char *av[])
+{
+	return (EXIT_SUCCESS);
+}

==== //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test4/test4.c#2 (text+ko) ====

@@ -1,0 +1,14 @@
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <libusb.h>
+
+#define PID_TEST	0x8300
+#define VID_TEST	0x05ac
+
+libusb_context *ctx;
+
+int main(int ac, char *av[])
+{
+	return (EXIT_SUCCESS);
+}

==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb.h#12 (text+ko) ====

@@ -179,6 +179,7 @@
 enum libusb_debug_level {
 	LIBUSB_DEBUG_NO=0,
 	LIBUSB_DEBUG_FUNCTION=1,
+	LIBUSB_DEBUG_TRANSFER=2,
 };
 
 /* libusb structures */

==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.c#38 (text+ko) ====

@@ -38,11 +38,6 @@
 #include "libusb.h"
 #include "libusb10.h"
 
-/*
- * XXX TODO
- * - implement debug messages.
- */
-
 static pthread_mutex_t default_context_lock = PTHREAD_MUTEX_INITIALIZER;
 struct libusb_context *usbi_default_context = NULL;
 pthread_mutex_t libusb20_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -839,9 +834,11 @@
 	status = libusb20_tr_get_status(xfer);
 	usb_xfer = libusb20_tr_get_priv_sc0(xfer);
 	ctx = usb_xfer->dev_handle->dev->ctx;
+	GET_CONTEXT(ctx);
 
 	switch (status) {
 	case LIBUSB20_TRANSFER_COMPLETED:
+		dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "LIBUSB20 SUBMIT");
 		usb_xfer->actual_length += libusb20_tr_get_actual_length(xfer);
 		usb_xfer->callback(usb_xfer);
 		
@@ -850,6 +847,7 @@
 		pthread_mutex_unlock(&ctx->flying_transfers_lock);
 		break ;
 	case LIBUSB20_TRANSFER_START:
+		dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "LIBUSB20 START");
 		usb_xfer->actual_length = 0;
 		switch (usb_xfer->type) {
 			case LIBUSB_TRANSFER_TYPE_CONTROL:
@@ -887,21 +885,27 @@
 
 	switch (status) {
 	case LIBUSB20_TRANSFER_COMPLETED:
+		dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS COMPLETED");
 		xfer->status = LIBUSB_TRANSFER_COMPLETED;
 		break ;
 	case LIBUSB20_TRANSFER_OVERFLOW:
+		dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR OVERFLOW");
 		xfer->status = LIBUSB_TRANSFER_OVERFLOW;
 		break ;
 	case LIBUSB20_TRANSFER_NO_DEVICE:
+		dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR NO DEVICE");
 		xfer->status = LIBUSB_TRANSFER_NO_DEVICE;
 		break ;
 	case LIBUSB20_TRANSFER_STALL:
+		dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR STALL");
 		xfer->status = LIBUSB_TRANSFER_STALL;
 		break ;
 	case LIBUSB20_TRANSFER_CANCELLED:
+		dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR CANCELLED");
 		xfer->status = LIBUSB_TRANSFER_CANCELLED;
 		break ;
 	case LIBUSB20_TRANSFER_TIMED_OUT:
+		dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "STATUS TR TIMEOUT");
 		xfer->status = LIBUSB_TRANSFER_TIMED_OUT;
 		break ;
 	default:

==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10.h#8 (text+ko) ====

@@ -92,6 +92,9 @@
 	case LIBUSB_DEBUG_FUNCTION:
 		printf("LIBUSB FUNCTION : %s\n", str); 
 		break ;
+	case LIBUSB_DEBUG_TRANSFER:
+		printf("LIBUSB TRANSFER : %s\n", str);
+		break ;
 	default:
 		printf("LIBUSB UNKNOW DEBUG\n");
 		break ;

==== //depot/projects/soc2009/syl_usb/src/lib/libusb/libusb10_io.c#13 (text+ko) ====

@@ -533,8 +533,13 @@
 
 static void ctrl_tr_cb(struct libusb_transfer *transfer)
 {
-	int *complet = transfer->user_data;
+	libusb_context *ctx;
+	int *complet;
+       
+	ctx = NULL;
+	dprintf(ctx, LIBUSB_DEBUG_TRANSFER, "CALLBACK ENTER");
 
+	complet = transfer->user_data;
 	*complet = 1;
 }
 


More information about the p4-projects mailing list