PERFORCE change 164883 for review
Sylvestre Gallon
syl at FreeBSD.org
Mon Jun 22 18:44:47 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=164883
Change 164883 by syl at 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);
}
More information about the p4-projects
mailing list