PERFORCE change 164612 for review
Sylvestre Gallon
syl at FreeBSD.org
Wed Jun 17 19:20:05 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=164612
Change 164612 by syl at syl_atuin on 2009/06/17 19:19:17
Implement test to perform GET_STATUS control request.
Affected files ...
.. //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test1/test1.c#2 edit
Differences ...
==== //depot/projects/soc2009/syl_usb/libusb-tests/transfers/test1/test1.c#2 (text+ko) ====
@@ -1,0 +1,36 @@
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <libusb.h>
+
+#define PID_TEST 0x2303
+#define VID_TEST 0x067b
+
+libusb_context *ctx;
+
+int main(int ac, char *av[])
+{
+ libusb_device *dev;
+ libusb_device_handle *devh;
+ uint8_t data[2] = {0,0};
+
+ printf("This program will try to issue a GET_STATUS"
+ "on the PID_TEST VID_TEST device control endpoint");
+
+
+ if (libusb_init(&ctx) != 0) {
+ fprintf(stderr, "libusb_init_failed\n");
+ return (EXIT_FAILURE);
+ }
+
+ 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_control_transfer(devh, 0x80, 0x01, 0x00, 0x00, data, 2, 10);
+ printf("data = 0x%.2x 0x%.2x\n", data[0], data[1]);
+ } else {
+ fprintf(stderr, "\nNo device match or lack of permissions.\n");
+ }
+
+ return (EXIT_SUCCESS);
+}
More information about the p4-projects
mailing list