linux/drivers/usb/gadget/legacy/printer.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * printer.c -- Printer gadget driver
 *
 * Copyright (C) 2003-2005 David Brownell
 * Copyright (C) 2006 Craig W. Nadler
 */

#include <linux/module.h>
#include <linux/kernel.h>
#include <asm/byteorder.h>

#include <linux/usb/ch9.h>
#include <linux/usb/composite.h>
#include <linux/usb/gadget.h>
#include <linux/usb/g_printer.h>

USB_GADGET_COMPOSITE_OPTIONS();

#define DRIVER_DESC
#define DRIVER_VERSION

static const char shortname [] =;

#include "u_printer.h"

/*-------------------------------------------------------------------------*/

/* DO NOT REUSE THESE IDs with a protocol-incompatible driver!!  Ever!!
 * Instead:  allocate your own, using normal USB-IF procedures.
 */

/* Thanks to NetChip Technologies for donating this product ID.
 */
#define PRINTER_VENDOR_NUM
#define PRINTER_PRODUCT_NUM

/* Some systems will want different product identifiers published in the
 * device descriptor, either numbers or strings or both.  These string
 * parameters are in UTF-8 (superset of ASCII's 7 bit characters).
 */

module_param_named(iSerialNum, coverwrite.serial_number, charp, S_IRUGO);
MODULE_PARM_DESC();

static char *iPNPstring;
module_param(iPNPstring, charp, S_IRUGO);
MODULE_PARM_DESC();

/* Number of requests to allocate per endpoint, not used for ep0. */
static unsigned qlen =;
module_param(qlen, uint, S_IRUGO|S_IWUSR);
MODULE_PARM_DESC();

#define QLEN

static struct usb_function_instance *fi_printer;
static struct usb_function *f_printer;

/*-------------------------------------------------------------------------*/

/*
 * DESCRIPTORS ... most are static, but strings and (full) configuration
 * descriptors are built on demand.
 */

static struct usb_device_descriptor device_desc =;

static const struct usb_descriptor_header *otg_desc[2];

/*-------------------------------------------------------------------------*/

/* descriptors that are built on-demand */

static char				product_desc [40] =;
static char				serial_num [40] =;
static char				*pnp_string =;

/* static strings, in UTF-8 */
static struct usb_string		strings [] =;

static struct usb_gadget_strings	stringtab_dev =;

static struct usb_gadget_strings *dev_strings[] =;

static struct usb_configuration printer_cfg_driver =;

static int printer_do_config(struct usb_configuration *c)
{}

static int printer_bind(struct usb_composite_dev *cdev)
{}

static int printer_unbind(struct usb_composite_dev *cdev)
{}

static struct usb_composite_driver printer_driver =;

module_usb_composite_driver();

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