linux/drivers/usb/serial/mct_u232.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * MCT (Magic Control Technology Corp.) USB RS232 Converter Driver
 *
 *   Copyright (C) 2000 Wolfgang Grandegger ([email protected])
 *
 * This program is largely derived from the Belkin USB Serial Adapter Driver
 * (see belkin_sa.[ch]). All of the information about the device was acquired
 * by using SniffUSB on Windows98. For technical details see mct_u232.h.
 *
 * William G. Greathouse and Greg Kroah-Hartman provided great help on how to
 * do the reverse engineering and how to write a USB serial device driver.
 *
 * TO BE DONE, TO BE CHECKED:
 *   DTR/RTS signal handling may be incomplete or incorrect. I have mainly
 *   implemented what I have seen with SniffUSB or found in belkin_sa.c.
 *   For further TODOs check also belkin_sa.c.
 */

#include <linux/kernel.h>
#include <linux/errno.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>
#include <linux/uaccess.h>
#include <asm/unaligned.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
#include <linux/serial.h>
#include "mct_u232.h"

#define DRIVER_AUTHOR
#define DRIVER_DESC

/*
 * Function prototypes
 */
static int  mct_u232_port_probe(struct usb_serial_port *port);
static void mct_u232_port_remove(struct usb_serial_port *remove);
static int  mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port);
static void mct_u232_close(struct usb_serial_port *port);
static void mct_u232_dtr_rts(struct usb_serial_port *port, int on);
static void mct_u232_read_int_callback(struct urb *urb);
static void mct_u232_set_termios(struct tty_struct *tty,
				 struct usb_serial_port *port,
				 const struct ktermios *old_termios);
static int  mct_u232_break_ctl(struct tty_struct *tty, int break_state);
static int  mct_u232_tiocmget(struct tty_struct *tty);
static int  mct_u232_tiocmset(struct tty_struct *tty,
			unsigned int set, unsigned int clear);
static void mct_u232_throttle(struct tty_struct *tty);
static void mct_u232_unthrottle(struct tty_struct *tty);


/*
 * All of the device info needed for the MCT USB-RS232 converter.
 */
static const struct usb_device_id id_table[] =;
MODULE_DEVICE_TABLE(usb, id_table);

static struct usb_serial_driver mct_u232_device =;

static struct usb_serial_driver * const serial_drivers[] =;

struct mct_u232_private {};

#define THROTTLED

/*
 * Handle vendor specific USB requests
 */

#define WDR_TIMEOUT

/*
 * Later day 2.6.0-test kernels have new baud rates like B230400 which
 * we do not know how to support. We ignore them for the moment.
 */
static int mct_u232_calculate_baud_rate(struct usb_serial *serial,
					speed_t value, speed_t *result)
{}

static int mct_u232_set_baud_rate(struct tty_struct *tty,
	struct usb_serial *serial, struct usb_serial_port *port, speed_t value)
{} /* mct_u232_set_baud_rate */

static int mct_u232_set_line_ctrl(struct usb_serial_port *port,
				  unsigned char lcr)
{} /* mct_u232_set_line_ctrl */

static int mct_u232_set_modem_ctrl(struct usb_serial_port *port,
				   unsigned int control_state)
{} /* mct_u232_set_modem_ctrl */

static int mct_u232_get_modem_stat(struct usb_serial_port *port,
				   unsigned char *msr)
{} /* mct_u232_get_modem_stat */

static void mct_u232_msr_to_icount(struct async_icount *icount,
						unsigned char msr)
{} /* mct_u232_msr_to_icount */

static void mct_u232_msr_to_state(struct usb_serial_port *port,
				  unsigned int *control_state, unsigned char msr)
{} /* mct_u232_msr_to_state */

/*
 * Driver's tty interface functions
 */

static int mct_u232_port_probe(struct usb_serial_port *port)
{}

static void mct_u232_port_remove(struct usb_serial_port *port)
{}

static int  mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port)
{} /* mct_u232_open */

static void mct_u232_dtr_rts(struct usb_serial_port *port, int on)
{}

static void mct_u232_close(struct usb_serial_port *port)
{} /* mct_u232_close */


static void mct_u232_read_int_callback(struct urb *urb)
{} /* mct_u232_read_int_callback */

static void mct_u232_set_termios(struct tty_struct *tty,
				 struct usb_serial_port *port,
				 const struct ktermios *old_termios)
{} /* mct_u232_set_termios */

static int mct_u232_break_ctl(struct tty_struct *tty, int break_state)
{} /* mct_u232_break_ctl */


static int mct_u232_tiocmget(struct tty_struct *tty)
{}

static int mct_u232_tiocmset(struct tty_struct *tty,
			      unsigned int set, unsigned int clear)
{}

static void mct_u232_throttle(struct tty_struct *tty)
{}

static void mct_u232_unthrottle(struct tty_struct *tty)
{}

module_usb_serial_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();