#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/usb.h>
#include <linux/i2c.h>
#define CMD_ECHO …
#define CMD_GET_FUNC …
#define CMD_SET_DELAY …
#define CMD_GET_STATUS …
#define CMD_I2C_IO …
#define CMD_I2C_IO_BEGIN …
#define CMD_I2C_IO_END …
static unsigned short delay = …;
module_param(delay, ushort, 0);
MODULE_PARM_DESC(…) …;
static int usb_read(struct i2c_adapter *adapter, int cmd,
int value, int index, void *data, int len);
static int usb_write(struct i2c_adapter *adapter, int cmd,
int value, int index, void *data, int len);
#define STATUS_IDLE …
#define STATUS_ADDRESS_ACK …
#define STATUS_ADDRESS_NAK …
static int usb_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
{ … }
static u32 usb_func(struct i2c_adapter *adapter)
{ … }
static const struct i2c_algorithm usb_algorithm = …;
static const struct usb_device_id i2c_tiny_usb_table[] = …;
MODULE_DEVICE_TABLE(usb, i2c_tiny_usb_table);
struct i2c_tiny_usb { … };
static int usb_read(struct i2c_adapter *adapter, int cmd,
int value, int index, void *data, int len)
{ … }
static int usb_write(struct i2c_adapter *adapter, int cmd,
int value, int index, void *data, int len)
{ … }
static void i2c_tiny_usb_free(struct i2c_tiny_usb *dev)
{ … }
static int i2c_tiny_usb_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{ … }
static void i2c_tiny_usb_disconnect(struct usb_interface *interface)
{ … }
static struct usb_driver i2c_tiny_usb_driver = …;
module_usb_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;