]> git.pld-linux.org Git - packages/kernel.git/blame - linux-2.4.20-rc1-USB.patch
- ported from linux-2.4.25-atmdd.patch
[packages/kernel.git] / linux-2.4.20-rc1-USB.patch
CommitLineData
8a8eb7c0 1--- linux-2.4.19.org/include/linux/usb.h Sat Aug 3 02:39:46 2002
2+++ linux-2.4.19/include/linux/usb.h Thu Oct 31 08:11:53 2002
3@@ -16,8 +16,8 @@
4 #define USB_CLASS_MASS_STORAGE 8
5 #define USB_CLASS_HUB 9
6 #define USB_CLASS_CDC_DATA 0x0a
7-#define USB_CLASS_CSCID 0x0b /* chip+ smart card */
8-#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
9+#define USB_CLASS_CSCID 0x0b /* chip+ smart card */
10+#define USB_CLASS_CONTENT_SEC 0x0d /* content security */
11 #define USB_CLASS_APP_SPEC 0xfe
12 #define USB_CLASS_VENDOR_SPEC 0xff
13
14@@ -42,8 +42,8 @@
15 /*
16 * USB directions
17 */
18-#define USB_DIR_OUT 0
19-#define USB_DIR_IN 0x80
20+#define USB_DIR_OUT 0 /* to device */
21+#define USB_DIR_IN 0x80 /* to host */
22
23 /*
24 * Descriptor types
25@@ -85,23 +85,23 @@
26 /*
27 * USB Packet IDs (PIDs)
28 */
29-#define USB_PID_UNDEF_0 0xf0
30-#define USB_PID_OUT 0xe1
31-#define USB_PID_ACK 0xd2
32-#define USB_PID_DATA0 0xc3
33-#define USB_PID_PING 0xb4 /* USB 2.0 */
34-#define USB_PID_SOF 0xa5
35-#define USB_PID_NYET 0x96 /* USB 2.0 */
36-#define USB_PID_DATA2 0x87 /* USB 2.0 */
37-#define USB_PID_SPLIT 0x78 /* USB 2.0 */
38-#define USB_PID_IN 0x69
39-#define USB_PID_NAK 0x5a
40-#define USB_PID_DATA1 0x4b
41-#define USB_PID_PREAMBLE 0x3c /* Token mode */
42-#define USB_PID_ERR 0x3c /* USB 2.0: handshake mode */
43-#define USB_PID_SETUP 0x2d
44-#define USB_PID_STALL 0x1e
45-#define USB_PID_MDATA 0x0f /* USB 2.0 */
46+#define USB_PID_UNDEF_0 0xf0
47+#define USB_PID_OUT 0xe1
48+#define USB_PID_ACK 0xd2
49+#define USB_PID_DATA0 0xc3
50+#define USB_PID_PING 0xb4 /* USB 2.0 */
51+#define USB_PID_SOF 0xa5
52+#define USB_PID_NYET 0x96 /* USB 2.0 */
53+#define USB_PID_DATA2 0x87 /* USB 2.0 */
54+#define USB_PID_SPLIT 0x78 /* USB 2.0 */
55+#define USB_PID_IN 0x69
56+#define USB_PID_NAK 0x5a
57+#define USB_PID_DATA1 0x4b
58+#define USB_PID_PREAMBLE 0x3c /* Token mode */
59+#define USB_PID_ERR 0x3c /* USB 2.0: handshake mode */
60+#define USB_PID_SETUP 0x2d
61+#define USB_PID_STALL 0x1e
62+#define USB_PID_MDATA 0x0f /* USB 2.0 */
63
64 /*
65 * Standard requests
66@@ -152,13 +152,26 @@
67 mdelay(ms);
68 }
69
70-typedef struct {
71- __u8 requesttype;
72- __u8 request;
73- __u16 value;
74- __u16 index;
75- __u16 length;
76-} devrequest __attribute__ ((packed));
77+/**
78+ * struct usb_ctrlrequest - structure used to make USB device control requests easier to create and decode
79+ * @bRequestType: matches the USB bmRequestType field
80+ * @bRequest: matches the USB bRequest field
81+ * @wValue: matches the USB wValue field
82+ * @wIndex: matches the USB wIndex field
83+ * @wLength: matches the USB wLength field
84+ *
85+ * This structure is used to send control requests to a USB device. It matches
86+ * the different fields of the USB 2.0 Spec section 9.3, table 9-2. See the
87+ * USB spec for a fuller description of the different fields, and what they are
88+ * used for.
89+ */
90+struct usb_ctrlrequest {
91+ __u8 bRequestType;
92+ __u8 bRequest;
93+ __u16 wValue;
94+ __u16 wIndex;
95+ __u16 wLength;
96+} __attribute__ ((packed));
97
98 /*
99 * USB-status codes:
100@@ -174,10 +187,10 @@
101 #define USB_ST_BUFFEROVERRUN (-ECOMM)
102 #define USB_ST_BUFFERUNDERRUN (-ENOSR)
103 #define USB_ST_INTERNALERROR (-EPROTO) /* unknown error */
104-#define USB_ST_SHORT_PACKET (-EREMOTEIO)
105-#define USB_ST_PARTIAL_ERROR (-EXDEV) /* ISO transfer only partially completed */
106-#define USB_ST_URB_KILLED (-ENOENT) /* URB canceled by user */
107-#define USB_ST_URB_PENDING (-EINPROGRESS)
108+#define USB_ST_SHORT_PACKET (-EREMOTEIO)
109+#define USB_ST_PARTIAL_ERROR (-EXDEV) /* ISO transfer only partially completed */
110+#define USB_ST_URB_KILLED (-ENOENT) /* URB canceled by user */
111+#define USB_ST_URB_PENDING (-EINPROGRESS)
112 #define USB_ST_REMOVED (-ENODEV) /* device not existing or removed */
113 #define USB_ST_TIMEOUT (-ETIMEDOUT) /* communication timed out, also in urb->status**/
114 #define USB_ST_NOTSUPPORTED (-ENOSYS)
115@@ -385,7 +398,53 @@
116 unsigned long driver_info;
117 };
118
119+/**
120+ * struct usb_driver - identifies USB driver to usbcore
121+ * @owner: Pointer to the module owner of this driver; initialize
122+ * it using THIS_MODULE.
123+ * @name: The driver name should be unique among USB drivers,
124+ * and should normally be the same as the module name.
125+ * @probe: Called to see if the driver is willing to manage a particular
126+ * interface on a device. The probe routine returns a handle that
127+ * will later be provided to disconnect(), or a null pointer to
128+ * indicate that the driver will not handle the interface.
129+ * The handle is normally a pointer to driver-specific data.
130+ * If the probe() routine needs to access the interface
131+ * structure itself, use usb_ifnum_to_if() to make sure it's using
132+ * the right one.
133+ * @disconnect: Called when the interface is no longer accessible, usually
134+ * because its device has been (or is being) disconnected. The
135+ * handle passed is what was returned by probe(), or was provided
136+ * to usb_driver_claim_interface().
137+ * @ioctl: Used for drivers that want to talk to userspace through
138+ * the "usbfs" filesystem. This lets devices provide ways to
139+ * expose information to user space regardless of where they
140+ * do (or don't) show up otherwise in the filesystem.
141+ * @fops: pointer to a fops structure if the driver wants to use the USB
142+ * major number.
143+ * @minor: the starting minor number for this driver, if the fops
144+ * pointer is set.
145+ * @id_table: USB drivers use ID table to support hotplugging.
146+ * Export this with MODULE_DEVICE_TABLE(usb,...), or use NULL to
147+ * say that probe() should be called for any unclaimed interface.
148+ *
149+ * USB drivers must provide a name, probe() and disconnect() methods,
150+ * and an id_table. Other driver fields are optional.
151+ *
152+ * The id_table is used in hotplugging. It holds a set of descriptors,
153+ * and specialized data may be associated with each entry. That table
154+ * is used by both user and kernel mode hotplugging support.
155+ * The probe() and disconnect() methods are called in a context where
156+ * they can sleep, but they should avoid abusing the privilege. Most
157+ * work to connect to a device should be done when the device is opened,
158+ * and undone at the last close. The disconnect code needs to address
159+ * concurrency issues with respect to open() and close() methods, as
160+ * well as forcing all pending I/O requests to complete (by unlinking
161+ * them as necessary, and blocking until the unlinks complete).
162+ */
163 struct usb_driver {
164+ struct module *owner;
165+
166 const char *name;
167
168 void *(*probe)(
169@@ -402,18 +461,9 @@
170
171 struct semaphore serialize;
172
173- /* ioctl -- userspace apps can talk to drivers through usbdevfs */
174 int (*ioctl)(struct usb_device *dev, unsigned int code, void *buf);
175
176- /* support for "new-style" USB hotplugging
177- * binding policy can be driven from user mode too
178- */
179 const struct usb_device_id *id_table;
180-
181- /* suspend before the bus suspends;
182- * disconnect or resume when the bus resumes */
183- // void (*suspend)(struct usb_device *dev);
184- // void (*resume)(struct usb_device *dev);
185 };
186
187 /*----------------------------------------------------------------------------*
188@@ -423,28 +473,31 @@
189 /*
190 * urb->transfer_flags:
191 */
192-#define USB_DISABLE_SPD 0x0001
193-#define USB_ISO_ASAP 0x0002
194-#define USB_ASYNC_UNLINK 0x0008
195-#define USB_QUEUE_BULK 0x0010
196+#define USB_DISABLE_SPD 0x0001
197+#define URB_SHORT_NOT_OK USB_DISABLE_SPD
198+#define USB_ISO_ASAP 0x0002
199+#define USB_ASYNC_UNLINK 0x0008
200+#define USB_QUEUE_BULK 0x0010
201 #define USB_NO_FSBR 0x0020
202-#define USB_ZERO_PACKET 0x0040 // Finish bulk OUTs always with zero length packet
203+#define USB_ZERO_PACKET 0x0040 // Finish bulk OUTs always with zero length packet
204 #define URB_NO_INTERRUPT 0x0080 /* HINT: no non-error interrupt needed */
205 /* ... less overhead for QUEUE_BULK */
206 #define USB_TIMEOUT_KILLED 0x1000 // only set by HCD!
207
208-typedef struct
209+struct iso_packet_descriptor
210 {
211 unsigned int offset;
212 unsigned int length; // expected length
213 unsigned int actual_length;
214 unsigned int status;
215-} iso_packet_descriptor_t, *piso_packet_descriptor_t;
216+};
217+
218+#define usb_iso_packet_descriptor iso_packet_descriptor
219
220 struct urb;
221 typedef void (*usb_complete_t)(struct urb *);
222
223-typedef struct urb
224+struct urb
225 {
226 spinlock_t lock; // lock for the URB
227 void *hcpriv; // private data for host controller
228@@ -455,10 +508,12 @@
229 int status; // returned status
230 unsigned int transfer_flags; // USB_DISABLE_SPD | USB_ISO_ASAP | etc.
231 void *transfer_buffer; // associated data buffer
232+ dma_addr_t transfer_dma; // dma addr for transfer_buffer
233 int transfer_buffer_length; // data buffer length
234 int actual_length; // actual data buffer length
235 int bandwidth; // bandwidth for this transfer request (INT or ISO)
236 unsigned char *setup_packet; // setup packet (control only)
237+ dma_addr_t setup_dma; // dma addr for setup_packet
238 //
239 int start_frame; // start frame (iso/irq only)
240 int number_of_packets; // number of packets in this request (iso)
241@@ -469,8 +524,8 @@
242 void *context; // context for completion routine
243 usb_complete_t complete; // pointer to completion routine
244 //
245- iso_packet_descriptor_t iso_frame_desc[0];
246-} urb_t, *purb_t;
247+ struct iso_packet_descriptor iso_frame_desc[0];
248+};
249
250 /**
251 * FILL_CONTROL_URB - macro to help initialize a control urb
252@@ -675,11 +730,11 @@
253 urb->start_frame = -1;
254 }
255
256-purb_t usb_alloc_urb(int iso_packets);
257-void usb_free_urb (purb_t purb);
258-int usb_submit_urb(purb_t purb);
259-int usb_unlink_urb(purb_t purb);
260-int usb_internal_control_msg(struct usb_device *usb_dev, unsigned int pipe, devrequest *cmd, void *data, int len, int timeout);
261+struct urb *usb_alloc_urb(int iso_packets);
262+void usb_free_urb (struct urb *urb);
263+int usb_submit_urb(struct urb *urb);
264+int usb_unlink_urb(struct urb *urb);
265+int usb_internal_control_msg(struct usb_device *usb_dev, unsigned int pipe, struct usb_ctrlrequest *cmd, void *data, int len, int timeout);
266 int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe, void *data, int len, int *actual_length, int timeout);
267
268 /*-------------------------------------------------------------------*
269@@ -710,6 +765,7 @@
270 */
271 struct usb_bus {
272 int busnum; /* Bus number (in order of reg) */
273+ char *bus_name; /* stable id (PCI slot_name etc) */
274
275 #ifdef DEVNUM_ROUND_ROBIN
276 int devnum_next; /* Next open device number in round-robin allocation */
277@@ -758,7 +814,8 @@
278 #define USB_MAXCHILDREN (16)
279
280 struct usb_device {
281- int devnum; /* Device number on USB bus */
282+ int devnum; /* Address on USB bus */
283+ char devpath [16]; /* Use in messages: /port/port/... */
284
285 enum {
286 USB_SPEED_UNKNOWN = 0, /* enumerating */
287@@ -833,10 +890,6 @@
288 extern void usb_inc_dev_use(struct usb_device *);
289 #define usb_dec_dev_use usb_free_dev
290
291-extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb);
292-extern void usb_claim_bandwidth (struct usb_device *dev, struct urb *urb, int bustime, int isoc);
293-extern void usb_release_bandwidth(struct usb_device *dev, struct urb *urb, int isoc);
294-
295 extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout);
296
297 extern int usb_root_hub_string(int id, int serial, char *type, __u8 *data, int len);
298@@ -847,6 +900,42 @@
299
300 int usb_get_current_frame_number (struct usb_device *usb_dev);
301
302+
303+/**
304+ * usb_make_path - returns stable device path in the usb tree
305+ * @dev: the device whose path is being constructed
306+ * @buf: where to put the string
307+ * @size: how big is "buf"?
308+ *
309+ * Returns length of the string (> 0) or negative if size was too small.
310+ *
311+ * This identifier is intended to be "stable", reflecting physical paths in
312+ * hardware such as physical bus addresses for host controllers or ports on
313+ * USB hubs. That makes it stay the same until systems are physically
314+ * reconfigured, by re-cabling a tree of USB devices or by moving USB host
315+ * controllers. Adding and removing devices, including virtual root hubs
316+ * in host controller driver modules, does not change these path identifers;
317+ * neither does rebooting or re-enumerating. These are more useful identifiers
318+ * than changeable ("unstable") ones like bus numbers or device addresses.
319+ * (The stability of the id depends on stability of the bus_name associated
320+ * with the bus the device uses; that is normally stable.)
321+ *
322+ * With a partial exception for devices connected to USB 2.0 root hubs, these
323+ * identifiers are also predictable. So long as the device tree isn't changed,
324+ * plugging any USB device into a given hub port always gives it the same path.
325+ * Because of the use of "companion" controllers, devices connected to ports on
326+ * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are
327+ * high speed, and a different one if they are full or low speed.
328+ */
329+static inline int usb_make_path (struct usb_device *dev, char *buf, size_t size)
330+{
331+ int actual;
332+ actual = snprintf (buf, size, "usb-%s-%s",
333+ dev->bus->bus_name, dev->devpath);
334+ return (actual >= size) ? -1 : actual;
335+}
336+
337+
338 /*
339 * Calling this entity a "pipe" is glorifying it. A USB pipe
340 * is something embarrassingly simple: it basically consists
341@@ -973,26 +1062,6 @@
342 __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,type,(void**)ptr)
343
344 /*
345- * Some USB bandwidth allocation constants.
346- */
347-#define BW_HOST_DELAY 1000L /* nanoseconds */
348-#define BW_HUB_LS_SETUP 333L /* nanoseconds */
349- /* 4 full-speed bit times (est.) */
350-
351-#define FRAME_TIME_BITS 12000L /* frame = 1 millisecond */
352-#define FRAME_TIME_MAX_BITS_ALLOC (90L * FRAME_TIME_BITS / 100L)
353-#define FRAME_TIME_USECS 1000L
354-#define FRAME_TIME_MAX_USECS_ALLOC (90L * FRAME_TIME_USECS / 100L)
355-
356-#define BitTime(bytecount) (7 * 8 * bytecount / 6) /* with integer truncation */
357- /* Trying not to use worst-case bit-stuffing
358- of (7/6 * 8 * bytecount) = 9.33 * bytecount */
359- /* bytecount = data payload byte count */
360-
361-#define NS_TO_US(ns) ((ns + 500L) / 1000L)
362- /* convert & round nanoseconds to microseconds */
363-
364-/*
365 * Debugging helpers..
366 */
367 void usb_show_device_descriptor(struct usb_device_descriptor *);
368diff -Nur linux-2.4.19.org/drivers/usb/CDCEther.c linux-2.4.19/drivers/usb/CDCEther.c
369--- linux-2.4.19.org/drivers/usb/CDCEther.c Sat Aug 3 02:39:44 2002
370+++ linux-2.4.19/drivers/usb/CDCEther.c Thu Oct 31 08:11:20 2002
371@@ -148,7 +148,7 @@
372 // Give this to the USB subsystem so it can tell us
373 // when more data arrives.
374 if ( (res = usb_submit_urb(&ether_dev->rx_urb)) ) {
375- warn( __FUNCTION__ " failed submit rx_urb %d", res);
376+ warn("%s failed submit rx_urb %d", __FUNCTION__, res);
377 }
378
379 // We are no longer busy, show us the frames!!!
380@@ -379,7 +379,7 @@
381
382 // Turn on the USB and let the packets flow!!!
383 if ( (res = enable_net_traffic( ether_dev )) ) {
384- err( __FUNCTION__ "can't enable_net_traffic() - %d", res );
385+ err("%s can't enable_net_traffic() - %d", __FUNCTION__, res );
386 return -EIO;
387 }
388
389@@ -392,7 +392,7 @@
390 /* Put it out there so the device can send us stuff */
391 if ( (res = usb_submit_urb(&ether_dev->rx_urb)) ) {
392 /* Hmm... Okay... */
393- warn( __FUNCTION__ " failed rx_urb %d", res );
394+ warn( "%s failed rx_urb %d", __FUNCTION__, res );
395 }
396
397 if (ether_dev->properties & HAVE_NOTIFICATION_ELEMENT) {
398@@ -406,7 +406,7 @@
399 ether_dev,
400 ether_dev->intr_interval);
401 if ( (res = usb_submit_urb(&ether_dev->intr_urb)) ) {
402- warn( __FUNCTION__ " failed intr_urb %d", res );
403+ warn("%s failed intr_urb %d", __FUNCTION__, res );
404 }
405 }
406
407@@ -497,14 +497,14 @@
408 static void CDC_SetEthernetPacketFilter (ether_dev_t *ether_dev)
409 {
410 #if 0
411- devrequest *dr = &ether_dev->ctrl_dr;
412+ struct usb_ctrlrequest *dr = &ether_dev->ctrl_dr;
413 int res;
414
415- dr->requesttype = USB_TYPE_CLASS | USB_DIR_OUT | USB_RECIP_INTERFACE;
416- dr->request = SET_ETHERNET_PACKET_FILTER;
417- dr->value = cpu_to_le16(ether_dev->mode_flags);
418- dr->index = cpu_to_le16((u16)ether_dev->comm_interface);
419- dr->length = 0;
420+ dr->bRequestType = USB_TYPE_CLASS | USB_DIR_OUT | USB_RECIP_INTERFACE;
421+ dr->bRequest = SET_ETHERNET_PACKET_FILTER;
422+ dr->wValue = cpu_to_le16(ether_dev->mode_flags);
423+ dr->wIndex = cpu_to_le16((u16)ether_dev->comm_interface);
424+ dr->wLength = 0;
425
426 FILL_CONTROL_URB(&ether_dev->ctrl_urb,
427 ether_dev->usb,
428@@ -515,7 +515,7 @@
429 setpktfilter_done,
430 ether_dev);
431 if ( (res = usb_submit_urb(&ether_dev->ctrl_urb)) ) {
432- warn( __FUNCTION__ " failed submit ctrl_urb %d", res);
433+ warn("%s failed submit ctrl_urb %d", __FUNCTION__, res);
434 }
435 #endif
436
437diff -Nur linux-2.4.19.org/drivers/usb/CDCEther.h linux-2.4.19/drivers/usb/CDCEther.h
438--- linux-2.4.19.org/drivers/usb/CDCEther.h Sat Aug 3 02:39:44 2002
439+++ linux-2.4.19/drivers/usb/CDCEther.h Thu Oct 31 08:11:20 2002
440@@ -75,7 +75,7 @@
441 __u8 bNumberPowerFilters;
442 __u16 mode_flags;
443 int intr_interval;
444- devrequest ctrl_dr;
445+ struct usb_ctrlrequest ctrl_dr;
446 struct urb rx_urb, tx_urb, intr_urb, ctrl_urb;
447 unsigned char rx_buff[CDC_ETHER_MAX_MTU] __attribute__((aligned(L1_CACHE_BYTES)));
448 unsigned char tx_buff[CDC_ETHER_MAX_MTU] __attribute__((aligned(L1_CACHE_BYTES)));
449diff -Nur linux-2.4.19.org/drivers/usb/Config.in linux-2.4.19/drivers/usb/Config.in
450--- linux-2.4.19.org/drivers/usb/Config.in Sat Aug 3 02:39:44 2002
451+++ linux-2.4.19/drivers/usb/Config.in Thu Oct 31 08:11:20 2002
452@@ -33,6 +33,7 @@
453 dep_tristate ' USB Audio support' CONFIG_USB_AUDIO $CONFIG_USB $CONFIG_SOUND
454 dep_tristate ' EMI 2|6 USB Audio interface support' CONFIG_USB_EMI26 $CONFIG_USB_AUDIO
455 dep_tristate ' USB Bluetooth support (EXPERIMENTAL)' CONFIG_USB_BLUETOOTH $CONFIG_USB $CONFIG_EXPERIMENTAL
456+ dep_tristate ' USB MIDI support' CONFIG_USB_MIDI $CONFIG_USB
457 if [ "$CONFIG_SCSI" = "n" ]; then
458 comment ' SCSI support is needed for USB Storage'
459 fi
460@@ -44,6 +45,7 @@
461 dep_mbool ' Microtech CompactFlash/SmartMedia support' CONFIG_USB_STORAGE_DPCM $CONFIG_USB_STORAGE
462 dep_mbool ' HP CD-Writer 82xx support' CONFIG_USB_STORAGE_HP8200e $CONFIG_USB_STORAGE $CONFIG_EXPERIMENTAL
463 dep_mbool ' SanDisk SDDR-09 (and other SmartMedia) support' CONFIG_USB_STORAGE_SDDR09 $CONFIG_USB_STORAGE $CONFIG_EXPERIMENTAL
464+ dep_mbool ' SanDisk SDDR-55 SmartMedia support' CONFIG_USB_STORAGE_SDDR55 $CONFIG_USB_STORAGE $CONFIG_EXPERIMENTAL
465 dep_mbool ' Lexar Jumpshot Compact Flash Reader' CONFIG_USB_STORAGE_JUMPSHOT $CONFIG_USB_STORAGE $CONFIG_EXPERIMENTAL
466 dep_tristate ' USB Modem (CDC ACM) support' CONFIG_USB_ACM $CONFIG_USB
467 dep_tristate ' USB Printer support' CONFIG_USB_PRINTER $CONFIG_USB
468@@ -59,6 +61,7 @@
469 dep_tristate ' USB HIDBP Keyboard (basic) support' CONFIG_USB_KBD $CONFIG_USB $CONFIG_INPUT
470 dep_tristate ' USB HIDBP Mouse (basic) support' CONFIG_USB_MOUSE $CONFIG_USB $CONFIG_INPUT
471 fi
472+ dep_tristate ' Aiptek 6000U/8000U tablet support' CONFIG_USB_AIPTEK $CONFIG_USB $CONFIG_INPUT
473 dep_tristate ' Wacom Intuos/Graphire tablet support' CONFIG_USB_WACOM $CONFIG_USB $CONFIG_INPUT
474
475 comment 'USB Imaging devices'
476@@ -101,6 +104,8 @@
477 comment 'USB Miscellaneous drivers'
478 dep_tristate ' USB Diamond Rio500 support (EXPERIMENTAL)' CONFIG_USB_RIO500 $CONFIG_USB $CONFIG_EXPERIMENTAL
479 dep_tristate ' USB Auerswald ISDN support (EXPERIMENTAL)' CONFIG_USB_AUERSWALD $CONFIG_USB $CONFIG_EXPERIMENTAL
480+ dep_tristate ' Texas Instruments Graph Link USB (aka SilverLink) cable support' CONFIG_USB_TIGL $CONFIG_USB
481 dep_tristate ' Tieman Voyager USB Braille display support (EXPERIMENTAL)' CONFIG_USB_BRLVGER $CONFIG_USB $CONFIG_EXPERIMENTAL
482+ dep_tristate ' USB LCD device support' CONFIG_USB_LCD $CONFIG_USB
483 fi
484 endmenu
485diff -Nur linux-2.4.19.org/drivers/usb/Makefile linux-2.4.19/drivers/usb/Makefile
486--- linux-2.4.19.org/drivers/usb/Makefile Sat Aug 3 02:39:44 2002
487+++ linux-2.4.19/drivers/usb/Makefile Thu Oct 31 08:11:20 2002
488@@ -62,6 +62,7 @@
489 obj-$(CONFIG_USB_MOUSE) += usbmouse.o
490 obj-$(CONFIG_USB_HID) += hid.o
491 obj-$(CONFIG_USB_KBD) += usbkbd.o
492+obj-$(CONFIG_USB_AIPTEK) += aiptek.o
493 obj-$(CONFIG_USB_WACOM) += wacom.o
494
495 obj-$(CONFIG_USB_SCANNER) += scanner.o
496@@ -69,6 +70,7 @@
497 obj-$(CONFIG_USB_PRINTER) += printer.o
498 obj-$(CONFIG_USB_AUDIO) += audio.o
499 obj-$(CONFIG_USB_EMI26) += emi26.o
500+obj-$(CONFIG_USB_MIDI) += usb-midi.o
501 obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o
502 obj-$(CONFIG_USB_PWC) += pwc.o
503 obj-$(CONFIG_USB_DC2XX) += dc2xx.o
504@@ -85,6 +87,7 @@
505 obj-$(CONFIG_USB_KAWETH) += kaweth.o
506 obj-$(CONFIG_USB_CDCETHER) += CDCEther.o
507 obj-$(CONFIG_USB_RIO500) += rio500.o
508+obj-$(CONFIG_USB_TIGL) += tiglusb.o
509 obj-$(CONFIG_USB_DSBR) += dsbr100.o
510 obj-$(CONFIG_USB_MICROTEK) += microtek.o
511 obj-$(CONFIG_USB_HPUSBSCSI) += hpusbscsi.o
512@@ -92,6 +95,7 @@
513 obj-$(CONFIG_USB_USBNET) += usbnet.o
514 obj-$(CONFIG_USB_AUERSWALD) += auerswald.o
515 obj-$(CONFIG_USB_BRLVGER) += brlvger.o
516+obj-$(CONFIG_USB_LCD) += usblcd.o
517
518 # Object files in subdirectories
519 mod-subdirs := serial hcd
520diff -Nur linux-2.4.19.org/drivers/usb/acm.c linux-2.4.19/drivers/usb/acm.c
521--- linux-2.4.19.org/drivers/usb/acm.c Fri Oct 5 21:06:08 2001
522+++ linux-2.4.19/drivers/usb/acm.c Thu Oct 31 08:11:20 2002
523@@ -184,7 +184,7 @@
524 static void acm_ctrl_irq(struct urb *urb)
525 {
526 struct acm *acm = urb->context;
527- devrequest *dr = urb->transfer_buffer;
528+ struct usb_ctrlrequest *dr = urb->transfer_buffer;
529 unsigned char *data = (unsigned char *)(dr + 1);
530 int newctrl;
531
532@@ -195,7 +195,7 @@
533 return;
534 }
535
536- switch (dr->request) {
537+ switch (dr->bRequest) {
538
539 case ACM_IRQ_NETWORK:
540
541@@ -223,7 +223,7 @@
542
543 default:
544 dbg("unknown control event received: request %d index %d len %d data0 %d data1 %d",
545- dr->request, dr->index, dr->length, data[0], data[1]);
546+ dr->bRequest, dr->wIndex, dr->wLength, data[0], data[1]);
547 return;
548 }
549 }
550diff -Nur linux-2.4.19.org/drivers/usb/aiptek.c linux-2.4.19/drivers/usb/aiptek.c
551--- linux-2.4.19.org/drivers/usb/aiptek.c Thu Jan 1 01:00:00 1970
552+++ linux-2.4.19/drivers/usb/aiptek.c Thu Oct 31 08:11:20 2002
553@@ -0,0 +1,332 @@
554+/*
555+ * Native support for the Aiptek 8000U
556+ *
557+ * Copyright (c) 2001 Chris Atenasio <chris@crud.net>
558+ *
559+ * based on wacom.c by
560+ * Vojtech Pavlik <vojtech@suse.cz>
561+ * Andreas Bach Aaen <abach@stofanet.dk>
562+ * Clifford Wolf <clifford@clifford.at>
563+ * Sam Mosel <sam.mosel@computer.org>
564+ * James E. Blair <corvus@gnu.org>
565+ * Daniel Egger <egger@suse.de>
566+ *
567+ *
568+ * Many thanks to Oliver Kuechemann for his support.
569+ *
570+ * ChangeLog:
571+ * v0.1 - Initial release
572+ * v0.2 - Hack to get around fake event 28's.
573+ * v0.3 - Make URB dynamic (Bryan W. Headley, Jun-8-2002)
574+ */
575+
576+/*
577+ * This program is free software; you can redistribute it and/or modify
578+ * it under the terms of the GNU General Public License as published by
579+ * the Free Software Foundation; either version 2 of the License, or
580+ * (at your option) any later version.
581+ *
582+ * This program is distributed in the hope that it will be useful,
583+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
584+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
585+ * GNU General Public License for more details.
586+ *
587+ * You should have received a copy of the GNU General Public License
588+ * along with this program; if not, write to the Free Software
589+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
590+ */
591+
592+#include <linux/kernel.h>
593+#include <linux/slab.h>
594+#include <linux/input.h>
595+#include <linux/module.h>
596+#include <linux/init.h>
597+#include <linux/usb.h>
598+
599+/*
600+ * Version Information
601+ */
602+#define DRIVER_VERSION "v0.3"
603+#define DRIVER_AUTHOR "Chris Atenasio <chris@crud.net>"
604+#define DRIVER_DESC "USB Aiptek 6000U/8000U tablet driver (Linux 2.4.x)"
605+
606+MODULE_AUTHOR(DRIVER_AUTHOR);
607+MODULE_DESCRIPTION(DRIVER_DESC);
608+MODULE_LICENSE("GPL");
609+
610+/*
611+ * Aiptek status packet:
612+ *
613+ * bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
614+ * byte0 0 0 0 0 0 0 1 0
615+ * byte1 X7 X6 X5 X4 X3 X2 X1 X0
616+ * byte2 X15 X14 X13 X12 X11 X10 X9 X8
617+ * byte3 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
618+ * byte4 Y15 Y14 Y13 Y12 Y11 Y10 Y9 Y8
619+ * byte5 * * * BS2 BS1 Tip DV IR
620+ * byte6 P7 P6 P5 P4 P3 P2 P1 P0
621+ * byte7 P15 P14 P13 P12 P11 P10 P9 P8
622+ *
623+ * IR: In Range = Proximity on
624+ * DV = Data Valid
625+ *
626+ *
627+ * Command Summary:
628+ *
629+ * Command/Data Description Return Bytes Return Value
630+ * 0x10/0x00 SwitchToMouse 0
631+ * 0x10/0x01 SwitchToTablet 0
632+ * 0x18/0x04 Resolution500LPI 0
633+ * 0x17/0x00 FilterOn 0
634+ * 0x12/0xFF AutoGainOn 0
635+ * 0x01/0x00 GetXExtension 2 MaxX
636+ * 0x01/0x01 GetYExtension 2 MaxY
637+ * 0x02/0x00 GetModelCode 2 ModelCode = LOBYTE
638+ * 0x03/0x00 GetODMCode 2 ODMCode
639+ * 0x08/0x00 GetPressureLevels 2 =512
640+ * 0x04/0x00 GetFirmwareVersion 2 Firmware Version
641+ *
642+ *
643+ * To initialize the tablet:
644+ *
645+ * (1) Send command Resolution500LPI
646+ * (2) Option Commands (GetXExtension, GetYExtension)
647+ * (3) Send command SwitchToTablet
648+ */
649+
650+#define USB_VENDOR_ID_AIPTEK 0x08ca
651+
652+struct aiptek_features {
653+ char *name;
654+ int pktlen;
655+ int x_max;
656+ int y_max;
657+ int pressure_min;
658+ int pressure_max;
659+ void (*irq) (struct urb * urb);
660+ unsigned long evbit;
661+ unsigned long absbit;
662+ unsigned long relbit;
663+ unsigned long btnbit;
664+ unsigned long digibit;
665+};
666+
667+struct aiptek {
668+ signed char data[10];
669+ struct input_dev dev;
670+ struct usb_device *usbdev;
671+ struct urb *irq;
672+ struct aiptek_features *features;
673+ int tool;
674+ int open;
675+};
676+
677+static void
678+aiptek_irq(struct urb *urb)
679+{
680+ struct aiptek *aiptek = urb->context;
681+ unsigned char *data = aiptek->data;
682+ struct input_dev *dev = &aiptek->dev;
683+ int x;
684+ int y;
685+ int pressure;
686+ int proximity;
687+
688+ if (urb->status)
689+ return;
690+
691+ if ((data[0] & 2) == 0) {
692+ dbg("received unknown report #%d", data[0]);
693+ }
694+
695+ proximity = data[5] & 0x01;
696+ input_report_key(dev, BTN_TOOL_PEN, proximity);
697+
698+ x = ((__u32) data[1]) | ((__u32) data[2] << 8);
699+ y = ((__u32) data[3]) | ((__u32) data[4] << 8);
700+ pressure = ((__u32) data[6]) | ((__u32) data[7] << 8);
701+ pressure -= aiptek->features->pressure_min;
702+
703+ if (pressure < 0) {
704+ pressure = 0;
705+ }
706+
707+ if (proximity) {
708+ input_report_abs(dev, ABS_X, x);
709+ input_report_abs(dev, ABS_Y, y);
710+ input_report_abs(dev, ABS_PRESSURE, pressure);
711+ input_report_key(dev, BTN_TOUCH, data[5] & 0x04);
712+ input_report_key(dev, BTN_STYLUS, data[5] & 0x08);
713+ input_report_key(dev, BTN_STYLUS2, data[5] & 0x10);
714+ }
715+
716+}
717+
718+struct aiptek_features aiptek_features[] = {
719+ {"Aiptek 6000U/8000U",
720+ 8, 3000, 2250, 26, 511, aiptek_irq, 0, 0, 0, 0},
721+ {NULL, 0}
722+};
723+
724+struct usb_device_id aiptek_ids[] = {
725+ {USB_DEVICE(USB_VENDOR_ID_AIPTEK, 0x20), driver_info:0},
726+ {}
727+};
728+
729+MODULE_DEVICE_TABLE(usb, aiptek_ids);
730+
731+static int
732+aiptek_open(struct input_dev *dev)
733+{
734+ struct aiptek *aiptek = dev->private;
735+
736+ if (aiptek->open++)
737+ return 0;
738+
739+ aiptek->irq->dev = aiptek->usbdev;
740+ if (usb_submit_urb(aiptek->irq))
741+ return -EIO;
742+
743+ return 0;
744+}
745+
746+static void
747+aiptek_close(struct input_dev *dev)
748+{
749+ struct aiptek *aiptek = dev->private;
750+
751+ if (!--aiptek->open)
752+ usb_unlink_urb(aiptek->irq);
753+}
754+
755+static void
756+aiptek_command(struct usb_device *dev, unsigned int ifnum,
757+ unsigned char command, unsigned char data)
758+{
759+ __u8 buf[3];
760+
761+ buf[0] = 4;
762+ buf[1] = command;
763+ buf[2] = data;
764+
765+ if (usb_set_report(dev, ifnum, 3, 2, buf, 3) != 3) {
766+ dbg("aiptek_command: 0x%x 0x%x\n", command, data);
767+ }
768+}
769+
770+static void*
771+aiptek_probe(struct usb_device *dev, unsigned int ifnum,
772+ const struct usb_device_id *id)
773+{
774+ struct usb_endpoint_descriptor *endpoint;
775+ struct aiptek *aiptek;
776+
777+ if (!(aiptek = kmalloc(sizeof (struct aiptek), GFP_KERNEL)))
778+ return NULL;
779+
780+ memset(aiptek, 0, sizeof (struct aiptek));
781+
782+ aiptek->irq = usb_alloc_urb(0);
783+ if (!aiptek->irq) {
784+ kfree(aiptek);
785+ return NULL;
786+ }
787+
788+ // Resolution500LPI
789+ aiptek_command(dev, ifnum, 0x18, 0x04);
790+
791+ // SwitchToTablet
792+ aiptek_command(dev, ifnum, 0x10, 0x01);
793+
794+ aiptek->features = aiptek_features + id->driver_info;
795+
796+ aiptek->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_MSC) |
797+ aiptek->features->evbit;
798+
799+ aiptek->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) |
800+ BIT(ABS_MISC) | aiptek->features->absbit;
801+
802+ aiptek->dev.relbit[0] |= aiptek->features->relbit;
803+
804+ aiptek->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) |
805+ BIT(BTN_MIDDLE) | aiptek->features->btnbit;
806+
807+ aiptek->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) |
808+ BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOUCH) |
809+ BIT(BTN_STYLUS) | BIT(BTN_STYLUS2) | aiptek->features->digibit;
810+
811+ aiptek->dev.mscbit[0] = BIT(MSC_SERIAL);
812+
813+ aiptek->dev.absmax[ABS_X] = aiptek->features->x_max;
814+ aiptek->dev.absmax[ABS_Y] = aiptek->features->y_max;
815+ aiptek->dev.absmax[ABS_PRESSURE] = aiptek->features->pressure_max -
816+ aiptek->features->pressure_min;
817+
818+ aiptek->dev.absfuzz[ABS_X] = 0;
819+ aiptek->dev.absfuzz[ABS_Y] = 0;
820+
821+ aiptek->dev.private = aiptek;
822+ aiptek->dev.open = aiptek_open;
823+ aiptek->dev.close = aiptek_close;
824+
825+ aiptek->dev.name = aiptek->features->name;
826+ aiptek->dev.idbus = BUS_USB;
827+ aiptek->dev.idvendor = dev->descriptor.idVendor;
828+ aiptek->dev.idproduct = dev->descriptor.idProduct;
829+ aiptek->dev.idversion = dev->descriptor.bcdDevice;
830+ aiptek->usbdev = dev;
831+
832+ endpoint = dev->config[0].interface[ifnum].altsetting[0].endpoint + 0;
833+
834+ FILL_INT_URB(aiptek->irq,
835+ dev,
836+ usb_rcvintpipe(dev, endpoint->bEndpointAddress),
837+ aiptek->data,
838+ aiptek->features->pktlen,
839+ aiptek->features->irq,
840+ aiptek,
841+ endpoint->bInterval);
842+
843+ input_register_device(&aiptek->dev);
844+
845+ printk(KERN_INFO "input%d: %s on usb%d:%d.%d\n",
846+ aiptek->dev.number, aiptek->features->name, dev->bus->busnum,
847+ dev->devnum, ifnum);
848+
849+ return aiptek;
850+}
851+
852+static void
853+aiptek_disconnect(struct usb_device *dev, void *ptr)
854+{
855+ struct aiptek *aiptek = ptr;
856+ usb_unlink_urb(aiptek->irq);
857+ input_unregister_device(&aiptek->dev);
858+ usb_free_urb(aiptek->irq);
859+ kfree(aiptek);
860+}
861+
862+static struct usb_driver aiptek_driver = {
863+ name:"aiptek",
864+ probe:aiptek_probe,
865+ disconnect:aiptek_disconnect,
866+ id_table:aiptek_ids,
867+};
868+
869+static int __init
870+aiptek_init(void)
871+{
872+ usb_register(&aiptek_driver);
873+ info(DRIVER_VERSION " " DRIVER_AUTHOR);
874+ info(DRIVER_DESC);
875+ return 0;
876+}
877+
878+static void __exit
879+aiptek_exit(void)
880+{
881+ usb_deregister(&aiptek_driver);
882+}
883+
884+module_init(aiptek_init);
885+module_exit(aiptek_exit);
886diff -Nur linux-2.4.19.org/drivers/usb/audio.c linux-2.4.19/drivers/usb/audio.c
887--- linux-2.4.19.org/drivers/usb/audio.c Sat Aug 3 02:39:44 2002
888+++ linux-2.4.19/drivers/usb/audio.c Thu Oct 31 08:11:20 2002
889@@ -297,13 +297,13 @@
890 #define FLG_CONNECTED 32
891
892 struct my_data_urb {
893- urb_t urb;
894- iso_packet_descriptor_t isoframe[DESCFRAMES];
895+ struct urb urb;
896+ struct iso_packet_descriptor isoframe[DESCFRAMES];
897 };
898
899 struct my_sync_urb {
900- urb_t urb;
901- iso_packet_descriptor_t isoframe[SYNCFRAMES];
902+ struct urb urb;
903+ struct iso_packet_descriptor isoframe[SYNCFRAMES];
904 };
905
906
907@@ -833,7 +833,7 @@
908 }
909 }
910
911-static int usbin_prepare_desc(struct usbin *u, purb_t urb)
912+static int usbin_prepare_desc(struct usbin *u, struct urb *urb)
913 {
914 unsigned int i, maxsize, offs;
915
916@@ -850,7 +850,7 @@
917 * return value: 0 if descriptor should be restarted, -1 otherwise
918 * convert sample format on the fly if necessary
919 */
920-static int usbin_retire_desc(struct usbin *u, purb_t urb)
921+static int usbin_retire_desc(struct usbin *u, struct urb *urb)
922 {
923 unsigned int i, ufmtsh, dfmtsh, err = 0, cnt, scnt, dmafree;
924 unsigned char *cp;
925@@ -930,7 +930,7 @@
926 /*
927 * we output sync data
928 */
929-static int usbin_sync_prepare_desc(struct usbin *u, purb_t urb)
930+static int usbin_sync_prepare_desc(struct usbin *u, struct urb *urb)
931 {
932 unsigned char *cp = urb->transfer_buffer;
933 unsigned int i, offs;
934@@ -948,7 +948,7 @@
935 /*
936 * return value: 0 if descriptor should be restarted, -1 otherwise
937 */
938-static int usbin_sync_retire_desc(struct usbin *u, purb_t urb)
939+static int usbin_sync_retire_desc(struct usbin *u, struct urb *urb)
940 {
941 unsigned int i;
942
943@@ -996,7 +996,7 @@
944 {
945 struct usb_device *dev = as->state->usbdev;
946 struct usbin *u = &as->usbin;
947- purb_t urb;
948+ struct urb *urb;
949 unsigned long flags;
950 unsigned int maxsze, bufsz;
951
952@@ -1186,7 +1186,7 @@
953 }
954 }
955
956-static int usbout_prepare_desc(struct usbout *u, purb_t urb)
957+static int usbout_prepare_desc(struct usbout *u, struct urb *urb)
958 {
959 unsigned int i, ufmtsh, dfmtsh, err = 0, cnt, scnt, offs;
960 unsigned char *cp = urb->transfer_buffer;
961@@ -1238,7 +1238,7 @@
962 /*
963 * return value: 0 if descriptor should be restarted, -1 otherwise
964 */
965-static int usbout_retire_desc(struct usbout *u, purb_t urb)
966+static int usbout_retire_desc(struct usbout *u, struct urb *urb)
967 {
968 unsigned int i;
969
970@@ -1285,7 +1285,7 @@
971 spin_unlock_irqrestore(&as->lock, flags);
972 }
973
974-static int usbout_sync_prepare_desc(struct usbout *u, purb_t urb)
975+static int usbout_sync_prepare_desc(struct usbout *u, struct urb *urb)
976 {
977 unsigned int i, offs;
978
979@@ -1299,7 +1299,7 @@
980 /*
981 * return value: 0 if descriptor should be restarted, -1 otherwise
982 */
983-static int usbout_sync_retire_desc(struct usbout *u, purb_t urb)
984+static int usbout_sync_retire_desc(struct usbout *u, struct urb *urb)
985 {
986 unsigned char *cp = urb->transfer_buffer;
987 unsigned int f, i;
988@@ -1361,7 +1361,7 @@
989 {
990 struct usb_device *dev = as->state->usbdev;
991 struct usbout *u = &as->usbout;
992- purb_t urb;
993+ struct urb *urb;
994 unsigned long flags;
995 unsigned int maxsze, bufsz;
996
997diff -Nur linux-2.4.19.org/drivers/usb/auerswald.c linux-2.4.19/drivers/usb/auerswald.c
998--- linux-2.4.19.org/drivers/usb/auerswald.c Sat Aug 3 02:39:44 2002
999+++ linux-2.4.19/drivers/usb/auerswald.c Thu Oct 31 08:11:20 2002
1000@@ -2,7 +2,7 @@
1001 /*
1002 * auerswald.c -- Auerswald PBX/System Telephone usb driver.
1003 *
1004