2 * MCT (Magic Control Technology Corp.) USB RS232 Converter Driver
4 * Copyright (C) 2000 Wolfgang Grandegger (wolfgang@ces.ch)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is largely derived from the Belkin USB Serial Adapter Driver
12 * (see belkin_sa.[ch]). All of the information about the device was acquired
13 * by using SniffUSB on Windows98. For technical details see mct_u232.h.
15 * William G. Greathouse and Greg Kroah-Hartman provided great help on how to
16 * do the reverse engineering and how to write a USB serial device driver.
18 * TO BE DONE, TO BE CHECKED:
19 * DTR/RTS signal handling may be incomplete or incorrect. I have mainly
20 * implemented what I have seen with SniffUSB or found in belkin_sa.c.
21 * For further TODOs check also belkin_sa.c.
24 * Basic tests have been performed with minicom/zmodem transfers and
25 * modem dialing under Linux 2.4.0-test10 (for me it works fine).
27 * 04-Nov-2003 Bill Marr <marr at flex dot com>
28 * - Mimic Windows driver by sending 2 USB 'device request' messages
29 * following normal 'baud rate change' message. This allows data to be
30 * transmitted to RS-232 devices which don't assert the 'CTS' signal.
32 * 10-Nov-2001 Wolfgang Grandegger
33 * - Fixed an endianess problem with the baudrate selection for PowerPC.
35 * 06-Dec-2001 Martin Hamilton <martinh@gnu.org>
36 * Added support for the Belkin F5U109 DB9 adaptor
38 * 30-May-2001 Greg Kroah-Hartman
39 * switched from using spinlock to a semaphore, which fixes lots of problems.
41 * 04-May-2001 Stelian Pop
42 * - Set the maximum bulk output size for Sitecom U232-P25 model to 16 bytes
43 * instead of the device reported 32 (using 32 bytes causes many data
44 * loss, Windows driver uses 16 too).
46 * 02-May-2001 Stelian Pop
47 * - Fixed the baud calculation for Sitecom U232-P25 model
50 * - Identify version on module load.
52 * 06-Jan-2001 Cornel Ciocirlan
53 * - Added support for Sitecom U232-P25 model (Product Id 0x0230)
54 * - Added support for D-Link DU-H3SP USB BAY (Product Id 0x0200)
56 * 29-Nov-2000 Greg Kroah-Hartman
57 * - Added device id table to fit with 2.4.0-test11 structure.
58 * - took out DEAL_WITH_TWO_INT_IN_ENDPOINTS #define as it's not needed
59 * (lots of things will change if/when the usb-serial core changes to
60 * handle these issues.
62 * 27-Nov-2000 Wolfgang Grandegger
63 * A version for kernel 2.4.0-test10 released to the Linux community
64 * (via linux-usb-devel).
67 #include <linux/kernel.h>
68 #include <linux/errno.h>
69 #include <linux/init.h>
70 #include <linux/slab.h>
71 #include <linux/tty.h>
72 #include <linux/tty_driver.h>
73 #include <linux/tty_flip.h>
74 #include <linux/module.h>
75 #include <linux/spinlock.h>
76 #include <asm/uaccess.h>
77 #include <linux/usb.h>
78 #include <linux/usb/serial.h>
84 #define DRIVER_VERSION "z2.0" /* Linux in-kernel version */
85 #define DRIVER_AUTHOR "Wolfgang Grandegger <wolfgang@ces.ch>"
86 #define DRIVER_DESC "Magic Control Technology USB-RS232 converter driver"
93 static int mct_u232_startup (struct usb_serial *serial);
94 static void mct_u232_shutdown (struct usb_serial *serial);
95 static int mct_u232_open (struct usb_serial_port *port,
97 static void mct_u232_close (struct usb_serial_port *port,
99 static void mct_u232_read_int_callback (struct urb *urb);
100 static void mct_u232_set_termios (struct usb_serial_port *port,
101 struct ktermios * old);
102 static int mct_u232_ioctl (struct usb_serial_port *port,
106 static void mct_u232_break_ctl (struct usb_serial_port *port,
108 static int mct_u232_tiocmget (struct usb_serial_port *port,
110 static int mct_u232_tiocmset (struct usb_serial_port *port,
111 struct file *file, unsigned int set,
114 * All of the device info needed for the MCT USB-RS232 converter.
116 static struct usb_device_id id_table_combined [] = {
117 { USB_DEVICE(MCT_U232_VID, MCT_U232_PID) },
118 { USB_DEVICE(MCT_U232_VID, MCT_U232_SITECOM_PID) },
119 { USB_DEVICE(MCT_U232_VID, MCT_U232_DU_H3SP_PID) },
120 { USB_DEVICE(MCT_U232_BELKIN_F5U109_VID, MCT_U232_BELKIN_F5U109_PID) },
121 { } /* Terminating entry */
124 MODULE_DEVICE_TABLE (usb, id_table_combined);
126 static struct usb_driver mct_u232_driver = {
128 .probe = usb_serial_probe,
129 .disconnect = usb_serial_disconnect,
130 .id_table = id_table_combined,
134 static struct usb_serial_driver mct_u232_device = {
136 .owner = THIS_MODULE,
139 .description = "MCT U232",
140 .usb_driver = &mct_u232_driver,
141 .id_table = id_table_combined,
142 .num_interrupt_in = 2,
146 .open = mct_u232_open,
147 .close = mct_u232_close,
148 .read_int_callback = mct_u232_read_int_callback,
149 .ioctl = mct_u232_ioctl,
150 .set_termios = mct_u232_set_termios,
151 .break_ctl = mct_u232_break_ctl,
152 .tiocmget = mct_u232_tiocmget,
153 .tiocmset = mct_u232_tiocmset,
154 .attach = mct_u232_startup,
155 .shutdown = mct_u232_shutdown,
159 struct mct_u232_private {
161 unsigned int control_state; /* Modem Line Setting (TIOCM) */
162 unsigned char last_lcr; /* Line Control Register */
163 unsigned char last_lsr; /* Line Status Register */
164 unsigned char last_msr; /* Modem Status Register */
168 * Handle vendor specific USB requests
171 #define WDR_TIMEOUT 5000 /* default urb timeout */
174 * Later day 2.6.0-test kernels have new baud rates like B230400 which
175 * we do not know how to support. We ignore them for the moment.
176 * XXX Rate-limit the error message, it's user triggerable.
178 static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value)
180 if (le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_SITECOM_PID
181 || le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_BELKIN_F5U109_PID) {
183 case B300: return 0x01;
184 case B600: return 0x02; /* this one not tested */
185 case B1200: return 0x03;
186 case B2400: return 0x04;
187 case B4800: return 0x06;
188 case B9600: return 0x08;
189 case B19200: return 0x09;
190 case B38400: return 0x0a;
191 case B57600: return 0x0b;
192 case B115200: return 0x0c;
194 err("MCT USB-RS232: unsupported baudrate request 0x%x,"
195 " using default of B9600", value);
200 case B300: value = 300; break;
201 case B600: value = 600; break;
202 case B1200: value = 1200; break;
203 case B2400: value = 2400; break;
204 case B4800: value = 4800; break;
205 case B9600: value = 9600; break;
206 case B19200: value = 19200; break;
207 case B38400: value = 38400; break;
208 case B57600: value = 57600; break;
209 case B115200: value = 115200; break;
211 err("MCT USB-RS232: unsupported baudrate request 0x%x,"
212 " using default of B9600", value);
219 static int mct_u232_set_baud_rate(struct usb_serial *serial, int value)
223 unsigned char zero_byte = 0;
225 divisor = cpu_to_le32(mct_u232_calculate_baud_rate(serial, value));
227 rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
228 MCT_U232_SET_BAUD_RATE_REQUEST,
229 MCT_U232_SET_REQUEST_TYPE,
230 0, 0, &divisor, MCT_U232_SET_BAUD_RATE_SIZE,
233 err("Set BAUD RATE %d failed (error = %d)", value, rc);
234 dbg("set_baud_rate: value: 0x%x, divisor: 0x%x", value, divisor);
236 /* Mimic the MCT-supplied Windows driver (version 1.21P.0104), which
237 always sends two extra USB 'device request' messages after the
238 'baud rate change' message. The actual functionality of the
239 request codes in these messages is not fully understood but these
240 particular codes are never seen in any operation besides a baud
241 rate change. Both of these messages send a single byte of data
242 whose value is always zero. The second of these two extra messages
243 is required in order for data to be properly written to an RS-232
244 device which does not assert the 'CTS' signal. */
246 rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
247 MCT_U232_SET_UNKNOWN1_REQUEST,
248 MCT_U232_SET_REQUEST_TYPE,
249 0, 0, &zero_byte, MCT_U232_SET_UNKNOWN1_SIZE,
252 err("Sending USB device request code %d failed (error = %d)",
253 MCT_U232_SET_UNKNOWN1_REQUEST, rc);
255 rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
256 MCT_U232_SET_UNKNOWN2_REQUEST,
257 MCT_U232_SET_REQUEST_TYPE,
258 0, 0, &zero_byte, MCT_U232_SET_UNKNOWN2_SIZE,
261 err("Sending USB device request code %d failed (error = %d)",
262 MCT_U232_SET_UNKNOWN2_REQUEST, rc);
265 } /* mct_u232_set_baud_rate */
267 static int mct_u232_set_line_ctrl(struct usb_serial *serial, unsigned char lcr)
270 rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
271 MCT_U232_SET_LINE_CTRL_REQUEST,
272 MCT_U232_SET_REQUEST_TYPE,
273 0, 0, &lcr, MCT_U232_SET_LINE_CTRL_SIZE,
276 err("Set LINE CTRL 0x%x failed (error = %d)", lcr, rc);
277 dbg("set_line_ctrl: 0x%x", lcr);
279 } /* mct_u232_set_line_ctrl */
281 static int mct_u232_set_modem_ctrl(struct usb_serial *serial,
282 unsigned int control_state)
285 unsigned char mcr = MCT_U232_MCR_NONE;
287 if (control_state & TIOCM_DTR)
288 mcr |= MCT_U232_MCR_DTR;
289 if (control_state & TIOCM_RTS)
290 mcr |= MCT_U232_MCR_RTS;
292 rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
293 MCT_U232_SET_MODEM_CTRL_REQUEST,
294 MCT_U232_SET_REQUEST_TYPE,
295 0, 0, &mcr, MCT_U232_SET_MODEM_CTRL_SIZE,
298 err("Set MODEM CTRL 0x%x failed (error = %d)", mcr, rc);
299 dbg("set_modem_ctrl: state=0x%x ==> mcr=0x%x", control_state, mcr);
302 } /* mct_u232_set_modem_ctrl */
304 static int mct_u232_get_modem_stat(struct usb_serial *serial, unsigned char *msr)
307 rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
308 MCT_U232_GET_MODEM_STAT_REQUEST,
309 MCT_U232_GET_REQUEST_TYPE,
310 0, 0, msr, MCT_U232_GET_MODEM_STAT_SIZE,
313 err("Get MODEM STATus failed (error = %d)", rc);
316 dbg("get_modem_stat: 0x%x", *msr);
318 } /* mct_u232_get_modem_stat */
320 static void mct_u232_msr_to_state(unsigned int *control_state, unsigned char msr)
322 /* Translate Control Line states */
323 if (msr & MCT_U232_MSR_DSR)
324 *control_state |= TIOCM_DSR;
326 *control_state &= ~TIOCM_DSR;
327 if (msr & MCT_U232_MSR_CTS)
328 *control_state |= TIOCM_CTS;
330 *control_state &= ~TIOCM_CTS;
331 if (msr & MCT_U232_MSR_RI)
332 *control_state |= TIOCM_RI;
334 *control_state &= ~TIOCM_RI;
335 if (msr & MCT_U232_MSR_CD)
336 *control_state |= TIOCM_CD;
338 *control_state &= ~TIOCM_CD;
339 dbg("msr_to_state: msr=0x%x ==> state=0x%x", msr, *control_state);
340 } /* mct_u232_msr_to_state */
343 * Driver's tty interface functions
346 static int mct_u232_startup (struct usb_serial *serial)
348 struct mct_u232_private *priv;
349 struct usb_serial_port *port, *rport;
351 priv = kzalloc(sizeof(struct mct_u232_private), GFP_KERNEL);
354 spin_lock_init(&priv->lock);
355 usb_set_serial_port_data(serial->port[0], priv);
357 init_waitqueue_head(&serial->port[0]->write_wait);
359 /* Puh, that's dirty */
360 port = serial->port[0];
361 rport = serial->port[1];
362 /* No unlinking, it wasn't submitted yet. */
363 usb_free_urb(port->read_urb);
364 port->read_urb = rport->interrupt_in_urb;
365 rport->interrupt_in_urb = NULL;
366 port->read_urb->context = port;
369 } /* mct_u232_startup */
372 static void mct_u232_shutdown (struct usb_serial *serial)
374 struct mct_u232_private *priv;
377 dbg("%s", __FUNCTION__);
379 for (i=0; i < serial->num_ports; ++i) {
380 /* My special items, the standard routines free my urbs */
381 priv = usb_get_serial_port_data(serial->port[i]);
383 usb_set_serial_port_data(serial->port[i], NULL);
387 } /* mct_u232_shutdown */
389 static int mct_u232_open (struct usb_serial_port *port, struct file *filp)
391 struct usb_serial *serial = port->serial;
392 struct mct_u232_private *priv = usb_get_serial_port_data(port);
394 unsigned int control_state;
396 unsigned char last_lcr;
397 unsigned char last_msr;
399 dbg("%s port %d", __FUNCTION__, port->number);
401 /* Compensate for a hardware bug: although the Sitecom U232-P25
402 * device reports a maximum output packet size of 32 bytes,
403 * it seems to be able to accept only 16 bytes (and that's what
404 * SniffUSB says too...)
406 if (le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_SITECOM_PID)
407 port->bulk_out_size = 16;
409 /* Do a defined restart: the normal serial device seems to
410 * always turn on DTR and RTS here, so do the same. I'm not
411 * sure if this is really necessary. But it should not harm
414 spin_lock_irqsave(&priv->lock, flags);
415 if (port->tty->termios->c_cflag & CBAUD)
416 priv->control_state = TIOCM_DTR | TIOCM_RTS;
418 priv->control_state = 0;
420 priv->last_lcr = (MCT_U232_DATA_BITS_8 |
421 MCT_U232_PARITY_NONE |
422 MCT_U232_STOP_BITS_1);
423 control_state = priv->control_state;
424 last_lcr = priv->last_lcr;
425 spin_unlock_irqrestore(&priv->lock, flags);
426 mct_u232_set_modem_ctrl(serial, control_state);
427 mct_u232_set_line_ctrl(serial, last_lcr);
429 /* Read modem status and update control state */
430 mct_u232_get_modem_stat(serial, &last_msr);
431 spin_lock_irqsave(&priv->lock, flags);
432 priv->last_msr = last_msr;
433 mct_u232_msr_to_state(&priv->control_state, priv->last_msr);
434 spin_unlock_irqrestore(&priv->lock, flags);
436 port->read_urb->dev = port->serial->dev;
437 retval = usb_submit_urb(port->read_urb, GFP_KERNEL);
439 err("usb_submit_urb(read bulk) failed pipe 0x%x err %d",
440 port->read_urb->pipe, retval);
444 port->interrupt_in_urb->dev = port->serial->dev;
445 retval = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
447 err(" usb_submit_urb(read int) failed pipe 0x%x err %d",
448 port->interrupt_in_urb->pipe, retval);
452 } /* mct_u232_open */
455 static void mct_u232_close (struct usb_serial_port *port, struct file *filp)
457 dbg("%s port %d", __FUNCTION__, port->number);
459 if (port->serial->dev) {
460 /* shutdown our urbs */
461 usb_kill_urb(port->write_urb);
462 usb_kill_urb(port->read_urb);
463 usb_kill_urb(port->interrupt_in_urb);
465 } /* mct_u232_close */
468 static void mct_u232_read_int_callback (struct urb *urb)
470 struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
471 struct mct_u232_private *priv = usb_get_serial_port_data(port);
472 struct usb_serial *serial = port->serial;
473 struct tty_struct *tty;
474 unsigned char *data = urb->transfer_buffer;
478 switch (urb->status) {
485 /* this urb is terminated, clean up */
486 dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status);
489 dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
494 dbg("%s - bad serial pointer, exiting", __FUNCTION__);
498 dbg("%s - port %d", __FUNCTION__, port->number);
499 usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data);
502 * Work-a-round: handle the 'usual' bulk-in pipe here
504 if (urb->transfer_buffer_length > 2) {
507 if (urb->actual_length) {
508 for (i = 0; i < urb->actual_length ; ++i) {
509 tty_insert_flip_char(tty, data[i], 0);
511 tty_flip_buffer_push(tty);
517 * The interrupt-in pipe signals exceptional conditions (modem line
518 * signal changes and errors). data[0] holds MSR, data[1] holds LSR.
520 spin_lock_irqsave(&priv->lock, flags);
521 priv->last_msr = data[MCT_U232_MSR_INDEX];
523 /* Record Control Line states */
524 mct_u232_msr_to_state(&priv->control_state, priv->last_msr);
527 /* Not yet handled. See belin_sa.c for further information */
528 /* Now to report any errors */
529 priv->last_lsr = data[MCT_U232_LSR_INDEX];
531 * fill in the flip buffer here, but I do not know the relation
532 * to the current/next receive buffer or characters. I need
533 * to look in to this before committing any code.
535 if (priv->last_lsr & MCT_U232_LSR_ERR) {
538 if (priv->last_lsr & MCT_U232_LSR_OE) {
541 if (priv->last_lsr & MCT_U232_LSR_PE) {
544 if (priv->last_lsr & MCT_U232_LSR_FE) {
546 /* Break Indicator */
547 if (priv->last_lsr & MCT_U232_LSR_BI) {
551 spin_unlock_irqrestore(&priv->lock, flags);
553 status = usb_submit_urb (urb, GFP_ATOMIC);
555 err ("%s - usb_submit_urb failed with result %d",
556 __FUNCTION__, status);
557 } /* mct_u232_read_int_callback */
559 static void mct_u232_set_termios (struct usb_serial_port *port,
560 struct ktermios *old_termios)
562 struct usb_serial *serial = port->serial;
563 struct mct_u232_private *priv = usb_get_serial_port_data(port);
564 unsigned int iflag = port->tty->termios->c_iflag;
565 unsigned int cflag = port->tty->termios->c_cflag;
566 unsigned int old_cflag = old_termios->c_cflag;
568 unsigned int control_state, new_state;
569 unsigned char last_lcr;
571 /* get a local copy of the current port settings */
572 spin_lock_irqsave(&priv->lock, flags);
573 control_state = priv->control_state;
574 spin_unlock_irqrestore(&priv->lock, flags);
579 * Do not attempt to cache old rates and skip settings,
580 * disconnects screw such tricks up completely.
581 * Premature optimization is the root of all evil.
584 /* reassert DTR and (maybe) RTS on transition from B0 */
585 if ((old_cflag & CBAUD) == B0) {
586 dbg("%s: baud was B0", __FUNCTION__);
587 control_state |= TIOCM_DTR;
588 /* don't set RTS if using hardware flow control */
589 if (!(old_cflag & CRTSCTS)) {
590 control_state |= TIOCM_RTS;
592 mct_u232_set_modem_ctrl(serial, control_state);
595 mct_u232_set_baud_rate(serial, cflag & CBAUD);
597 if ((cflag & CBAUD) == B0 ) {
598 dbg("%s: baud is B0", __FUNCTION__);
599 /* Drop RTS and DTR */
600 control_state &= ~(TIOCM_DTR | TIOCM_RTS);
601 mct_u232_set_modem_ctrl(serial, control_state);
605 * Update line control register (LCR)
610 last_lcr |= (cflag & PARODD) ?
611 MCT_U232_PARITY_ODD : MCT_U232_PARITY_EVEN;
613 last_lcr |= MCT_U232_PARITY_NONE;
615 /* set the number of data bits */
616 switch (cflag & CSIZE) {
618 last_lcr |= MCT_U232_DATA_BITS_5; break;
620 last_lcr |= MCT_U232_DATA_BITS_6; break;
622 last_lcr |= MCT_U232_DATA_BITS_7; break;
624 last_lcr |= MCT_U232_DATA_BITS_8; break;
626 err("CSIZE was not CS5-CS8, using default of 8");
627 last_lcr |= MCT_U232_DATA_BITS_8;
631 /* set the number of stop bits */
632 last_lcr |= (cflag & CSTOPB) ?
633 MCT_U232_STOP_BITS_2 : MCT_U232_STOP_BITS_1;
635 mct_u232_set_line_ctrl(serial, last_lcr);
638 * Set flow control: well, I do not really now how to handle DTR/RTS.
639 * Just do what we have seen with SniffUSB on Win98.
641 /* Drop DTR/RTS if no flow control otherwise assert */
642 new_state = control_state;
643 if ((iflag & IXOFF) || (iflag & IXON) || (cflag & CRTSCTS))
644 new_state |= TIOCM_DTR | TIOCM_RTS;
646 new_state &= ~(TIOCM_DTR | TIOCM_RTS);
647 if (new_state != control_state) {
648 mct_u232_set_modem_ctrl(serial, new_state);
649 control_state = new_state;
652 /* save off the modified port settings */
653 spin_lock_irqsave(&priv->lock, flags);
654 priv->control_state = control_state;
655 priv->last_lcr = last_lcr;
656 spin_unlock_irqrestore(&priv->lock, flags);
657 } /* mct_u232_set_termios */
659 static void mct_u232_break_ctl( struct usb_serial_port *port, int break_state )
661 struct usb_serial *serial = port->serial;
662 struct mct_u232_private *priv = usb_get_serial_port_data(port);
666 dbg("%sstate=%d", __FUNCTION__, break_state);
668 spin_lock_irqsave(&priv->lock, flags);
669 lcr = priv->last_lcr;
670 spin_unlock_irqrestore(&priv->lock, flags);
673 lcr |= MCT_U232_SET_BREAK;
675 mct_u232_set_line_ctrl(serial, lcr);
676 } /* mct_u232_break_ctl */
679 static int mct_u232_tiocmget (struct usb_serial_port *port, struct file *file)
681 struct mct_u232_private *priv = usb_get_serial_port_data(port);
682 unsigned int control_state;
685 dbg("%s", __FUNCTION__);
687 spin_lock_irqsave(&priv->lock, flags);
688 control_state = priv->control_state;
689 spin_unlock_irqrestore(&priv->lock, flags);
691 return control_state;
694 static int mct_u232_tiocmset (struct usb_serial_port *port, struct file *file,
695 unsigned int set, unsigned int clear)
697 struct usb_serial *serial = port->serial;
698 struct mct_u232_private *priv = usb_get_serial_port_data(port);
699 unsigned int control_state;
702 dbg("%s", __FUNCTION__);
704 spin_lock_irqsave(&priv->lock, flags);
705 control_state = priv->control_state;
708 control_state |= TIOCM_RTS;
710 control_state |= TIOCM_DTR;
711 if (clear & TIOCM_RTS)
712 control_state &= ~TIOCM_RTS;
713 if (clear & TIOCM_DTR)
714 control_state &= ~TIOCM_DTR;
716 priv->control_state = control_state;
717 spin_unlock_irqrestore(&priv->lock, flags);
718 return mct_u232_set_modem_ctrl(serial, control_state);
721 static int mct_u232_ioctl (struct usb_serial_port *port, struct file * file,
722 unsigned int cmd, unsigned long arg)
724 dbg("%scmd=0x%x", __FUNCTION__, cmd);
726 /* Based on code from acm.c and others */
729 /* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/
734 /* return count of modemline transitions */
739 dbg("%s: arg not supported - 0x%04x", __FUNCTION__,cmd);
740 return(-ENOIOCTLCMD);
744 } /* mct_u232_ioctl */
747 static int __init mct_u232_init (void)
750 retval = usb_serial_register(&mct_u232_device);
752 goto failed_usb_serial_register;
753 retval = usb_register(&mct_u232_driver);
755 goto failed_usb_register;
756 info(DRIVER_DESC " " DRIVER_VERSION);
759 usb_serial_deregister(&mct_u232_device);
760 failed_usb_serial_register:
765 static void __exit mct_u232_exit (void)
767 usb_deregister (&mct_u232_driver);
768 usb_serial_deregister (&mct_u232_device);
772 module_init (mct_u232_init);
773 module_exit(mct_u232_exit);
775 MODULE_AUTHOR( DRIVER_AUTHOR );
776 MODULE_DESCRIPTION( DRIVER_DESC );
777 MODULE_LICENSE("GPL");
779 module_param(debug, bool, S_IRUGO | S_IWUSR);
780 MODULE_PARM_DESC(debug, "Debug enabled or not");