aboutsummaryrefslogtreecommitdiffstats
path: root/tools/usb/ffs-aio-example/simple/host_app/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/usb/ffs-aio-example/simple/host_app/test.c')
-rw-r--r--tools/usb/ffs-aio-example/simple/host_app/test.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/usb/ffs-aio-example/simple/host_app/test.c b/tools/usb/ffs-aio-example/simple/host_app/test.c
index acd6332811f3..aed86ffff280 100644
--- a/tools/usb/ffs-aio-example/simple/host_app/test.c
+++ b/tools/usb/ffs-aio-example/simple/host_app/test.c
@@ -33,11 +33,6 @@
33#define VENDOR 0x1d6b 33#define VENDOR 0x1d6b
34#define PRODUCT 0x0105 34#define PRODUCT 0x0105
35 35
36/* endpoints indexes */
37
38#define EP_BULK_IN (1 | LIBUSB_ENDPOINT_IN)
39#define EP_BULK_OUT (2 | LIBUSB_ENDPOINT_OUT)
40
41#define BUF_LEN 8192 36#define BUF_LEN 8192
42 37
43/* 38/*
@@ -159,16 +154,24 @@ void test_exit(struct test_state *state)
159int main(void) 154int main(void)
160{ 155{
161 struct test_state state; 156 struct test_state state;
157 struct libusb_config_descriptor *conf;
158 struct libusb_interface_descriptor const *iface;
159 unsigned char in_addr, out_addr;
162 160
163 if (test_init(&state)) 161 if (test_init(&state))
164 return 1; 162 return 1;
165 163
164 libusb_get_config_descriptor(state.found, 0, &conf);
165 iface = &conf->interface[0].altsetting[0];
166 in_addr = iface->endpoint[0].bEndpointAddress;
167 out_addr = iface->endpoint[1].bEndpointAddress;
168
166 while (1) { 169 while (1) {
167 static unsigned char buffer[BUF_LEN]; 170 static unsigned char buffer[BUF_LEN];
168 int bytes; 171 int bytes;
169 libusb_bulk_transfer(state.handle, EP_BULK_IN, buffer, BUF_LEN, 172 libusb_bulk_transfer(state.handle, in_addr, buffer, BUF_LEN,
170 &bytes, 500); 173 &bytes, 500);
171 libusb_bulk_transfer(state.handle, EP_BULK_OUT, buffer, BUF_LEN, 174 libusb_bulk_transfer(state.handle, out_addr, buffer, BUF_LEN,
172 &bytes, 500); 175 &bytes, 500);
173 } 176 }
174 test_exit(&state); 177 test_exit(&state);