2 * USB Empeg empeg-car player driver
4 * Copyright (C) 2000, 2001
5 * Gary Brubaker (xavyer@ix.netcom.com)
7 * Copyright (C) 1999 - 2001
8 * Greg Kroah-Hartman (greg@kroah.com)
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License, as published by
12 * the Free Software Foundation, version 2.
14 * See Documentation/usb/usb-serial.txt for more information on using this
18 #include <linux/kernel.h>
19 #include <linux/errno.h>
20 #include <linux/init.h>
21 #include <linux/slab.h>
22 #include <linux/tty.h>
23 #include <linux/tty_driver.h>
24 #include <linux/tty_flip.h>
25 #include <linux/module.h>
26 #include <linux/spinlock.h>
27 #include <linux/uaccess.h>
28 #include <linux/usb.h>
29 #include <linux/usb/serial.h>
34 #define DRIVER_VERSION "v1.3"
35 #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Gary Brubaker <xavyer@ix.netcom.com>"
36 #define DRIVER_DESC "USB Empeg Mark I/II Driver"
38 #define EMPEG_VENDOR_ID 0x084f
39 #define EMPEG_PRODUCT_ID 0x0001
41 /* function prototypes for an empeg-car player */
42 static int empeg_startup(struct usb_serial *serial);
43 static void empeg_init_termios(struct tty_struct *tty);
45 static const struct usb_device_id id_table[] = {
46 { USB_DEVICE(EMPEG_VENDOR_ID, EMPEG_PRODUCT_ID) },
47 { } /* Terminating entry */
50 MODULE_DEVICE_TABLE(usb, id_table);
52 static struct usb_serial_driver empeg_device = {
60 .throttle = usb_serial_generic_throttle,
61 .unthrottle = usb_serial_generic_unthrottle,
62 .attach = empeg_startup,
63 .init_termios = empeg_init_termios,
66 static struct usb_serial_driver * const serial_drivers[] = {
70 static int empeg_startup(struct usb_serial *serial)
74 if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
75 dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
76 serial->dev->actconfig->desc.bConfigurationValue);
80 r = usb_reset_configuration(serial->dev);
82 /* continue on with initialization */
86 static void empeg_init_termios(struct tty_struct *tty)
88 struct ktermios *termios = &tty->termios;
91 * The empeg-car player wants these particular tty settings.
92 * You could, for example, change the baud rate, however the
93 * player only supports 115200 (currently), so there is really
94 * no point in support for changes to the tty settings.
97 * The default requirements for this device are:
100 &= ~(IGNBRK /* disable ignore break */
101 | BRKINT /* disable break causes interrupt */
102 | PARMRK /* disable mark parity errors */
103 | ISTRIP /* disable clear high bit of input characters */
104 | INLCR /* disable translate NL to CR */
105 | IGNCR /* disable ignore CR */
106 | ICRNL /* disable translate CR to NL */
107 | IXON); /* disable enable XON/XOFF flow control */
110 &= ~OPOST; /* disable postprocess output characters */
113 &= ~(ECHO /* disable echo input characters */
114 | ECHONL /* disable echo new line */
115 | ICANON /* disable erase, kill, werase, and rprnt special characters */
116 | ISIG /* disable interrupt, quit, and suspend special characters */
117 | IEXTEN); /* disable non-POSIX special characters */
120 &= ~(CSIZE /* no size */
121 | PARENB /* disable parity bit */
122 | CBAUD); /* clear current baud rate */
125 |= CS8; /* character size 8 bits */
127 tty_encode_baud_rate(tty, 115200, 115200);
130 module_usb_serial_driver(serial_drivers, id_table);
132 MODULE_AUTHOR(DRIVER_AUTHOR);
133 MODULE_DESCRIPTION(DRIVER_DESC);
134 MODULE_LICENSE("GPL");