#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/module.h>
#include <linux/err.h>
#include <linux/usb/composite.h>
#include "g_zero.h"
USB_GADGET_COMPOSITE_OPTIONS(…);
#define DRIVER_VERSION …
static const char longname[] = …;
static bool loopdefault = …;
module_param(loopdefault, bool, S_IRUGO|S_IWUSR);
static struct usb_zero_options gzero_options = …;
#ifndef CONFIG_USB_ZERO_HNPTEST
#define DRIVER_VENDOR_NUM …
#define DRIVER_PRODUCT_NUM …
#define DEFAULT_AUTORESUME …
#else
#define DRIVER_VENDOR_NUM …
#define DRIVER_PRODUCT_NUM …
#define DEFAULT_AUTORESUME …
#endif
static unsigned autoresume = …;
module_param(autoresume, uint, S_IRUGO);
MODULE_PARM_DESC(…) …;
static unsigned max_autoresume;
module_param(max_autoresume, uint, S_IRUGO);
MODULE_PARM_DESC(…) …;
static unsigned autoresume_interval_ms;
module_param(autoresume_interval_ms, uint, S_IRUGO);
MODULE_PARM_DESC(…) …;
static unsigned autoresume_step_ms;
static struct usb_device_descriptor device_desc = …;
static const struct usb_descriptor_header *otg_desc[2];
static char serial[] = …;
#define USB_GZERO_SS_DESC …
#define USB_GZERO_LB_DESC …
static struct usb_string strings_dev[] = …;
static struct usb_gadget_strings stringtab_dev = …;
static struct usb_gadget_strings *dev_strings[] = …;
static struct timer_list autoresume_timer;
static struct usb_composite_dev *autoresume_cdev;
static void zero_autoresume(struct timer_list *unused)
{ … }
static void zero_suspend(struct usb_composite_dev *cdev)
{ … }
static void zero_resume(struct usb_composite_dev *cdev)
{ … }
static struct usb_configuration loopback_driver = …;
static struct usb_function *func_ss;
static struct usb_function_instance *func_inst_ss;
static int ss_config_setup(struct usb_configuration *c,
const struct usb_ctrlrequest *ctrl)
{ … }
static struct usb_configuration sourcesink_driver = …;
module_param_named(buflen, gzero_options.bulk_buflen, uint, 0);
module_param_named(pattern, gzero_options.pattern, uint, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(…) …;
module_param_named(isoc_interval, gzero_options.isoc_interval, uint,
S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(…) …;
module_param_named(isoc_maxpacket, gzero_options.isoc_maxpacket, uint,
S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(…) …;
module_param_named(isoc_mult, gzero_options.isoc_mult, uint, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(…) …;
module_param_named(isoc_maxburst, gzero_options.isoc_maxburst, uint,
S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(…) …;
static struct usb_function *func_lb;
static struct usb_function_instance *func_inst_lb;
module_param_named(qlen, gzero_options.qlen, uint, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(…) …;
module_param_named(ss_bulk_qlen, gzero_options.ss_bulk_qlen, uint,
S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(…) …;
module_param_named(ss_iso_qlen, gzero_options.ss_iso_qlen, uint,
S_IRUGO|S_IWUSR);
MODULE_PARM_DESC(…) …;
static int zero_bind(struct usb_composite_dev *cdev)
{ … }
static int zero_unbind(struct usb_composite_dev *cdev)
{ … }
static struct usb_composite_driver zero_driver = …;
module_usb_composite_driver(…);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;