Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Jun 2009 18:44:46 GMT
From:      Sylvestre Gallon <syl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 164883 for review
Message-ID:  <200906221844.n5MIikmp049517@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=164883

Change 164883 by syl@syl_pablo on 2009/06/22 18:44:09

	Implement bulk tests.

Affected files ...

.. //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test2/test2.c#3 edit

Differences ...

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

@@ -5,10 +5,38 @@
 
 #define PID_TEST	0x8300
 #define VID_TEST	0x05ac
+#define STR_SIZE	29
 
 libusb_context *ctx;
 
 int main(int ac, char *av[])
 {
+	libusb_device *dev;
+	libusb_device_handle *devh;
+	volatile int transferred;
+	uint8_t data[STR_SIZE] = {
+		'I', ' ', 'S', 'e', 'e', ' ', 'd', 'e', 'a', 'd',
+		' ', 'p', 'o', 'n', 'e', 'y', ' ', 'i', 'n', ' ',
+		'm', 'y', ' ', 'd', 'e', 'a', 'm', 's', '\0'};
+
+	printf("This programe will output a debug trace on a serial cdc"
+	    "bulk endpoint\n");
+	if (libusb_init(&ctx) != 0) {
+		fprintf(stderr, "libusb_init_failed\n");
+		return (EXIT_FAILURE);
+	}
+
+	transferred = 0;
+	if ((devh = libusb_open_device_with_vid_pid(ctx, VID_TEST, PID_TEST)) != NULL) {
+		libusb_detach_kernel_driver(devh, 1);
+		dev = libusb_get_device(devh)
+		libusb_bulk_transfer(devh, /*endpoint*/, &data, STR_SIZE,
+		&transferred, 10000);
+		while (transferred != 1);
+		printf("transfer done.\n");
+	} else {
+		fprintf(stderr, "\nNo device match or lack of permissions.\n");
+	}
+
 	return (EXIT_SUCCESS);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906221844.n5MIikmp049517>