1 // SPDX-License-Identifier: GPL-2.0
3 * USB Empeg empeg-car player driver
5 * Copyright (C) 2000, 2001
6 * Gary Brubaker (xavyer@ix.netcom.com)
8 * Copyright (C) 1999 - 2001
9 * Greg Kroah-Hartman (greg@kroah.com)
11 * See Documentation/usb/usb-serial.txt for more information on using this
15 #include <linux/kernel.h>
16 #include <linux/errno.h>
17 #include <linux/slab.h>
18 #include <linux/tty.h>
19 #include <linux/tty_driver.h>
20 #include <linux/tty_flip.h>
21 #include <linux/module.h>
22 #include <linux/spinlock.h>
23 #include <linux/uaccess.h>
24 #include <linux/usb.h>
25 #include <linux/usb/serial.h>
27 #define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Gary Brubaker <xavyer@ix.netcom.com>"
28 #define DRIVER_DESC "USB Empeg Mark I/II Driver"
30 #define EMPEG_VENDOR_ID 0x084f
31 #define EMPEG_PRODUCT_ID 0x0001
33 /* function prototypes for an empeg-car player */
34 static int empeg_startup(struct usb_serial
*serial
);
35 static void empeg_init_termios(struct tty_struct
*tty
);
37 static const struct usb_device_id id_table
[] = {
38 { USB_DEVICE(EMPEG_VENDOR_ID
, EMPEG_PRODUCT_ID
) },
39 { } /* Terminating entry */
42 MODULE_DEVICE_TABLE(usb
, id_table
);
44 static struct usb_serial_driver empeg_device
= {
52 .throttle
= usb_serial_generic_throttle
,
53 .unthrottle
= usb_serial_generic_unthrottle
,
54 .attach
= empeg_startup
,
55 .init_termios
= empeg_init_termios
,
58 static struct usb_serial_driver
* const serial_drivers
[] = {
62 static int empeg_startup(struct usb_serial
*serial
)
66 if (serial
->dev
->actconfig
->desc
.bConfigurationValue
!= 1) {
67 dev_err(&serial
->dev
->dev
, "active config #%d != 1 ??\n",
68 serial
->dev
->actconfig
->desc
.bConfigurationValue
);
72 r
= usb_reset_configuration(serial
->dev
);
74 /* continue on with initialization */
78 static void empeg_init_termios(struct tty_struct
*tty
)
80 struct ktermios
*termios
= &tty
->termios
;
83 * The empeg-car player wants these particular tty settings.
84 * You could, for example, change the baud rate, however the
85 * player only supports 115200 (currently), so there is really
86 * no point in support for changes to the tty settings.
89 * The default requirements for this device are:
92 &= ~(IGNBRK
/* disable ignore break */
93 | BRKINT
/* disable break causes interrupt */
94 | PARMRK
/* disable mark parity errors */
95 | ISTRIP
/* disable clear high bit of input characters */
96 | INLCR
/* disable translate NL to CR */
97 | IGNCR
/* disable ignore CR */
98 | ICRNL
/* disable translate CR to NL */
99 | IXON
); /* disable enable XON/XOFF flow control */
102 &= ~OPOST
; /* disable postprocess output characters */
105 &= ~(ECHO
/* disable echo input characters */
106 | ECHONL
/* disable echo new line */
107 | ICANON
/* disable erase, kill, werase, and rprnt special characters */
108 | ISIG
/* disable interrupt, quit, and suspend special characters */
109 | IEXTEN
); /* disable non-POSIX special characters */
112 &= ~(CSIZE
/* no size */
113 | PARENB
/* disable parity bit */
114 | CBAUD
); /* clear current baud rate */
117 |= CS8
; /* character size 8 bits */
119 tty_encode_baud_rate(tty
, 115200, 115200);
122 module_usb_serial_driver(serial_drivers
, id_table
);
124 MODULE_AUTHOR(DRIVER_AUTHOR
);
125 MODULE_DESCRIPTION(DRIVER_DESC
);
126 MODULE_LICENSE("GPL v2");