linux/drivers/usb/serial/oti6858.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Ours Technology Inc. OTi-6858 USB to serial adapter driver.
 *
 * Copyleft  (C) 2007 Kees Lemmens (adapted for kernel 2.6.20)
 * Copyright (C) 2006 Tomasz Michal Lukaszewski (FIXME: add e-mail)
 * Copyright (C) 2001-2004 Greg Kroah-Hartman ([email protected])
 * Copyright (C) 2003 IBM Corp.
 *
 * Many thanks to the authors of pl2303 driver: all functions in this file
 * are heavily based on pl2303 code, buffering code is a 1-to-1 copy.
 *
 * Warning! You use this driver on your own risk! The only official
 * description of this device I have is datasheet from manufacturer,
 * and it doesn't contain almost any information needed to write a driver.
 * Almost all knowlegde used while writing this driver was gathered by:
 *  - analyzing traffic between device and the M$ Windows 2000 driver,
 *  - trying different bit combinations and checking pin states
 *    with a voltmeter,
 *  - receiving malformed frames and producing buffer overflows
 *    to learn how errors are reported,
 * So, THIS CODE CAN DESTROY OTi-6858 AND ANY OTHER DEVICES, THAT ARE
 * CONNECTED TO IT!
 *
 * See Documentation/usb/usb-serial.rst for more information on using this
 * driver
 *
 * TODO:
 *  - implement correct flushing for ioctls and oti6858_close()
 *  - check how errors (rx overflow, parity error, framing error) are reported
 *  - implement oti6858_break_ctl()
 *  - implement more ioctls
 *  - test/implement flow control
 *  - allow setting custom baud rates
 */

#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/serial.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/spinlock.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
#include <linux/uaccess.h>
#include <linux/kfifo.h>
#include "oti6858.h"

#define OTI6858_DESCRIPTION
#define OTI6858_AUTHOR

static const struct usb_device_id id_table[] =;

MODULE_DEVICE_TABLE(usb, id_table);

/* requests */
#define OTI6858_REQ_GET_STATUS
#define OTI6858_REQ_T_GET_STATUS

#define OTI6858_REQ_SET_LINE
#define OTI6858_REQ_T_SET_LINE

#define OTI6858_REQ_CHECK_TXBUFF
#define OTI6858_REQ_T_CHECK_TXBUFF

/* format of the control packet */
struct oti6858_control_pkt {};

#define OTI6858_CTRL_PKT_SIZE
#define OTI6858_CTRL_EQUALS_PENDING(a, priv)

/* function prototypes */
static int oti6858_open(struct tty_struct *tty, struct usb_serial_port *port);
static void oti6858_close(struct usb_serial_port *port);
static void oti6858_set_termios(struct tty_struct *tty,
				struct usb_serial_port *port,
				const struct ktermios *old_termios);
static void oti6858_init_termios(struct tty_struct *tty);
static void oti6858_read_int_callback(struct urb *urb);
static void oti6858_read_bulk_callback(struct urb *urb);
static void oti6858_write_bulk_callback(struct urb *urb);
static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port,
			const unsigned char *buf, int count);
static unsigned int oti6858_write_room(struct tty_struct *tty);
static unsigned int oti6858_chars_in_buffer(struct tty_struct *tty);
static int oti6858_tiocmget(struct tty_struct *tty);
static int oti6858_tiocmset(struct tty_struct *tty,
				unsigned int set, unsigned int clear);
static int oti6858_port_probe(struct usb_serial_port *port);
static void oti6858_port_remove(struct usb_serial_port *port);

/* device info */
static struct usb_serial_driver oti6858_device =;

static struct usb_serial_driver * const serial_drivers[] =;

struct oti6858_private {};

static void setup_line(struct work_struct *work)
{}

static void send_data(struct work_struct *work)
{}

static int oti6858_port_probe(struct usb_serial_port *port)
{}

static void oti6858_port_remove(struct usb_serial_port *port)
{}

static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port,
			const unsigned char *buf, int count)
{}

static unsigned int oti6858_write_room(struct tty_struct *tty)
{}

static unsigned int oti6858_chars_in_buffer(struct tty_struct *tty)
{}

static void oti6858_init_termios(struct tty_struct *tty)
{}

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

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

static void oti6858_close(struct usb_serial_port *port)
{}

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

static int oti6858_tiocmget(struct tty_struct *tty)
{}

static void oti6858_read_int_callback(struct urb *urb)
{}

static void oti6858_read_bulk_callback(struct urb *urb)
{}

static void oti6858_write_bulk_callback(struct urb *urb)
{}

module_usb_serial_driver();

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