1 diff -Nur gadgetfs-test.orig/usb.c gadgetfs-test.2007-11-29/usb.c
2 --- gadgetfs-test.orig/usb.c 2007-06-21 16:36:32.000000000 +0200
3 +++ gadgetfs-test.2007-11-29/usb.c 2007-09-25 09:01:48.000000000 +0200
5 #include <asm/byteorder.h>
7 #include <linux/types.h>
8 -#include <linux/usb_gadgetfs.h>
9 -#include <linux/usb_ch9.h>
10 +#include <linux/usb/gadgetfs.h>
11 +#include <linux/usb/ch9.h>
14 /* this aio code works with libaio-0.3.106 */
16 fs_status_desc.bEndpointAddress = USB_DIR_IN | 3;
17 EP_STATUS_NAME = "ep3in-int";
19 + /* Atmel AT32AP700x processors, high/full speed */
20 + } else if (stat (DEVNAME = "atmel_usba_udc", &statb) == 0) {
22 + device_desc.bcdDevice = __constant_cpu_to_le16 (0x0108);
24 + fs_source_desc.bEndpointAddress
25 + = hs_source_desc.bEndpointAddress
27 + EP_IN_NAME = "ep1in-bulk";
28 + fs_sink_desc.bEndpointAddress
29 + = hs_sink_desc.bEndpointAddress
31 + EP_OUT_NAME = "ep2out-bulk";
33 + source_sink_intf.bNumEndpoints = 3;
34 + fs_status_desc.bEndpointAddress
35 + = hs_status_desc.bEndpointAddress
37 + EP_STATUS_NAME = "ep3in-int";
43 fs_status_desc.bEndpointAddress = USB_DIR_IN | 3;
44 EP_STATUS_NAME = "ep3-int";
46 + /* Atmel AT32AP700x processors, high/full speed */
47 + } else if (stat (DEVNAME = "atmel_usba_udc", &statb) == 0){
50 + device_desc.bcdDevice = __constant_cpu_to_le16 (0x0105);
52 + fs_source_desc.bEndpointAddress
53 + = hs_source_desc.bEndpointAddress
55 + fs_source_desc.bmAttributes
56 + = hs_source_desc.bmAttributes
57 + = USB_ENDPOINT_XFER_ISOC;
58 + fs_source_desc.wMaxPacketSize
59 + = hs_source_desc.wMaxPacketSize
60 + = __cpu_to_le16(min (bufsize, 1024));
61 + fs_source_desc.bInterval
62 + = hs_source_desc.bInterval
64 + EP_IN_NAME = "ep5in-iso";
66 + fs_sink_desc.bEndpointAddress
67 + = hs_sink_desc.bEndpointAddress
69 + fs_sink_desc.bmAttributes
70 + = hs_sink_desc.bmAttributes
71 + = USB_ENDPOINT_XFER_ISOC;
72 + fs_sink_desc.wMaxPacketSize
73 + = hs_sink_desc.wMaxPacketSize
74 + = __cpu_to_le16(min (bufsize, 1024));
75 + fs_sink_desc.bInterval
76 + = hs_sink_desc.bInterval
78 + EP_OUT_NAME = "ep6out-iso";
80 + source_sink_intf.bNumEndpoints = 3;
81 + fs_status_desc.bEndpointAddress
82 + = hs_status_desc.bEndpointAddress
84 + EP_STATUS_NAME = "ep3in-int";
91 fprintf (stderr, "iso fs wMaxPacket %04x bInterval %02x\n",
92 - fs_sink_desc.wMaxPacketSize,
93 + __le16_to_cpu(fs_sink_desc.wMaxPacketSize),
94 fs_sink_desc.bInterval);
97 "iso hs wMaxPacket %04x bInterval %02x\n",
98 - hs_sink_desc.wMaxPacketSize,
99 + __le16_to_cpu(hs_sink_desc.wMaxPacketSize),
100 hs_sink_desc.bInterval);
103 @@ -1285,13 +1345,17 @@
107 + __u16 value, index, length;
109 + value = __le16_to_cpu(setup->wValue);
110 + index = __le16_to_cpu(setup->wIndex);
111 + length = __le16_to_cpu(setup->wLength);
114 fprintf (stderr, "SETUP %02x.%02x "
116 setup->bRequestType, setup->bRequest,
117 - setup->wValue, setup->wIndex,
119 + value, index, length);
122 if ((setup->bRequestType & USB_TYPE_MASK) != USB_TYPE_STANDARD)
123 @@ -1302,21 +1366,21 @@
124 case USB_REQ_GET_DESCRIPTOR:
125 if (setup->bRequestType != USB_DIR_IN)
127 - switch (setup->wValue >> 8) {
128 + switch (value >> 8) {
130 - tmp = setup->wValue & 0x0ff;
131 + tmp = value & 0x0ff;
134 "... get string %d lang %04x\n",
135 - tmp, setup->wIndex);
136 - if (tmp != 0 && setup->wIndex != strings.language)
138 + if (tmp != 0 && index != strings.language)
140 status = usb_gadget_get_string (&strings, tmp, buf);
144 - if (setup->wLength < tmp)
145 - tmp = setup->wLength;
148 status = write (fd, buf, tmp);
151 @@ -1336,7 +1400,7 @@
152 if (setup->bRequestType != USB_DIR_OUT)
155 - fprintf (stderr, "CONFIG #%d\n", setup->wValue);
156 + fprintf (stderr, "CONFIG #%d\n", value);
158 /* Kernel is normally waiting for us to finish reconfiguring
160 @@ -1349,7 +1413,7 @@
161 * the endpoints always active and don't rely on seeing any
162 * config change events, either this or SET_INTERFACE.
164 - switch (setup->wValue) {
169 @@ -1369,27 +1433,27 @@
171 case USB_REQ_GET_INTERFACE:
172 if (setup->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE)
173 - || setup->wIndex != 0
174 - || setup->wLength > 1)
179 /* only one altsetting in this driver */
181 - status = write (fd, buf, setup->wLength);
182 + status = write (fd, buf, length);
185 fprintf (stderr, "GET_INTERFACE timeout\n");
187 perror ("write GET_INTERFACE data");
188 - } else if (status != setup->wLength) {
189 + } else if (status != length) {
190 fprintf (stderr, "short GET_INTERFACE write, %d\n",
194 case USB_REQ_SET_INTERFACE:
195 if (setup->bRequestType != USB_RECIP_INTERFACE
196 - || setup->wIndex != 0
197 - || setup->wValue != 0)
202 /* just reset toggle/halt for the interface's endpoints */
203 diff -Nur gadgetfs-test.orig/usbstring.c gadgetfs-test.2007-11-29/usbstring.c
204 --- gadgetfs-test.orig/usbstring.c 2007-06-21 16:36:32.000000000 +0200
205 +++ gadgetfs-test.2007-11-29/usbstring.c 2007-09-25 09:01:48.000000000 +0200
209 #include <linux/types.h>
210 -#include <linux/usb_ch9.h>
211 +#include <linux/usb/ch9.h>
213 #include "usbstring.h"