diff options
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 309 |
1 files changed, 2 insertions, 307 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 08f600327db4..fde09fba8790 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * USB Serial Converter driver | 2 | * USB Serial Converter driver |
3 | * | 3 | * |
4 | * Copyright (C) 1999 - 2004 Greg Kroah-Hartman (greg@kroah.com) | 4 | * Copyright (C) 1999 - 2005 Greg Kroah-Hartman (greg@kroah.com) |
5 | * Copyright (C) 2000 Peter Berger (pberger@brimson.com) | 5 | * Copyright (C) 2000 Peter Berger (pberger@brimson.com) |
6 | * Copyright (C) 2000 Al Borchers (borchers@steinerpoint.com) | 6 | * Copyright (C) 2000 Al Borchers (borchers@steinerpoint.com) |
7 | * | 7 | * |
@@ -9,316 +9,11 @@ | |||
9 | * modify it under the terms of the GNU General Public License version | 9 | * modify it under the terms of the GNU General Public License version |
10 | * 2 as published by the Free Software Foundation. | 10 | * 2 as published by the Free Software Foundation. |
11 | * | 11 | * |
12 | * This driver was originally based on the ACM driver by Armin Fuerst (which was | 12 | * This driver was originally based on the ACM driver by Armin Fuerst (which was |
13 | * based on a driver by Brad Keryan) | 13 | * based on a driver by Brad Keryan) |
14 | * | 14 | * |
15 | * See Documentation/usb/usb-serial.txt for more information on using this driver | 15 | * See Documentation/usb/usb-serial.txt for more information on using this driver |
16 | * | 16 | * |
17 | * (12/10/2002) gkh | ||
18 | * Split the ports off into their own struct device, and added a | ||
19 | * usb-serial bus driver. | ||
20 | * | ||
21 | * (11/19/2002) gkh | ||
22 | * removed a few #ifdefs for the generic code and cleaned up the failure | ||
23 | * logic in initialization. | ||
24 | * | ||
25 | * (10/02/2002) gkh | ||
26 | * moved the console code to console.c and out of this file. | ||
27 | * | ||
28 | * (06/05/2002) gkh | ||
29 | * moved location of startup() call in serial_probe() until after all | ||
30 | * of the port information and endpoints are initialized. This makes | ||
31 | * things easier for some drivers. | ||
32 | * | ||
33 | * (04/10/2002) gkh | ||
34 | * added serial_read_proc function which creates a | ||
35 | * /proc/tty/driver/usb-serial file. | ||
36 | * | ||
37 | * (03/27/2002) gkh | ||
38 | * Got USB serial console code working properly and merged into the main | ||
39 | * version of the tree. Thanks to Randy Dunlap for the initial version | ||
40 | * of this code, and for pushing me to finish it up. | ||
41 | * The USB serial console works with any usb serial driver device. | ||
42 | * | ||
43 | * (03/21/2002) gkh | ||
44 | * Moved all manipulation of port->open_count into the core. Now the | ||
45 | * individual driver's open and close functions are called only when the | ||
46 | * first open() and last close() is called. Making the drivers a bit | ||
47 | * smaller and simpler. | ||
48 | * Fixed a bug if a driver didn't have the owner field set. | ||
49 | * | ||
50 | * (02/26/2002) gkh | ||
51 | * Moved all locking into the main serial_* functions, instead of having | ||
52 | * the individual drivers have to grab the port semaphore. This should | ||
53 | * reduce races. | ||
54 | * Reworked the MOD_INC logic a bit to always increment and decrement, even | ||
55 | * if the generic driver is being used. | ||
56 | * | ||
57 | * (10/10/2001) gkh | ||
58 | * usb_serial_disconnect() now sets the serial->dev pointer is to NULL to | ||
59 | * help prevent child drivers from accessing the device since it is now | ||
60 | * gone. | ||
61 | * | ||
62 | * (09/13/2001) gkh | ||
63 | * Moved generic driver initialize after we have registered with the USB | ||
64 | * core. Thanks to Randy Dunlap for pointing this problem out. | ||
65 | * | ||
66 | * (07/03/2001) gkh | ||
67 | * Fixed module paramater size. Thanks to John Brockmeyer for the pointer. | ||
68 | * Fixed vendor and product getting defined through the MODULE_PARM macro | ||
69 | * if the Generic driver wasn't compiled in. | ||
70 | * Fixed problem with generic_shutdown() not being called for drivers that | ||
71 | * don't have a shutdown() function. | ||
72 | * | ||
73 | * (06/06/2001) gkh | ||
74 | * added evil hack that is needed for the prolific pl2303 device due to the | ||
75 | * crazy way its endpoints are set up. | ||
76 | * | ||
77 | * (05/30/2001) gkh | ||
78 | * switched from using spinlock to a semaphore, which fixes lots of problems. | ||
79 | * | ||
80 | * (04/08/2001) gb | ||
81 | * Identify version on module load. | ||
82 | * | ||
83 | * 2001_02_05 gkh | ||
84 | * Fixed buffer overflows bug with the generic serial driver. Thanks to | ||
85 | * Todd Squires <squirest@ct0.com> for fixing this. | ||
86 | * | ||
87 | * (01/10/2001) gkh | ||
88 | * Fixed bug where the generic serial adaptor grabbed _any_ device that was | ||
89 | * offered to it. | ||
90 | * | ||
91 | * (12/12/2000) gkh | ||
92 | * Removed MOD_INC and MOD_DEC from poll and disconnect functions, and | ||
93 | * moved them to the serial_open and serial_close functions. | ||
94 | * Also fixed bug with there not being a MOD_DEC for the generic driver | ||
95 | * (thanks to Gary Brubaker for finding this.) | ||
96 | * | ||
97 | * (11/29/2000) gkh | ||
98 | * Small NULL pointer initialization cleanup which saves a bit of disk image | ||
99 | * | ||
100 | * (11/01/2000) Adam J. Richter | ||
101 | * instead of using idVendor/idProduct pairs, usb serial drivers | ||
102 | * now identify their hardware interest with usb_device_id tables, | ||
103 | * which they usually have anyhow for use with MODULE_DEVICE_TABLE. | ||
104 | * | ||
105 | * (10/05/2000) gkh | ||
106 | * Fixed bug with urb->dev not being set properly, now that the usb | ||
107 | * core needs it. | ||
108 | * | ||
109 | * (09/11/2000) gkh | ||
110 | * Removed DEBUG #ifdefs with call to usb_serial_debug_data | ||
111 | * | ||
112 | * (08/28/2000) gkh | ||
113 | * Added port_lock to port structure. | ||
114 | * Added locks for SMP safeness to generic driver | ||
115 | * Fixed the ability to open a generic device's port more than once. | ||
116 | * | ||
117 | * (07/23/2000) gkh | ||
118 | * Added bulk_out_endpointAddress to port structure. | ||
119 | * | ||
120 | * (07/19/2000) gkh, pberger, and borchers | ||
121 | * Modifications to allow usb-serial drivers to be modules. | ||
122 | * | ||
123 | * (07/03/2000) gkh | ||
124 | * Added more debugging to serial_ioctl call | ||
125 | * | ||
126 | * (06/25/2000) gkh | ||
127 | * Changed generic_write_bulk_callback to not call wake_up_interruptible | ||
128 | * directly, but to have port_softint do it at a safer time. | ||
129 | * | ||
130 | * (06/23/2000) gkh | ||
131 | * Cleaned up debugging statements in a quest to find UHCI timeout bug. | ||
132 | * | ||
133 | * (05/22/2000) gkh | ||
134 | * Changed the makefile, enabling the big CONFIG_USB_SERIAL_SOMTHING to be | ||
135 | * removed from the individual device source files. | ||
136 | * | ||
137 | * (05/03/2000) gkh | ||
138 | * Added the Digi Acceleport driver from Al Borchers and Peter Berger. | ||
139 | * | ||
140 | * (05/02/2000) gkh | ||
141 | * Changed devfs and tty register code to work properly now. This was based on | ||
142 | * the ACM driver changes by Vojtech Pavlik. | ||
143 | * | ||
144 | * (04/27/2000) Ryan VanderBijl | ||
145 | * Put calls to *_paranoia_checks into one function. | ||
146 | * | ||
147 | * (04/23/2000) gkh | ||
148 | * Fixed bug that Randy Dunlap found for Generic devices with no bulk out ports. | ||
149 | * Moved when the startup code printed out the devices that are supported. | ||
150 | * | ||
151 | * (04/19/2000) gkh | ||
152 | * Added driver for ZyXEL omni.net lcd plus ISDN TA | ||
153 | * Made startup info message specify which drivers were compiled in. | ||
154 | * | ||
155 | * (04/03/2000) gkh | ||
156 | * Changed the probe process to remove the module unload races. | ||
157 | * Changed where the tty layer gets initialized to have devfs work nicer. | ||
158 | * Added initial devfs support. | ||
159 | * | ||
160 | * (03/26/2000) gkh | ||
161 | * Split driver up into device specific pieces. | ||
162 | * | ||
163 | * (03/19/2000) gkh | ||
164 | * Fixed oops that could happen when device was removed while a program | ||
165 | * was talking to the device. | ||
166 | * Removed the static urbs and now all urbs are created and destroyed | ||
167 | * dynamically. | ||
168 | * Reworked the internal interface. Now everything is based on the | ||
169 | * usb_serial_port structure instead of the larger usb_serial structure. | ||
170 | * This fixes the bug that a multiport device could not have more than | ||
171 | * one port open at one time. | ||
172 | * | ||
173 | * (03/17/2000) gkh | ||
174 | * Added config option for debugging messages. | ||
175 | * Added patch for keyspan pda from Brian Warner. | ||
176 | * | ||
177 | * (03/06/2000) gkh | ||
178 | * Added the keyspan pda code from Brian Warner <warner@lothar.com> | ||
179 | * Moved a bunch of the port specific stuff into its own structure. This | ||
180 | * is in anticipation of the true multiport devices (there's a bug if you | ||
181 | * try to access more than one port of any multiport device right now) | ||
182 | * | ||
183 | * (02/21/2000) gkh | ||
184 | * Made it so that any serial devices only have to specify which functions | ||
185 | * they want to overload from the generic function calls (great, | ||
186 | * inheritance in C, in a driver, just what I wanted...) | ||
187 | * Added support for set_termios and ioctl function calls. No drivers take | ||
188 | * advantage of this yet. | ||
189 | * Removed the #ifdef MODULE, now there is no module specific code. | ||
190 | * Cleaned up a few comments in usb-serial.h that were wrong (thanks again | ||
191 | * to Miles Lott). | ||
192 | * Small fix to get_free_serial. | ||
193 | * | ||
194 | * (02/14/2000) gkh | ||
195 | * Removed the Belkin and Peracom functionality from the driver due to | ||
196 | * the lack of support from the vendor, and me not wanting people to | ||
197 | * accidenatly buy the device, expecting it to work with Linux. | ||
198 | * Added read_bulk_callback and write_bulk_callback to the type structure | ||
199 | * for the needs of the FTDI and WhiteHEAT driver. | ||
200 | * Changed all reverences to FTDI to FTDI_SIO at the request of Bill | ||
201 | * Ryder. | ||
202 | * Changed the output urb size back to the max endpoint size to make | ||
203 | * the ftdi_sio driver have it easier, and due to the fact that it didn't | ||
204 | * really increase the speed any. | ||
205 | * | ||
206 | * (02/11/2000) gkh | ||
207 | * Added VISOR_FUNCTION_CONSOLE to the visor startup function. This was a | ||
208 | * patch from Miles Lott (milos@insync.net). | ||
209 | * Fixed bug with not restoring the minor range that a device grabs, if | ||
210 | * the startup function fails (thanks Miles for finding this). | ||
211 | * | ||
212 | * (02/05/2000) gkh | ||
213 | * Added initial framework for the Keyspan PDA serial converter so that | ||
214 | * Brian Warner has a place to put his code. | ||
215 | * Made the ezusb specific functions generic enough that different | ||
216 | * devices can use them (whiteheat and keyspan_pda both need them). | ||
217 | * Split out a whole bunch of structure and other stuff to a separate | ||
218 | * usb-serial.h file. | ||
219 | * Made the Visor connection messages a little more understandable, now | ||
220 | * that Miles Lott (milos@insync.net) has gotten the Generic channel to | ||
221 | * work. Also made them always show up in the log file. | ||
222 | * | ||
223 | * (01/25/2000) gkh | ||
224 | * Added initial framework for FTDI serial converter so that Bill Ryder | ||
225 | * has a place to put his code. | ||
226 | * Added the vendor specific info from Handspring. Now we can print out | ||
227 | * informational debug messages as well as understand what is happening. | ||
228 | * | ||
229 | * (01/23/2000) gkh | ||
230 | * Fixed problem of crash when trying to open a port that didn't have a | ||
231 | * device assigned to it. Made the minor node finding a little smarter, | ||
232 | * now it looks to find a continuous space for the new device. | ||
233 | * | ||
234 | * (01/21/2000) gkh | ||
235 | * Fixed bug in visor_startup with patch from Miles Lott (milos@insync.net) | ||
236 | * Fixed get_serial_by_minor which was all messed up for multi port | ||
237 | * devices. Fixed multi port problem for generic devices. Now the number | ||
238 | * of ports is determined by the number of bulk out endpoints for the | ||
239 | * generic device. | ||
240 | * | ||
241 | * (01/19/2000) gkh | ||
242 | * Removed lots of cruft that was around from the old (pre urb) driver | ||
243 | * interface. | ||
244 | * Made the serial_table dynamic. This should save lots of memory when | ||
245 | * the number of minor nodes goes up to 256. | ||
246 | * Added initial support for devices that have more than one port. | ||
247 | * Added more debugging comments for the Visor, and added a needed | ||
248 | * set_configuration call. | ||
249 | * | ||
250 | * (01/17/2000) gkh | ||
251 | * Fixed the WhiteHEAT firmware (my processing tool had a bug) | ||
252 | * and added new debug loader firmware for it. | ||
253 | * Removed the put_char function as it isn't really needed. | ||
254 | * Added visor startup commands as found by the Win98 dump. | ||
255 | * | ||
256 | * (01/13/2000) gkh | ||
257 | * Fixed the vendor id for the generic driver to the one I meant it to be. | ||
258 | * | ||
259 | * (01/12/2000) gkh | ||
260 | * Forget the version numbering...that's pretty useless... | ||
261 | * Made the driver able to be compiled so that the user can select which | ||
262 | * converter they want to use. This allows people who only want the Visor | ||
263 | * support to not pay the memory size price of the WhiteHEAT. | ||
264 | * Fixed bug where the generic driver (idVendor=0000 and idProduct=0000) | ||
265 | * grabbed the root hub. Not good. | ||
266 | * | ||
267 | * version 0.4.0 (01/10/2000) gkh | ||
268 | * Added whiteheat.h containing the firmware for the ConnectTech WhiteHEAT | ||
269 | * device. Added startup function to allow firmware to be downloaded to | ||
270 | * a device if it needs to be. | ||
271 | * Added firmware download logic to the WhiteHEAT device. | ||
272 | * Started to add #defines to split up the different drivers for potential | ||
273 | * configuration option. | ||
274 | * | ||
275 | * version 0.3.1 (12/30/99) gkh | ||
276 | * Fixed problems with urb for bulk out. | ||
277 | * Added initial support for multiple sets of endpoints. This enables | ||
278 | * the Handspring Visor to be attached successfully. Only the first | ||
279 | * bulk in / bulk out endpoint pair is being used right now. | ||
280 | * | ||
281 | * version 0.3.0 (12/27/99) gkh | ||
282 | * Added initial support for the Handspring Visor based on a patch from | ||
283 | * Miles Lott (milos@sneety.insync.net) | ||
284 | * Cleaned up the code a bunch and converted over to using urbs only. | ||
285 | * | ||
286 | * version 0.2.3 (12/21/99) gkh | ||
287 | * Added initial support for the Connect Tech WhiteHEAT converter. | ||
288 | * Incremented the number of ports in expectation of getting the | ||
289 | * WhiteHEAT to work properly (4 ports per connection). | ||
290 | * Added notification on insertion and removal of what port the | ||
291 | * device is/was connected to (and what kind of device it was). | ||
292 | * | ||
293 | * version 0.2.2 (12/16/99) gkh | ||
294 | * Changed major number to the new allocated number. We're legal now! | ||
295 | * | ||
296 | * version 0.2.1 (12/14/99) gkh | ||
297 | * Fixed bug that happens when device node is opened when there isn't a | ||
298 | * device attached to it. Thanks to marek@webdesign.no for noticing this. | ||
299 | * | ||
300 | * version 0.2.0 (11/10/99) gkh | ||
301 | * Split up internals to make it easier to add different types of serial | ||
302 | * converters to the code. | ||
303 | * Added a "generic" driver that gets it's vendor and product id | ||
304 | * from when the module is loaded. Thanks to David E. Nelson (dnelson@jump.net) | ||
305 | * for the idea and sample code (from the usb scanner driver.) | ||
306 | * Cleared up any licensing questions by releasing it under the GNU GPL. | ||
307 | * | ||
308 | * version 0.1.2 (10/25/99) gkh | ||
309 | * Fixed bug in detecting device. | ||
310 | * | ||
311 | * version 0.1.1 (10/05/99) gkh | ||
312 | * Changed the major number to not conflict with anything else. | ||
313 | * | ||
314 | * version 0.1 (09/28/99) gkh | ||
315 | * Can recognize the two different devices and start up a read from | ||
316 | * device when asked to. Writes also work. No control signals yet, this | ||
317 | * all is vendor specific data (i.e. no spec), also no control for | ||
318 | * different baud rates or other bit settings. | ||
319 | * Currently we are using the same devid as the acm driver. This needs | ||
320 | * to change. | ||
321 | * | ||
322 | */ | 17 | */ |
323 | 18 | ||
324 | #include <linux/config.h> | 19 | #include <linux/config.h> |