xref: /linux/drivers/usb/serial/keyspan_pda.c (revision fafb66e5903c2bcfc7b7e259042a8282f18a6faa)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * USB Keyspan PDA / Xircom / Entrega Converter driver
4  *
5  * Copyright (C) 1999 - 2001 Greg Kroah-Hartman	<greg@kroah.com>
6  * Copyright (C) 1999, 2000 Brian Warner	<warner@lothar.com>
7  * Copyright (C) 2000 Al Borchers		<borchers@steinerpoint.com>
8  * Copyright (C) 2020 Johan Hovold <johan@kernel.org>
9  *
10  * See Documentation/usb/usb-serial.rst for more information on using this
11  * driver
12  */
13 
14 #include <linux/kernel.h>
15 #include <linux/errno.h>
16 #include <linux/slab.h>
17 #include <linux/tty.h>
18 #include <linux/tty_flip.h>
19 #include <linux/module.h>
20 #include <linux/spinlock.h>
21 #include <linux/workqueue.h>
22 #include <linux/usb.h>
23 #include <linux/usb/serial.h>
24 #include <linux/usb/ezusb.h>
25 
26 #define DRIVER_AUTHOR "Brian Warner <warner@lothar.com>, Johan Hovold <johan@kernel.org>"
27 #define DRIVER_DESC "USB Keyspan PDA Converter driver"
28 
29 #define KEYSPAN_TX_THRESHOLD	128
30 
31 struct keyspan_pda_private {
32 	int			tx_room;
33 	struct work_struct	unthrottle_work;
34 	struct usb_serial	*serial;
35 	struct usb_serial_port	*port;
36 };
37 
38 static int keyspan_pda_write_start(struct usb_serial_port *port);
39 
40 #define KEYSPAN_VENDOR_ID		0x06cd
41 #define KEYSPAN_PDA_FAKE_ID		0x0103
42 #define KEYSPAN_PDA_ID			0x0104 /* no clue */
43 
44 /* For Xircom PGSDB9 and older Entrega version of the same device */
45 #define XIRCOM_VENDOR_ID		0x085a
46 #define XIRCOM_FAKE_ID			0x8027
47 #define XIRCOM_FAKE_ID_2		0x8025 /* "PGMFHUB" serial */
48 #define ENTREGA_VENDOR_ID		0x1645
49 #define ENTREGA_FAKE_ID			0x8093
50 
51 static const struct usb_device_id id_table_combined[] = {
52 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_FAKE_ID) },
53 	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
54 	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID_2) },
55 	{ USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
56 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
57 	{ }						/* Terminating entry */
58 };
59 MODULE_DEVICE_TABLE(usb, id_table_combined);
60 
61 static const struct usb_device_id id_table_std[] = {
62 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
63 	{ }						/* Terminating entry */
64 };
65 
66 static const struct usb_device_id id_table_fake[] = {
67 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_FAKE_ID) },
68 	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
69 	{ USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID_2) },
70 	{ USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
71 	{ }						/* Terminating entry */
72 };
73 
74 static int keyspan_pda_get_write_room(struct keyspan_pda_private *priv)
75 {
76 	struct usb_serial_port *port = priv->port;
77 	struct usb_serial *serial = port->serial;
78 	u8 room;
79 	int rc;
80 
81 	rc = usb_control_msg_recv(serial->dev,
82 				  0,
83 				  6, /* write_room */
84 				  USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_IN,
85 				  0, /* value: 0 means "remaining room" */
86 				  0, /* index */
87 				  &room,
88 				  1,
89 				  2000,
90 				  GFP_KERNEL);
91 	if (rc) {
92 		dev_dbg(&port->dev, "roomquery failed: %d\n", rc);
93 		return rc;
94 	}
95 
96 	dev_dbg(&port->dev, "roomquery says %d\n", room);
97 
98 	return room;
99 }
100 
101 static void keyspan_pda_request_unthrottle(struct work_struct *work)
102 {
103 	struct keyspan_pda_private *priv =
104 		container_of(work, struct keyspan_pda_private, unthrottle_work);
105 	struct usb_serial_port *port = priv->port;
106 	struct usb_serial *serial = port->serial;
107 	unsigned long flags;
108 	int result;
109 
110 	dev_dbg(&port->dev, "%s\n", __func__);
111 
112 	/*
113 	 * Ask the device to tell us when the tx buffer becomes
114 	 * sufficiently empty.
115 	 */
116 	result = usb_control_msg(serial->dev,
117 				 usb_sndctrlpipe(serial->dev, 0),
118 				 7, /* request_unthrottle */
119 				 USB_TYPE_VENDOR | USB_RECIP_INTERFACE
120 				 | USB_DIR_OUT,
121 				 KEYSPAN_TX_THRESHOLD,
122 				 0, /* index */
123 				 NULL,
124 				 0,
125 				 2000);
126 	if (result < 0)
127 		dev_dbg(&serial->dev->dev, "%s - error %d from usb_control_msg\n",
128 			__func__, result);
129 	/*
130 	 * Need to check available space after requesting notification in case
131 	 * buffer is already empty so that no notification is sent.
132 	 */
133 	result = keyspan_pda_get_write_room(priv);
134 	if (result > KEYSPAN_TX_THRESHOLD) {
135 		spin_lock_irqsave(&port->lock, flags);
136 		priv->tx_room = max(priv->tx_room, result);
137 		spin_unlock_irqrestore(&port->lock, flags);
138 
139 		usb_serial_port_softint(port);
140 	}
141 }
142 
143 static void keyspan_pda_rx_interrupt(struct urb *urb)
144 {
145 	struct usb_serial_port *port = urb->context;
146 	unsigned char *data = urb->transfer_buffer;
147 	unsigned int len = urb->actual_length;
148 	int retval;
149 	int status = urb->status;
150 	struct keyspan_pda_private *priv;
151 	unsigned long flags;
152 
153 	priv = usb_get_serial_port_data(port);
154 
155 	switch (status) {
156 	case 0:
157 		/* success */
158 		break;
159 	case -ECONNRESET:
160 	case -ENOENT:
161 	case -ESHUTDOWN:
162 		/* this urb is terminated, clean up */
163 		dev_dbg(&urb->dev->dev, "%s - urb shutting down with status: %d\n", __func__, status);
164 		return;
165 	default:
166 		dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n", __func__, status);
167 		goto exit;
168 	}
169 
170 	if (len < 1) {
171 		dev_warn(&port->dev, "short message received\n");
172 		goto exit;
173 	}
174 
175 	/* see if the message is data or a status interrupt */
176 	switch (data[0]) {
177 	case 0:
178 		 /* rest of message is rx data */
179 		if (len < 2)
180 			break;
181 		tty_insert_flip_string(&port->port, data + 1, len - 1);
182 		tty_flip_buffer_push(&port->port);
183 		break;
184 	case 1:
185 		/* status interrupt */
186 		if (len < 2) {
187 			dev_warn(&port->dev, "short interrupt message received\n");
188 			break;
189 		}
190 		dev_dbg(&port->dev, "rx int, d1=%d\n", data[1]);
191 		switch (data[1]) {
192 		case 1: /* modemline change */
193 			break;
194 		case 2: /* tx unthrottle interrupt */
195 			spin_lock_irqsave(&port->lock, flags);
196 			priv->tx_room = max(priv->tx_room, KEYSPAN_TX_THRESHOLD);
197 			spin_unlock_irqrestore(&port->lock, flags);
198 
199 			keyspan_pda_write_start(port);
200 
201 			usb_serial_port_softint(port);
202 			break;
203 		default:
204 			break;
205 		}
206 		break;
207 	default:
208 		break;
209 	}
210 
211 exit:
212 	retval = usb_submit_urb(urb, GFP_ATOMIC);
213 	if (retval)
214 		dev_err(&port->dev,
215 			"%s - usb_submit_urb failed with result %d\n",
216 			__func__, retval);
217 }
218 
219 static void keyspan_pda_rx_throttle(struct tty_struct *tty)
220 {
221 	struct usb_serial_port *port = tty->driver_data;
222 
223 	/*
224 	 * Stop receiving characters. We just turn off the URB request, and
225 	 * let chars pile up in the device. If we're doing hardware
226 	 * flowcontrol, the device will signal the other end when its buffer
227 	 * fills up. If we're doing XON/XOFF, this would be a good time to
228 	 * send an XOFF, although it might make sense to foist that off upon
229 	 * the device too.
230 	 */
231 	usb_kill_urb(port->interrupt_in_urb);
232 }
233 
234 static void keyspan_pda_rx_unthrottle(struct tty_struct *tty)
235 {
236 	struct usb_serial_port *port = tty->driver_data;
237 
238 	/* just restart the receive interrupt URB */
239 	if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL))
240 		dev_dbg(&port->dev, "usb_submit_urb(read urb) failed\n");
241 }
242 
243 static speed_t keyspan_pda_setbaud(struct usb_serial *serial, speed_t baud)
244 {
245 	int rc;
246 	int bindex;
247 
248 	switch (baud) {
249 	case 110:
250 		bindex = 0;
251 		break;
252 	case 300:
253 		bindex = 1;
254 		break;
255 	case 1200:
256 		bindex = 2;
257 		break;
258 	case 2400:
259 		bindex = 3;
260 		break;
261 	case 4800:
262 		bindex = 4;
263 		break;
264 	case 9600:
265 		bindex = 5;
266 		break;
267 	case 19200:
268 		bindex = 6;
269 		break;
270 	case 38400:
271 		bindex = 7;
272 		break;
273 	case 57600:
274 		bindex = 8;
275 		break;
276 	case 115200:
277 		bindex = 9;
278 		break;
279 	default:
280 		bindex = 5;	/* Default to 9600 */
281 		baud = 9600;
282 	}
283 
284 	rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
285 			     0, /* set baud */
286 			     USB_TYPE_VENDOR
287 			     | USB_RECIP_INTERFACE
288 			     | USB_DIR_OUT, /* type */
289 			     bindex, /* value */
290 			     0, /* index */
291 			     NULL, /* &data */
292 			     0, /* size */
293 			     2000); /* timeout */
294 	if (rc < 0)
295 		return 0;
296 
297 	return baud;
298 }
299 
300 static int keyspan_pda_break_ctl(struct tty_struct *tty, int break_state)
301 {
302 	struct usb_serial_port *port = tty->driver_data;
303 	struct usb_serial *serial = port->serial;
304 	int value;
305 	int result;
306 
307 	if (break_state == -1)
308 		value = 1; /* start break */
309 	else
310 		value = 0; /* clear break */
311 
312 	result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
313 			4, /* set break */
314 			USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT,
315 			value, 0, NULL, 0, 2000);
316 	if (result < 0) {
317 		dev_dbg(&port->dev, "%s - error %d from usb_control_msg\n",
318 			__func__, result);
319 		return result;
320 	}
321 
322 	return 0;
323 }
324 
325 static void keyspan_pda_set_termios(struct tty_struct *tty,
326 				    struct usb_serial_port *port,
327 				    const struct ktermios *old_termios)
328 {
329 	struct usb_serial *serial = port->serial;
330 	speed_t speed;
331 
332 	/*
333 	 * cflag specifies lots of stuff: number of stop bits, parity, number
334 	 * of data bits, baud. What can the device actually handle?:
335 	 * CSTOPB (1 stop bit or 2)
336 	 * PARENB (parity)
337 	 * CSIZE (5bit .. 8bit)
338 	 * There is minimal hw support for parity (a PSW bit seems to hold the
339 	 * parity of whatever is in the accumulator). The UART either deals
340 	 * with 10 bits (start, 8 data, stop) or 11 bits (start, 8 data,
341 	 * 1 special, stop). So, with firmware changes, we could do:
342 	 * 8N1: 10 bit
343 	 * 8N2: 11 bit, extra bit always (mark?)
344 	 * 8[EOMS]1: 11 bit, extra bit is parity
345 	 * 7[EOMS]1: 10 bit, b0/b7 is parity
346 	 * 7[EOMS]2: 11 bit, b0/b7 is parity, extra bit always (mark?)
347 	 *
348 	 * HW flow control is dictated by the tty->termios.c_cflags & CRTSCTS
349 	 * bit.
350 	 *
351 	 * For now, just do baud.
352 	 */
353 	speed = tty_get_baud_rate(tty);
354 	speed = keyspan_pda_setbaud(serial, speed);
355 
356 	if (speed == 0) {
357 		dev_dbg(&port->dev, "can't handle requested baud rate\n");
358 		/* It hasn't changed so.. */
359 		speed = tty_termios_baud_rate(old_termios);
360 	}
361 	/*
362 	 * Only speed can change so copy the old h/w parameters then encode
363 	 * the new speed.
364 	 */
365 	tty_termios_copy_hw(&tty->termios, old_termios);
366 	tty_encode_baud_rate(tty, speed, speed);
367 }
368 
369 /*
370  * Modem control pins: DTR and RTS are outputs and can be controlled.
371  * DCD, RI, DSR, CTS are inputs and can be read. All outputs can also be
372  * read. The byte passed is: DTR(b7) DCD RI DSR CTS RTS(b2) unused unused.
373  */
374 static int keyspan_pda_get_modem_info(struct usb_serial *serial,
375 				      unsigned char *value)
376 {
377 	int rc;
378 	u8 data;
379 
380 	rc = usb_control_msg_recv(serial->dev, 0,
381 				  3, /* get pins */
382 				  USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_IN,
383 				  0,
384 				  0,
385 				  &data,
386 				  1,
387 				  2000,
388 				  GFP_KERNEL);
389 	if (rc == 0)
390 		*value = data;
391 
392 	return rc;
393 }
394 
395 static int keyspan_pda_set_modem_info(struct usb_serial *serial,
396 				      unsigned char value)
397 {
398 	int rc;
399 	rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
400 			     3, /* set pins */
401 			     USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_OUT,
402 			     value, 0, NULL, 0, 2000);
403 	return rc;
404 }
405 
406 static int keyspan_pda_tiocmget(struct tty_struct *tty)
407 {
408 	struct usb_serial_port *port = tty->driver_data;
409 	struct usb_serial *serial = port->serial;
410 	int rc;
411 	unsigned char status;
412 	int value;
413 
414 	rc = keyspan_pda_get_modem_info(serial, &status);
415 	if (rc < 0)
416 		return rc;
417 
418 	value = ((status & BIT(7)) ? TIOCM_DTR : 0) |
419 		((status & BIT(6)) ? TIOCM_CAR : 0) |
420 		((status & BIT(5)) ? TIOCM_RNG : 0) |
421 		((status & BIT(4)) ? TIOCM_DSR : 0) |
422 		((status & BIT(3)) ? TIOCM_CTS : 0) |
423 		((status & BIT(2)) ? TIOCM_RTS : 0);
424 
425 	return value;
426 }
427 
428 static int keyspan_pda_tiocmset(struct tty_struct *tty,
429 				unsigned int set, unsigned int clear)
430 {
431 	struct usb_serial_port *port = tty->driver_data;
432 	struct usb_serial *serial = port->serial;
433 	int rc;
434 	unsigned char status;
435 
436 	rc = keyspan_pda_get_modem_info(serial, &status);
437 	if (rc < 0)
438 		return rc;
439 
440 	if (set & TIOCM_RTS)
441 		status |= BIT(2);
442 	if (set & TIOCM_DTR)
443 		status |= BIT(7);
444 
445 	if (clear & TIOCM_RTS)
446 		status &= ~BIT(2);
447 	if (clear & TIOCM_DTR)
448 		status &= ~BIT(7);
449 	rc = keyspan_pda_set_modem_info(serial, status);
450 	return rc;
451 }
452 
453 static int keyspan_pda_write_start(struct usb_serial_port *port)
454 {
455 	struct keyspan_pda_private *priv = usb_get_serial_port_data(port);
456 	unsigned long flags;
457 	struct urb *urb;
458 	int count;
459 	int room;
460 	int rc;
461 
462 	/*
463 	 * Guess how much room is left in the device's ring buffer. If our
464 	 * write will result in no room left, ask the device to give us an
465 	 * interrupt when the room available rises above a threshold but also
466 	 * query how much room is currently available (in case our guess was
467 	 * too conservative and the buffer is already empty when the
468 	 * unthrottle work is scheduled).
469 	 */
470 
471 	/*
472 	 * We might block because of:
473 	 * the TX urb is in-flight (wait until it completes)
474 	 * the device is full (wait until it says there is room)
475 	 */
476 	spin_lock_irqsave(&port->lock, flags);
477 
478 	room = priv->tx_room;
479 	count = kfifo_len(&port->write_fifo);
480 
481 	if (!test_bit(0, &port->write_urbs_free) || count == 0 || room == 0) {
482 		spin_unlock_irqrestore(&port->lock, flags);
483 		return 0;
484 	}
485 	__clear_bit(0, &port->write_urbs_free);
486 
487 	if (count > room)
488 		count = room;
489 	if (count > port->bulk_out_size)
490 		count = port->bulk_out_size;
491 
492 	urb = port->write_urb;
493 	count = kfifo_out(&port->write_fifo, urb->transfer_buffer, count);
494 	urb->transfer_buffer_length = count;
495 
496 	port->tx_bytes += count;
497 	priv->tx_room -= count;
498 
499 	spin_unlock_irqrestore(&port->lock, flags);
500 
501 	dev_dbg(&port->dev, "%s - count = %d, txroom = %d\n", __func__, count, room);
502 
503 	rc = usb_submit_urb(urb, GFP_ATOMIC);
504 	if (rc) {
505 		dev_dbg(&port->dev, "usb_submit_urb(write bulk) failed\n");
506 
507 		spin_lock_irqsave(&port->lock, flags);
508 		port->tx_bytes -= count;
509 		priv->tx_room = max(priv->tx_room, room + count);
510 		__set_bit(0, &port->write_urbs_free);
511 		spin_unlock_irqrestore(&port->lock, flags);
512 
513 		return rc;
514 	}
515 
516 	if (count == room)
517 		schedule_work(&priv->unthrottle_work);
518 
519 	return 0;
520 }
521 
522 static void keyspan_pda_write_bulk_callback(struct urb *urb)
523 {
524 	struct usb_serial_port *port = urb->context;
525 	unsigned long flags;
526 
527 	spin_lock_irqsave(&port->lock, flags);
528 	port->tx_bytes -= urb->transfer_buffer_length;
529 	__set_bit(0, &port->write_urbs_free);
530 	spin_unlock_irqrestore(&port->lock, flags);
531 
532 	keyspan_pda_write_start(port);
533 
534 	usb_serial_port_softint(port);
535 }
536 
537 static int keyspan_pda_write(struct tty_struct *tty, struct usb_serial_port *port,
538 		const unsigned char *buf, int count)
539 {
540 	int rc;
541 
542 	dev_dbg(&port->dev, "%s - count = %d\n", __func__, count);
543 
544 	if (!count)
545 		return 0;
546 
547 	count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock);
548 
549 	rc = keyspan_pda_write_start(port);
550 	if (rc)
551 		return rc;
552 
553 	return count;
554 }
555 
556 static void keyspan_pda_dtr_rts(struct usb_serial_port *port, int on)
557 {
558 	struct usb_serial *serial = port->serial;
559 
560 	if (on)
561 		keyspan_pda_set_modem_info(serial, BIT(7) | BIT(2));
562 	else
563 		keyspan_pda_set_modem_info(serial, 0);
564 }
565 
566 
567 static int keyspan_pda_open(struct tty_struct *tty,
568 					struct usb_serial_port *port)
569 {
570 	struct keyspan_pda_private *priv = usb_get_serial_port_data(port);
571 	int rc;
572 
573 	/* find out how much room is in the Tx ring */
574 	rc = keyspan_pda_get_write_room(priv);
575 	if (rc < 0)
576 		return rc;
577 
578 	spin_lock_irq(&port->lock);
579 	priv->tx_room = rc;
580 	spin_unlock_irq(&port->lock);
581 
582 	rc = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
583 	if (rc) {
584 		dev_dbg(&port->dev, "%s - usb_submit_urb(read int) failed\n", __func__);
585 		return rc;
586 	}
587 
588 	return 0;
589 }
590 
591 static void keyspan_pda_close(struct usb_serial_port *port)
592 {
593 	struct keyspan_pda_private *priv = usb_get_serial_port_data(port);
594 
595 	/*
596 	 * Stop the interrupt URB first as its completion handler may submit
597 	 * the write URB.
598 	 */
599 	usb_kill_urb(port->interrupt_in_urb);
600 	usb_kill_urb(port->write_urb);
601 
602 	cancel_work_sync(&priv->unthrottle_work);
603 
604 	spin_lock_irq(&port->lock);
605 	kfifo_reset(&port->write_fifo);
606 	spin_unlock_irq(&port->lock);
607 }
608 
609 /* download the firmware to a "fake" device (pre-renumeration) */
610 static int keyspan_pda_fake_startup(struct usb_serial *serial)
611 {
612 	unsigned int vid = le16_to_cpu(serial->dev->descriptor.idVendor);
613 	const char *fw_name;
614 
615 	/* download the firmware here ... */
616 	ezusb_fx1_set_reset(serial->dev, 1);
617 
618 	switch (vid) {
619 	case KEYSPAN_VENDOR_ID:
620 		fw_name = "keyspan_pda/keyspan_pda.fw";
621 		break;
622 	case XIRCOM_VENDOR_ID:
623 	case ENTREGA_VENDOR_ID:
624 		fw_name = "keyspan_pda/xircom_pgs.fw";
625 		break;
626 	default:
627 		dev_err(&serial->dev->dev, "%s: unknown vendor, aborting.\n",
628 			__func__);
629 		return -ENODEV;
630 	}
631 
632 	if (ezusb_fx1_ihex_firmware_download(serial->dev, fw_name) < 0) {
633 		dev_err(&serial->dev->dev, "failed to load firmware \"%s\"\n",
634 			fw_name);
635 		return -ENOENT;
636 	}
637 
638 	/*
639 	 * After downloading firmware renumeration will occur in a moment and
640 	 * the new device will bind to the real driver.
641 	 */
642 
643 	/* We want this device to fail to have a driver assigned to it. */
644 	return 1;
645 }
646 
647 MODULE_FIRMWARE("keyspan_pda/keyspan_pda.fw");
648 MODULE_FIRMWARE("keyspan_pda/xircom_pgs.fw");
649 
650 static int keyspan_pda_port_probe(struct usb_serial_port *port)
651 {
652 
653 	struct keyspan_pda_private *priv;
654 
655 	priv = kmalloc_obj(struct keyspan_pda_private);
656 	if (!priv)
657 		return -ENOMEM;
658 
659 	INIT_WORK(&priv->unthrottle_work, keyspan_pda_request_unthrottle);
660 	priv->port = port;
661 
662 	usb_set_serial_port_data(port, priv);
663 
664 	return 0;
665 }
666 
667 static void keyspan_pda_port_remove(struct usb_serial_port *port)
668 {
669 	struct keyspan_pda_private *priv;
670 
671 	priv = usb_get_serial_port_data(port);
672 	kfree(priv);
673 }
674 
675 static struct usb_serial_driver keyspan_pda_fake_device = {
676 	.driver = {
677 		.name =		"keyspan_pda_pre",
678 	},
679 	.description =		"Keyspan PDA - (prerenumeration)",
680 	.id_table =		id_table_fake,
681 	.num_ports =		1,
682 	.attach =		keyspan_pda_fake_startup,
683 };
684 
685 static struct usb_serial_driver keyspan_pda_device = {
686 	.driver = {
687 		.name =		"keyspan_pda",
688 	},
689 	.description =		"Keyspan PDA",
690 	.id_table =		id_table_std,
691 	.num_ports =		1,
692 	.num_bulk_out =		1,
693 	.num_interrupt_in =	1,
694 	.dtr_rts =		keyspan_pda_dtr_rts,
695 	.open =			keyspan_pda_open,
696 	.close =		keyspan_pda_close,
697 	.write =		keyspan_pda_write,
698 	.write_bulk_callback =	keyspan_pda_write_bulk_callback,
699 	.read_int_callback =	keyspan_pda_rx_interrupt,
700 	.throttle =		keyspan_pda_rx_throttle,
701 	.unthrottle =		keyspan_pda_rx_unthrottle,
702 	.set_termios =		keyspan_pda_set_termios,
703 	.break_ctl =		keyspan_pda_break_ctl,
704 	.tiocmget =		keyspan_pda_tiocmget,
705 	.tiocmset =		keyspan_pda_tiocmset,
706 	.port_probe =		keyspan_pda_port_probe,
707 	.port_remove =		keyspan_pda_port_remove,
708 };
709 
710 static struct usb_serial_driver * const serial_drivers[] = {
711 	&keyspan_pda_device,
712 	&keyspan_pda_fake_device,
713 	NULL
714 };
715 
716 module_usb_serial_driver(serial_drivers, id_table_combined);
717 
718 MODULE_AUTHOR(DRIVER_AUTHOR);
719 MODULE_DESCRIPTION(DRIVER_DESC);
720 MODULE_LICENSE("GPL");
721