aboutsummaryrefslogtreecommitdiffstats
path: root/tools/usb/ffs-aio-example
diff options
context:
space:
mode:
Diffstat (limited to 'tools/usb/ffs-aio-example')
-rw-r--r--tools/usb/ffs-aio-example/multibuff/host_app/test.c14
-rw-r--r--tools/usb/ffs-aio-example/simple/device_app/aio_simple.c2
-rw-r--r--tools/usb/ffs-aio-example/simple/host_app/test.c17
3 files changed, 20 insertions, 13 deletions
diff --git a/tools/usb/ffs-aio-example/multibuff/host_app/test.c b/tools/usb/ffs-aio-example/multibuff/host_app/test.c
index daa3abe6bebd..2cbcce6e8dd7 100644
--- a/tools/usb/ffs-aio-example/multibuff/host_app/test.c
+++ b/tools/usb/ffs-aio-example/multibuff/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,14 +154,21 @@ 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 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 addr = iface->endpoint[0].bEndpointAddress;
167
166 while (1) { 168 while (1) {
167 static unsigned char buffer[BUF_LEN]; 169 static unsigned char buffer[BUF_LEN];
168 int bytes; 170 int bytes;
169 libusb_bulk_transfer(state.handle, EP_BULK_IN, buffer, BUF_LEN, 171 libusb_bulk_transfer(state.handle, addr, buffer, BUF_LEN,
170 &bytes, 500); 172 &bytes, 500);
171 } 173 }
172 test_exit(&state); 174 test_exit(&state);
diff --git a/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c b/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c
index adc310a6d489..1f44a29818bf 100644
--- a/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c
+++ b/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c
@@ -103,12 +103,14 @@ static const struct {
103 .bDescriptorType = USB_DT_ENDPOINT, 103 .bDescriptorType = USB_DT_ENDPOINT,
104 .bEndpointAddress = 1 | USB_DIR_IN, 104 .bEndpointAddress = 1 | USB_DIR_IN,
105 .bmAttributes = USB_ENDPOINT_XFER_BULK, 105 .bmAttributes = USB_ENDPOINT_XFER_BULK,
106 .wMaxPacketSize = htole16(512),
106 }, 107 },
107 .bulk_source = { 108 .bulk_source = {
108 .bLength = sizeof(descriptors.hs_descs.bulk_source), 109 .bLength = sizeof(descriptors.hs_descs.bulk_source),
109 .bDescriptorType = USB_DT_ENDPOINT, 110 .bDescriptorType = USB_DT_ENDPOINT,
110 .bEndpointAddress = 2 | USB_DIR_OUT, 111 .bEndpointAddress = 2 | USB_DIR_OUT,
111 .bmAttributes = USB_ENDPOINT_XFER_BULK, 112 .bmAttributes = USB_ENDPOINT_XFER_BULK,
113 .wMaxPacketSize = htole16(512),
112 }, 114 },
113 }, 115 },
114}; 116};
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);