Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jun 2009 19:20:04 GMT
From:      Sylvestre Gallon <syl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 164612 for review
Message-ID:  <200906171920.n5HJK4YA088382@repoman.freebsd.org>

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

Change 164612 by syl@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);
+}



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