2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* USB Empeg empeg-car player driver
|
|
|
|
*
|
|
|
|
* Copyright (C) 2000, 2001
|
|
|
|
* Gary Brubaker (xavyer@ix.netcom.com)
|
|
|
|
*
|
|
|
|
* Copyright (C) 1999 - 2001
|
|
|
|
* Greg Kroah-Hartman (greg@kroah.com)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License, as published by
|
|
|
|
* the Free Software Foundation, version 2.
|
|
|
|
*
|
2008-07-22 12:11:11 +02:00
|
|
|
* See Documentation/usb/usb-serial.txt for more information on using this
|
|
|
|
* driver
|
2005-04-17 00:20:36 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/tty.h>
|
|
|
|
#include <linux/tty_driver.h>
|
|
|
|
#include <linux/tty_flip.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/spinlock.h>
|
2008-07-22 12:11:11 +02:00
|
|
|
#include <linux/uaccess.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
#include <linux/usb.h>
|
2006-07-12 06:22:58 +02:00
|
|
|
#include <linux/usb/serial.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
static int debug;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Version Information
|
|
|
|
*/
|
2010-05-15 17:53:45 +02:00
|
|
|
#define DRIVER_VERSION "v1.3"
|
2005-04-17 00:20:36 +02:00
|
|
|
#define DRIVER_AUTHOR "Greg Kroah-Hartman <greg@kroah.com>, Gary Brubaker <xavyer@ix.netcom.com>"
|
|
|
|
#define DRIVER_DESC "USB Empeg Mark I/II Driver"
|
|
|
|
|
|
|
|
#define EMPEG_VENDOR_ID 0x084f
|
|
|
|
#define EMPEG_PRODUCT_ID 0x0001
|
|
|
|
|
|
|
|
/* function prototypes for an empeg-car player */
|
2008-07-22 12:11:11 +02:00
|
|
|
static int empeg_startup(struct usb_serial *serial);
|
2009-09-19 22:13:33 +02:00
|
|
|
static void empeg_init_termios(struct tty_struct *tty);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2010-01-10 15:34:24 +01:00
|
|
|
static const struct usb_device_id id_table[] = {
|
2005-04-17 00:20:36 +02:00
|
|
|
{ USB_DEVICE(EMPEG_VENDOR_ID, EMPEG_PRODUCT_ID) },
|
|
|
|
{ } /* Terminating entry */
|
|
|
|
};
|
|
|
|
|
2008-07-22 12:11:11 +02:00
|
|
|
MODULE_DEVICE_TABLE(usb, id_table);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
static struct usb_driver empeg_driver = {
|
|
|
|
.name = "empeg",
|
|
|
|
.probe = usb_serial_probe,
|
|
|
|
.disconnect = usb_serial_disconnect,
|
|
|
|
.id_table = id_table,
|
2010-05-15 17:53:45 +02:00
|
|
|
.no_dynamic_id = 1,
|
2005-04-17 00:20:36 +02:00
|
|
|
};
|
|
|
|
|
2005-06-21 06:15:16 +02:00
|
|
|
static struct usb_serial_driver empeg_device = {
|
2005-06-21 06:15:16 +02:00
|
|
|
.driver = {
|
|
|
|
.owner = THIS_MODULE,
|
2005-06-21 06:15:16 +02:00
|
|
|
.name = "empeg",
|
2005-06-21 06:15:16 +02:00
|
|
|
},
|
2005-04-17 00:20:36 +02:00
|
|
|
.id_table = id_table,
|
2010-05-15 17:53:45 +02:00
|
|
|
.usb_driver = &empeg_driver,
|
2005-04-17 00:20:36 +02:00
|
|
|
.num_ports = 1,
|
2010-05-15 17:53:45 +02:00
|
|
|
.bulk_out_size = 256,
|
|
|
|
.throttle = usb_serial_generic_throttle,
|
|
|
|
.unthrottle = usb_serial_generic_unthrottle,
|
2005-04-17 00:20:36 +02:00
|
|
|
.attach = empeg_startup,
|
2009-09-19 22:13:33 +02:00
|
|
|
.init_termios = empeg_init_termios,
|
2005-04-17 00:20:36 +02:00
|
|
|
};
|
|
|
|
|
2010-05-15 17:53:45 +02:00
|
|
|
static int empeg_startup(struct usb_serial *serial)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
int r;
|
|
|
|
|
2008-03-04 01:08:34 +01:00
|
|
|
dbg("%s", __func__);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
|
2008-08-21 01:56:34 +02:00
|
|
|
dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
|
2005-04-17 00:20:36 +02:00
|
|
|
serial->dev->actconfig->desc.bConfigurationValue);
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
2008-03-04 01:08:34 +01:00
|
|
|
dbg("%s - reset config", __func__);
|
2008-07-22 12:11:11 +02:00
|
|
|
r = usb_reset_configuration(serial->dev);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/* continue on with initialization */
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2009-09-19 22:13:33 +02:00
|
|
|
static void empeg_init_termios(struct tty_struct *tty)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2008-07-22 12:09:07 +02:00
|
|
|
struct ktermios *termios = tty->termios;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/*
|
2008-07-22 12:11:11 +02:00
|
|
|
* The empeg-car player wants these particular tty settings.
|
|
|
|
* You could, for example, change the baud rate, however the
|
|
|
|
* player only supports 115200 (currently), so there is really
|
|
|
|
* no point in support for changes to the tty settings.
|
|
|
|
* (at least for now)
|
|
|
|
*
|
|
|
|
* The default requirements for this device are:
|
|
|
|
*/
|
2007-10-18 10:24:19 +02:00
|
|
|
termios->c_iflag
|
2005-04-17 00:20:36 +02:00
|
|
|
&= ~(IGNBRK /* disable ignore break */
|
|
|
|
| BRKINT /* disable break causes interrupt */
|
|
|
|
| PARMRK /* disable mark parity errors */
|
|
|
|
| ISTRIP /* disable clear high bit of input characters */
|
|
|
|
| INLCR /* disable translate NL to CR */
|
|
|
|
| IGNCR /* disable ignore CR */
|
|
|
|
| ICRNL /* disable translate CR to NL */
|
|
|
|
| IXON); /* disable enable XON/XOFF flow control */
|
|
|
|
|
2007-10-18 10:24:19 +02:00
|
|
|
termios->c_oflag
|
2005-04-17 00:20:36 +02:00
|
|
|
&= ~OPOST; /* disable postprocess output characters */
|
|
|
|
|
2007-10-18 10:24:19 +02:00
|
|
|
termios->c_lflag
|
2005-04-17 00:20:36 +02:00
|
|
|
&= ~(ECHO /* disable echo input characters */
|
|
|
|
| ECHONL /* disable echo new line */
|
|
|
|
| ICANON /* disable erase, kill, werase, and rprnt special characters */
|
|
|
|
| ISIG /* disable interrupt, quit, and suspend special characters */
|
|
|
|
| IEXTEN); /* disable non-POSIX special characters */
|
|
|
|
|
2007-10-18 10:24:19 +02:00
|
|
|
termios->c_cflag
|
2005-04-17 00:20:36 +02:00
|
|
|
&= ~(CSIZE /* no size */
|
|
|
|
| PARENB /* disable parity bit */
|
|
|
|
| CBAUD); /* clear current baud rate */
|
|
|
|
|
2007-10-18 10:24:19 +02:00
|
|
|
termios->c_cflag
|
|
|
|
|= CS8; /* character size 8 bits */
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2008-07-22 12:09:07 +02:00
|
|
|
tty_encode_baud_rate(tty, 115200, 115200);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
2008-07-22 12:11:11 +02:00
|
|
|
static int __init empeg_init(void)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2010-05-15 17:53:45 +02:00
|
|
|
int retval;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
retval = usb_serial_register(&empeg_device);
|
|
|
|
if (retval)
|
2010-05-15 17:53:45 +02:00
|
|
|
return retval;
|
2005-04-17 00:20:36 +02:00
|
|
|
retval = usb_register(&empeg_driver);
|
2010-05-15 17:53:45 +02:00
|
|
|
if (retval) {
|
|
|
|
usb_serial_deregister(&empeg_device);
|
|
|
|
return retval;
|
|
|
|
}
|
2008-08-18 22:21:04 +02:00
|
|
|
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
|
|
|
|
DRIVER_DESC "\n");
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-07-22 12:11:11 +02:00
|
|
|
static void __exit empeg_exit(void)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
usb_deregister(&empeg_driver);
|
2008-07-22 12:11:11 +02:00
|
|
|
usb_serial_deregister(&empeg_device);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
module_init(empeg_init);
|
|
|
|
module_exit(empeg_exit);
|
|
|
|
|
2008-07-22 12:11:11 +02:00
|
|
|
MODULE_AUTHOR(DRIVER_AUTHOR);
|
|
|
|
MODULE_DESCRIPTION(DRIVER_DESC);
|
2005-04-17 00:20:36 +02:00
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
|
|
|
|
module_param(debug, bool, S_IRUGO | S_IWUSR);
|
|
|
|
MODULE_PARM_DESC(debug, "Debug enabled or not");
|