linux/drivers/usb/misc/iowarrior.c

// SPDX-License-Identifier: GPL-2.0
/*
 *  Native support for the I/O-Warrior USB devices
 *
 *  Copyright (c) 2003-2005, 2020  Code Mercenaries GmbH
 *  written by Christian Lucht <[email protected]> and
 *  Christoph Jung <[email protected]>
 *
 *  based on

 *  usb-skeleton.c by Greg Kroah-Hartman  <[email protected]>
 *  brlvger.c by Stephane Dalton  <[email protected]>
 *           and Stephane Doyon   <[email protected]>
 *
 *  Released under the GPLv2.
 */

#include <linux/module.h>
#include <linux/usb.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/mutex.h>
#include <linux/poll.h>
#include <linux/usb/iowarrior.h>

#define DRIVER_AUTHOR
#define DRIVER_DESC

#define USB_VENDOR_ID_CODEMERCS
/* low speed iowarrior */
#define USB_DEVICE_ID_CODEMERCS_IOW40
#define USB_DEVICE_ID_CODEMERCS_IOW24
#define USB_DEVICE_ID_CODEMERCS_IOWPV1
#define USB_DEVICE_ID_CODEMERCS_IOWPV2
/* full speed iowarrior */
#define USB_DEVICE_ID_CODEMERCS_IOW56
/* fuller speed iowarrior */
#define USB_DEVICE_ID_CODEMERCS_IOW28
#define USB_DEVICE_ID_CODEMERCS_IOW28L
#define USB_DEVICE_ID_CODEMERCS_IOW100

/* OEMed devices */
#define USB_DEVICE_ID_CODEMERCS_IOW24SAG
#define USB_DEVICE_ID_CODEMERCS_IOW56AM

/* Get a minor range for your devices from the usb maintainer */
#ifdef CONFIG_USB_DYNAMIC_MINORS
#define IOWARRIOR_MINOR_BASE
#else
#define IOWARRIOR_MINOR_BASE
#endif

/* interrupt input queue size */
#define MAX_INTERRUPT_BUFFER
/*
   maximum number of urbs that are submitted for writes at the same time,
   this applies to the IOWarrior56 only!
   IOWarrior24 and IOWarrior40 use synchronous usb_control_msg calls.
*/
#define MAX_WRITES_IN_FLIGHT

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

static struct usb_driver iowarrior_driver;

/*--------------*/
/*     data     */
/*--------------*/

/* Structure to hold all of our device specific stuff */
struct iowarrior {};

/*--------------*/
/*    globals   */
/*--------------*/

#define USB_REQ_GET_REPORT
//#if 0
static int usb_get_report(struct usb_device *dev,
			  struct usb_host_interface *inter, unsigned char type,
			  unsigned char id, void *buf, int size)
{}
//#endif

#define USB_REQ_SET_REPORT

static int usb_set_report(struct usb_interface *intf, unsigned char type,
			  unsigned char id, void *buf, int size)
{}

/*---------------------*/
/* driver registration */
/*---------------------*/
/* table of devices that work with this driver */
static const struct usb_device_id iowarrior_ids[] =;
MODULE_DEVICE_TABLE(usb, iowarrior_ids);

/*
 * USB callback handler for reading data
 */
static void iowarrior_callback(struct urb *urb)
{}

/*
 * USB Callback handler for write-ops
 */
static void iowarrior_write_callback(struct urb *urb)
{}

/*
 *	iowarrior_delete
 */
static inline void iowarrior_delete(struct iowarrior *dev)
{}

/*---------------------*/
/* fops implementation */
/*---------------------*/

static int read_index(struct iowarrior *dev)
{}

/*
 *  iowarrior_read
 */
static ssize_t iowarrior_read(struct file *file, char __user *buffer,
			      size_t count, loff_t *ppos)
{}

/*
 * iowarrior_write
 */
static ssize_t iowarrior_write(struct file *file,
			       const char __user *user_buffer,
			       size_t count, loff_t *ppos)
{}

/*
 *	iowarrior_ioctl
 */
static long iowarrior_ioctl(struct file *file, unsigned int cmd,
							unsigned long arg)
{}

/*
 *	iowarrior_open
 */
static int iowarrior_open(struct inode *inode, struct file *file)
{}

/*
 *	iowarrior_release
 */
static int iowarrior_release(struct inode *inode, struct file *file)
{}

static __poll_t iowarrior_poll(struct file *file, poll_table * wait)
{}

/*
 * File operations needed when we register this driver.
 * This assumes that this driver NEEDS file operations,
 * of course, which means that the driver is expected
 * to have a node in the /dev directory. If the USB
 * device were for a network interface then the driver
 * would use "struct net_driver" instead, and a serial
 * device would use "struct tty_driver".
 */
static const struct file_operations iowarrior_fops =;

static char *iowarrior_devnode(const struct device *dev, umode_t *mode)
{}

/*
 * usb class driver info in order to get a minor number from the usb core,
 * and to have the device registered with devfs and the driver core
 */
static struct usb_class_driver iowarrior_class =;

/*---------------------------------*/
/*  probe and disconnect functions */
/*---------------------------------*/
/*
 *	iowarrior_probe
 *
 *	Called by the usb core when a new device is connected that it thinks
 *	this driver might be interested in.
 */
static int iowarrior_probe(struct usb_interface *interface,
			   const struct usb_device_id *id)
{}

/*
 *	iowarrior_disconnect
 *
 *	Called by the usb core when the device is removed from the system.
 */
static void iowarrior_disconnect(struct usb_interface *interface)
{}

/* usb specific object needed to register this driver with the usb subsystem */
static struct usb_driver iowarrior_driver =;

module_usb_driver();