2 * Prolific PL2303 USB to serial adaptor driver
4 * Copyright (C) 2001-2002 Greg Kroah-Hartman (greg@kroah.com)
6 * Original driver for 2.2.x by anonymous
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * See Documentation/usb/usb-serial.txt for more information on using this driver
16 * allowed driver to work properly if there is no tty assigned to a port
17 * (this happens for serial console devices.)
20 * Added RTS and DTR line control. Thanks to joe@bndlg.de for parts of it.
23 * Added break support.
26 * fixed oops in write_bulk_callback.
29 * reworked buffer logic to be like other usb-serial drivers. Hopefully
30 * removing some reported problems.
33 * finished porting to 2.4 format.
37 #include <linux/config.h>
38 #include <linux/kernel.h>
39 #include <linux/errno.h>
40 #include <linux/init.h>
41 #include <linux/slab.h>
42 #include <linux/tty.h>
43 #include <linux/tty_driver.h>
44 #include <linux/tty_flip.h>
45 #include <linux/serial.h>
46 #include <linux/module.h>
47 #include <linux/spinlock.h>
48 #include <asm/uaccess.h>
49 #include <linux/usb.h>
51 #ifdef CONFIG_USB_SERIAL_DEBUG
57 #include "usb-serial.h"
63 #define DRIVER_VERSION "v0.9"
64 #define DRIVER_DESC "Prolific PL2303 USB to serial adaptor driver"
68 static struct usb_device_id id_table
[] = {
69 { USB_DEVICE(PL2303_VENDOR_ID
, PL2303_PRODUCT_ID
) },
70 { USB_DEVICE(PL2303_VENDOR_ID
, PL2303_PRODUCT_ID_RSAQ2
) },
71 { USB_DEVICE(IODATA_VENDOR_ID
, IODATA_PRODUCT_ID
) },
72 { USB_DEVICE(ATEN_VENDOR_ID
, ATEN_PRODUCT_ID
) },
73 { USB_DEVICE(ELCOM_VENDOR_ID
, ELCOM_PRODUCT_ID
) },
74 { USB_DEVICE(ITEGNO_VENDOR_ID
, ITEGNO_PRODUCT_ID
) },
75 { USB_DEVICE(MA620_VENDOR_ID
, MA620_PRODUCT_ID
) },
76 { USB_DEVICE(RATOC_VENDOR_ID
, RATOC_PRODUCT_ID
) },
77 { } /* Terminating entry */
80 MODULE_DEVICE_TABLE (usb
, id_table
);
82 static struct usb_driver pl2303_driver
= {
84 .probe
= usb_serial_probe
,
85 .disconnect
= usb_serial_disconnect
,
89 #define SET_LINE_REQUEST_TYPE 0x21
90 #define SET_LINE_REQUEST 0x20
92 #define SET_CONTROL_REQUEST_TYPE 0x21
93 #define SET_CONTROL_REQUEST 0x22
94 #define CONTROL_DTR 0x01
95 #define CONTROL_RTS 0x02
97 #define BREAK_REQUEST_TYPE 0x21
98 #define BREAK_REQUEST 0x23
99 #define BREAK_ON 0xffff
100 #define BREAK_OFF 0x0000
102 #define GET_LINE_REQUEST_TYPE 0xa1
103 #define GET_LINE_REQUEST 0x21
105 #define VENDOR_WRITE_REQUEST_TYPE 0x40
106 #define VENDOR_WRITE_REQUEST 0x01
108 #define VENDOR_READ_REQUEST_TYPE 0xc0
109 #define VENDOR_READ_REQUEST 0x01
111 /* function prototypes for a PL2303 serial converter */
112 static int pl2303_open (struct usb_serial_port
*port
, struct file
*filp
);
113 static void pl2303_close (struct usb_serial_port
*port
, struct file
*filp
);
114 static void pl2303_set_termios (struct usb_serial_port
*port
,
115 struct termios
*old
);
116 static int pl2303_ioctl (struct usb_serial_port
*port
, struct file
*file
,
117 unsigned int cmd
, unsigned long arg
);
118 static void pl2303_read_int_callback (struct urb
*urb
, struct pt_regs
*regs
);
119 static void pl2303_read_bulk_callback (struct urb
*urb
, struct pt_regs
*regs
);
120 static void pl2303_write_bulk_callback (struct urb
*urb
, struct pt_regs
*regs
);
121 static int pl2303_write (struct usb_serial_port
*port
, int from_user
,
122 const unsigned char *buf
, int count
);
123 static void pl2303_break_ctl(struct usb_serial_port
*port
,int break_state
);
124 static int pl2303_startup (struct usb_serial
*serial
);
125 static void pl2303_shutdown (struct usb_serial
*serial
);
128 /* All of the device info needed for the PL2303 SIO serial converter */
129 static struct usb_serial_device_type pl2303_device
= {
130 .owner
= THIS_MODULE
,
132 .id_table
= id_table
,
133 .num_interrupt_in
= NUM_DONT_CARE
,
138 .close
= pl2303_close
,
139 .write
= pl2303_write
,
140 .ioctl
= pl2303_ioctl
,
141 .break_ctl
= pl2303_break_ctl
,
142 .set_termios
= pl2303_set_termios
,
143 .read_bulk_callback
= pl2303_read_bulk_callback
,
144 .read_int_callback
= pl2303_read_int_callback
,
145 .write_bulk_callback
= pl2303_write_bulk_callback
,
146 .attach
= pl2303_startup
,
147 .shutdown
= pl2303_shutdown
,
150 struct pl2303_private
{
152 u8 termios_initialized
;
156 static int pl2303_startup (struct usb_serial
*serial
)
158 struct pl2303_private
*priv
;
161 for (i
= 0; i
< serial
->num_ports
; ++i
) {
162 priv
= kmalloc (sizeof (struct pl2303_private
), GFP_KERNEL
);
165 memset (priv
, 0x00, sizeof (struct pl2303_private
));
166 usb_set_serial_port_data(&serial
->port
[i
], priv
);
171 static int set_control_lines (struct usb_device
*dev
, u8 value
)
175 retval
= usb_control_msg (dev
, usb_sndctrlpipe (dev
, 0),
176 SET_CONTROL_REQUEST
, SET_CONTROL_REQUEST_TYPE
,
177 value
, 0, NULL
, 0, 100);
178 dbg("%s - value = %d, retval = %d", __FUNCTION__
, value
, retval
);
182 static int pl2303_write (struct usb_serial_port
*port
, int from_user
, const unsigned char *buf
, int count
)
186 dbg("%s - port %d, %d bytes", __FUNCTION__
, port
->number
, count
);
188 if (port
->write_urb
->status
== -EINPROGRESS
) {
189 dbg("%s - already writing", __FUNCTION__
);
193 count
= (count
> port
->bulk_out_size
) ? port
->bulk_out_size
: count
;
195 if (copy_from_user (port
->write_urb
->transfer_buffer
, buf
, count
))
198 memcpy (port
->write_urb
->transfer_buffer
, buf
, count
);
201 usb_serial_debug_data (__FILE__
, __FUNCTION__
, count
, port
->write_urb
->transfer_buffer
);
203 port
->write_urb
->transfer_buffer_length
= count
;
204 port
->write_urb
->dev
= port
->serial
->dev
;
205 result
= usb_submit_urb (port
->write_urb
, GFP_ATOMIC
);
207 dev_err(&port
->dev
, "%s - failed submitting write urb, error %d\n", __FUNCTION__
, result
);
216 static void pl2303_set_termios (struct usb_serial_port
*port
, struct termios
*old_termios
)
218 struct usb_serial
*serial
= port
->serial
;
219 struct pl2303_private
*priv
= usb_get_serial_port_data(port
);
225 dbg("%s - port %d, initialized = %d", __FUNCTION__
, port
->number
, priv
->termios_initialized
);
227 if ((!port
->tty
) || (!port
->tty
->termios
)) {
228 dbg("%s - no tty structures", __FUNCTION__
);
232 if (!priv
->termios_initialized
) {
233 *(port
->tty
->termios
) = tty_std_termios
;
234 port
->tty
->termios
->c_cflag
= B9600
| CS8
| CREAD
| HUPCL
| CLOCAL
;
235 priv
->termios_initialized
= 1;
237 cflag
= port
->tty
->termios
->c_cflag
;
238 /* check that they really want us to change something */
240 if ((cflag
== old_termios
->c_cflag
) &&
241 (RELEVANT_IFLAG(port
->tty
->termios
->c_iflag
) == RELEVANT_IFLAG(old_termios
->c_iflag
))) {
242 dbg("%s - nothing to change...", __FUNCTION__
);
247 buf
= kmalloc (7, GFP_KERNEL
);
249 dev_err(&port
->dev
, "%s - out of memory.\n", __FUNCTION__
);
252 memset (buf
, 0x00, 0x07);
254 i
= usb_control_msg (serial
->dev
, usb_rcvctrlpipe (serial
->dev
, 0),
255 GET_LINE_REQUEST
, GET_LINE_REQUEST_TYPE
,
257 dbg ("0xa1:0x21:0:0 %d - %x %x %x %x %x %x %x", i
,
258 buf
[0], buf
[1], buf
[2], buf
[3], buf
[4], buf
[5], buf
[6]);
261 i
= usb_control_msg (serial
->dev
, usb_sndctrlpipe (serial
->dev
, 0),
262 VENDOR_WRITE_REQUEST
, VENDOR_WRITE_REQUEST_TYPE
,
265 dbg ("0x40:1:0:1 %d", i
);
268 switch (cflag
& CSIZE
) {
269 case CS5
: buf
[6] = 5; break;
270 case CS6
: buf
[6] = 6; break;
271 case CS7
: buf
[6] = 7; break;
273 case CS8
: buf
[6] = 8; break;
275 dbg("%s - data bits = %d", __FUNCTION__
, buf
[6]);
279 switch (cflag
& CBAUD
) {
280 case B0
: baud
= 0; break;
281 case B75
: baud
= 75; break;
282 case B150
: baud
= 150; break;
283 case B300
: baud
= 300; break;
284 case B600
: baud
= 600; break;
285 case B1200
: baud
= 1200; break;
286 case B1800
: baud
= 1800; break;
287 case B2400
: baud
= 2400; break;
288 case B4800
: baud
= 4800; break;
289 case B9600
: baud
= 9600; break;
290 case B19200
: baud
= 19200; break;
291 case B38400
: baud
= 38400; break;
292 case B57600
: baud
= 57600; break;
293 case B115200
: baud
= 115200; break;
294 case B230400
: baud
= 230400; break;
295 case B460800
: baud
= 460800; break;
297 dev_err(&port
->dev
, "pl2303 driver does not support the baudrate requested (fix it)\n");
300 dbg("%s - baud = %d", __FUNCTION__
, baud
);
302 buf
[0] = baud
& 0xff;
303 buf
[1] = (baud
>> 8) & 0xff;
304 buf
[2] = (baud
>> 16) & 0xff;
305 buf
[3] = (baud
>> 24) & 0xff;
308 /* For reference buf[4]=0 is 1 stop bits */
309 /* For reference buf[4]=1 is 1.5 stop bits */
310 /* For reference buf[4]=2 is 2 stop bits */
311 if (cflag
& CSTOPB
) {
313 dbg("%s - stop bits = 2", __FUNCTION__
);
316 dbg("%s - stop bits = 1", __FUNCTION__
);
319 if (cflag
& PARENB
) {
320 /* For reference buf[5]=0 is none parity */
321 /* For reference buf[5]=1 is odd parity */
322 /* For reference buf[5]=2 is even parity */
323 /* For reference buf[5]=3 is mark parity */
324 /* For reference buf[5]=4 is space parity */
325 if (cflag
& PARODD
) {
327 dbg("%s - parity = odd", __FUNCTION__
);
330 dbg("%s - parity = even", __FUNCTION__
);
334 dbg("%s - parity = none", __FUNCTION__
);
337 i
= usb_control_msg (serial
->dev
, usb_sndctrlpipe (serial
->dev
, 0),
338 SET_LINE_REQUEST
, SET_LINE_REQUEST_TYPE
,
340 dbg ("0x21:0x20:0:0 %d", i
);
342 if (cflag
&& CBAUD
) {
343 if ((cflag
&& CBAUD
) == B0
)
344 priv
->line_control
&= ~(CONTROL_DTR
| CONTROL_RTS
);
346 priv
->line_control
|= (CONTROL_DTR
| CONTROL_RTS
);
347 set_control_lines (serial
->dev
, priv
->line_control
);
350 buf
[0] = buf
[1] = buf
[2] = buf
[3] = buf
[4] = buf
[5] = buf
[6] = 0;
352 i
= usb_control_msg (serial
->dev
, usb_rcvctrlpipe (serial
->dev
, 0),
353 GET_LINE_REQUEST
, GET_LINE_REQUEST_TYPE
,
355 dbg ("0xa1:0x21:0:0 %d - %x %x %x %x %x %x %x", i
,
356 buf
[0], buf
[1], buf
[2], buf
[3], buf
[4], buf
[5], buf
[6]);
358 if (cflag
& CRTSCTS
) {
359 i
= usb_control_msg (serial
->dev
, usb_sndctrlpipe (serial
->dev
, 0),
360 VENDOR_WRITE_REQUEST
, VENDOR_WRITE_REQUEST_TYPE
,
361 0x0, 0x41, NULL
, 0, 100);
362 dbg ("0x40:0x1:0x0:0x41 %d", i
);
369 static int pl2303_open (struct usb_serial_port
*port
, struct file
*filp
)
371 struct termios tmp_termios
;
372 struct usb_serial
*serial
= port
->serial
;
373 unsigned char buf
[10];
376 if (port_paranoia_check (port
, __FUNCTION__
))
379 dbg("%s - port %d", __FUNCTION__
, port
->number
);
381 #define FISH(a,b,c,d) \
382 result=usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev,0), \
383 b, a, c, d, buf, 1, 100); \
384 dbg("0x%x:0x%x:0x%x:0x%x %d - %x",a,b,c,d,result,buf[0]);
386 #define SOUP(a,b,c,d) \
387 result=usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev,0), \
388 b, a, c, d, NULL, 0, 100); \
389 dbg("0x%x:0x%x:0x%x:0x%x %d",a,b,c,d,result);
391 FISH (VENDOR_READ_REQUEST_TYPE
, VENDOR_READ_REQUEST
, 0x8484, 0);
392 SOUP (VENDOR_WRITE_REQUEST_TYPE
, VENDOR_WRITE_REQUEST
, 0x0404, 0);
393 FISH (VENDOR_READ_REQUEST_TYPE
, VENDOR_READ_REQUEST
, 0x8484, 0);
394 FISH (VENDOR_READ_REQUEST_TYPE
, VENDOR_READ_REQUEST
, 0x8383, 0);
395 FISH (VENDOR_READ_REQUEST_TYPE
, VENDOR_READ_REQUEST
, 0x8484, 0);
396 SOUP (VENDOR_WRITE_REQUEST_TYPE
, VENDOR_WRITE_REQUEST
, 0x0404, 1);
397 FISH (VENDOR_READ_REQUEST_TYPE
, VENDOR_READ_REQUEST
, 0x8484, 0);
398 FISH (VENDOR_READ_REQUEST_TYPE
, VENDOR_READ_REQUEST
, 0x8383, 0);
399 SOUP (VENDOR_WRITE_REQUEST_TYPE
, VENDOR_WRITE_REQUEST
, 0, 1);
400 SOUP (VENDOR_WRITE_REQUEST_TYPE
, VENDOR_WRITE_REQUEST
, 1, 0xc0);
401 SOUP (VENDOR_WRITE_REQUEST_TYPE
, VENDOR_WRITE_REQUEST
, 2, 4);
405 pl2303_set_termios (port
, &tmp_termios
);
408 //FIXME: need to assert RTS and DTR if CRTSCTS off
410 dbg("%s - submitting read urb", __FUNCTION__
);
411 port
->read_urb
->dev
= serial
->dev
;
412 result
= usb_submit_urb (port
->read_urb
, GFP_KERNEL
);
414 dev_err(&port
->dev
, "%s - failed submitting read urb, error %d\n", __FUNCTION__
, result
);
415 pl2303_close (port
, NULL
);
419 dbg("%s - submitting interrupt urb", __FUNCTION__
);
420 port
->interrupt_in_urb
->dev
= serial
->dev
;
421 result
= usb_submit_urb (port
->interrupt_in_urb
, GFP_KERNEL
);
423 dev_err(&port
->dev
, "%s - failed submitting interrupt urb, error %d\n", __FUNCTION__
, result
);
424 pl2303_close (port
, NULL
);
431 static void pl2303_close (struct usb_serial_port
*port
, struct file
*filp
)
433 struct usb_serial
*serial
;
434 struct pl2303_private
*priv
;
435 unsigned int c_cflag
;
438 if (port_paranoia_check (port
, __FUNCTION__
))
440 serial
= get_usb_serial (port
, __FUNCTION__
);
444 dbg("%s - port %d", __FUNCTION__
, port
->number
);
448 c_cflag
= port
->tty
->termios
->c_cflag
;
449 if (c_cflag
& HUPCL
) {
450 /* drop DTR and RTS */
451 priv
= usb_get_serial_port_data(port
);
452 priv
->line_control
= 0;
453 set_control_lines (port
->serial
->dev
,
458 /* shutdown our urbs */
459 dbg("%s - shutting down urbs", __FUNCTION__
);
460 result
= usb_unlink_urb (port
->write_urb
);
462 dbg("%s - usb_unlink_urb (write_urb)"
463 " failed with reason: %d", __FUNCTION__
,
466 result
= usb_unlink_urb (port
->read_urb
);
468 dbg("%s - usb_unlink_urb (read_urb) "
469 "failed with reason: %d", __FUNCTION__
,
472 result
= usb_unlink_urb (port
->interrupt_in_urb
);
474 dbg("%s - usb_unlink_urb (interrupt_in_urb)"
475 " failed with reason: %d", __FUNCTION__
,
480 static int set_modem_info (struct usb_serial_port
*port
, unsigned int cmd
, unsigned int *value
)
482 struct pl2303_private
*priv
= usb_get_serial_port_data(port
);
485 if (copy_from_user(&arg
, value
, sizeof(int)))
491 priv
->line_control
|= CONTROL_RTS
;
493 priv
->line_control
|= CONTROL_DTR
;
498 priv
->line_control
&= ~CONTROL_RTS
;
500 priv
->line_control
&= ~CONTROL_DTR
;
504 /* turn off RTS and DTR and then only turn
505 on what was asked to */
506 priv
->line_control
&= ~(CONTROL_RTS
| CONTROL_DTR
);
507 priv
->line_control
|= ((arg
& TIOCM_RTS
) ? CONTROL_RTS
: 0);
508 priv
->line_control
|= ((arg
& TIOCM_DTR
) ? CONTROL_DTR
: 0);
512 return set_control_lines (port
->serial
->dev
, priv
->line_control
);
515 static int get_modem_info (struct usb_serial_port
*port
, unsigned int *value
)
517 struct pl2303_private
*priv
= usb_get_serial_port_data(port
);
518 unsigned int mcr
= priv
->line_control
;
521 result
= ((mcr
& CONTROL_DTR
) ? TIOCM_DTR
: 0)
522 | ((mcr
& CONTROL_RTS
) ? TIOCM_RTS
: 0);
524 dbg("%s - result = %x", __FUNCTION__
, result
);
526 if (copy_to_user(value
, &result
, sizeof(int)))
531 static int pl2303_ioctl (struct usb_serial_port
*port
, struct file
*file
, unsigned int cmd
, unsigned long arg
)
533 dbg("%s (%d) cmd = 0x%04x", __FUNCTION__
, port
->number
, cmd
);
538 dbg("%s (%d) TIOCMGET", __FUNCTION__
, port
->number
);
539 return get_modem_info (port
, (unsigned int *)arg
);
544 dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", __FUNCTION__
, port
->number
);
545 return set_modem_info(port
, cmd
, (unsigned int *) arg
);
548 dbg("%s not supported = 0x%04x", __FUNCTION__
, cmd
);
556 static void pl2303_break_ctl (struct usb_serial_port
*port
, int break_state
)
558 struct usb_serial
*serial
= port
->serial
;
562 dbg("%s - port %d", __FUNCTION__
, port
->number
);
564 if (break_state
== 0)
568 dbg("%s - turning break %s", state
==BREAK_OFF
? "off" : "on", __FUNCTION__
);
570 result
= usb_control_msg (serial
->dev
, usb_rcvctrlpipe (serial
->dev
, 0),
571 BREAK_REQUEST
, BREAK_REQUEST_TYPE
, state
,
574 dbg("%s - error sending break = %d", __FUNCTION__
, result
);
578 static void pl2303_shutdown (struct usb_serial
*serial
)
582 dbg("%s", __FUNCTION__
);
584 for (i
= 0; i
< serial
->num_ports
; ++i
) {
585 kfree (usb_get_serial_port_data(&serial
->port
[i
]));
586 usb_set_serial_port_data(&serial
->port
[i
], NULL
);
591 static void pl2303_read_int_callback (struct urb
*urb
, struct pt_regs
*regs
)
593 struct usb_serial_port
*port
= (struct usb_serial_port
*) urb
->context
;
594 struct usb_serial
*serial
= get_usb_serial (port
, __FUNCTION__
);
595 //unsigned char *data = urb->transfer_buffer;
598 switch (urb
->status
) {
605 /* this urb is terminated, clean up */
606 dbg("%s - urb shutting down with status: %d", __FUNCTION__
, urb
->status
);
609 dbg("%s - nonzero urb status received: %d", __FUNCTION__
, urb
->status
);
617 usb_serial_debug_data (__FILE__
, __FUNCTION__
, urb
->actual_length
, urb
->transfer_buffer
);
619 //FIXME need to update state of terminal lines variable
622 status
= usb_submit_urb (urb
, GFP_ATOMIC
);
624 dev_err(&urb
->dev
->dev
, "%s - usb_submit_urb failed with result %d\n",
625 __FUNCTION__
, status
);
629 static void pl2303_read_bulk_callback (struct urb
*urb
, struct pt_regs
*regs
)
631 struct usb_serial_port
*port
= (struct usb_serial_port
*) urb
->context
;
632 struct usb_serial
*serial
= get_usb_serial (port
, __FUNCTION__
);
633 struct tty_struct
*tty
;
634 unsigned char *data
= urb
->transfer_buffer
;
638 if (port_paranoia_check (port
, __FUNCTION__
))
641 dbg("%s - port %d", __FUNCTION__
, port
->number
);
644 dbg("%s - bad serial pointer, exiting", __FUNCTION__
);
649 dbg("%s - urb->status = %d", __FUNCTION__
, urb
->status
);
650 if (!port
->open_count
) {
651 dbg("%s - port is closed, exiting.", __FUNCTION__
);
654 if (urb
->status
== -EPROTO
) {
655 /* PL2303 mysteriously fails with -EPROTO reschedule the read */
656 dbg("%s - caught -EPROTO, resubmitting the urb", __FUNCTION__
);
658 urb
->dev
= serial
->dev
;
659 result
= usb_submit_urb(urb
, GFP_ATOMIC
);
661 dev_err(&urb
->dev
->dev
, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__
, result
);
664 dbg("%s - unable to handle the error, exiting.", __FUNCTION__
);
668 usb_serial_debug_data (__FILE__
, __FUNCTION__
, urb
->actual_length
, data
);
671 if (tty
&& urb
->actual_length
) {
672 for (i
= 0; i
< urb
->actual_length
; ++i
) {
673 if (tty
->flip
.count
>= TTY_FLIPBUF_SIZE
) {
674 tty_flip_buffer_push(tty
);
676 tty_insert_flip_char (tty
, data
[i
], 0);
678 tty_flip_buffer_push (tty
);
681 /* Schedule the next read _if_ we are still open */
682 if (port
->open_count
) {
683 urb
->dev
= serial
->dev
;
684 result
= usb_submit_urb(urb
, GFP_ATOMIC
);
686 dev_err(&urb
->dev
->dev
, "%s - failed resubmitting read urb, error %d\n", __FUNCTION__
, result
);
694 static void pl2303_write_bulk_callback (struct urb
*urb
, struct pt_regs
*regs
)
696 struct usb_serial_port
*port
= (struct usb_serial_port
*) urb
->context
;
699 if (port_paranoia_check (port
, __FUNCTION__
))
702 dbg("%s - port %d", __FUNCTION__
, port
->number
);
705 /* error in the urb, so we have to resubmit it */
706 if (serial_paranoia_check (port
->serial
, __FUNCTION__
)) {
709 dbg("%s - Overflow in write", __FUNCTION__
);
710 dbg("%s - nonzero write bulk status received: %d", __FUNCTION__
, urb
->status
);
711 port
->write_urb
->transfer_buffer_length
= 1;
712 port
->write_urb
->dev
= port
->serial
->dev
;
713 result
= usb_submit_urb (port
->write_urb
, GFP_ATOMIC
);
715 dev_err(&urb
->dev
->dev
, "%s - failed resubmitting write urb, error %d\n", __FUNCTION__
, result
);
720 schedule_work(&port
->work
);
724 static int __init
pl2303_init (void)
726 usb_serial_register (&pl2303_device
);
727 usb_register (&pl2303_driver
);
728 info(DRIVER_DESC
" " DRIVER_VERSION
);
733 static void __exit
pl2303_exit (void)
735 usb_deregister (&pl2303_driver
);
736 usb_serial_deregister (&pl2303_device
);
740 module_init(pl2303_init
);
741 module_exit(pl2303_exit
);
743 MODULE_DESCRIPTION(DRIVER_DESC
);
744 MODULE_LICENSE("GPL");
746 MODULE_PARM(debug
, "i");
747 MODULE_PARM_DESC(debug
, "Debug enabled or not");