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

// SPDX-License-Identifier: GPL-2.0
/*
 * gmidi.c -- USB MIDI Gadget Driver
 *
 * Copyright (C) 2006 Thumtronics Pty Ltd.
 * Developed for Thumtronics by Grey Innovation
 * Ben Williamson <[email protected]>
 *
 * This code is based in part on:
 *
 * Gadget Zero driver, Copyright (C) 2003-2004 David Brownell.
 * USB Audio driver, Copyright (C) 2002 by Takashi Iwai.
 * USB MIDI driver, Copyright (C) 2002-2005 Clemens Ladisch.
 *
 * Refer to the USB Device Class Definition for MIDI Devices:
 * http://www.usb.org/developers/devclass_docs/midi10.pdf
 */

/* #define VERBOSE_DEBUG */

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

#include <sound/initval.h>

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

#include "u_midi.h"

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

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

static const char longname[] =;

USB_GADGET_COMPOSITE_OPTIONS();

static int index =;
module_param(index, int, S_IRUGO);
MODULE_PARM_DESC();

static char *id =;
module_param(id, charp, S_IRUGO);
MODULE_PARM_DESC();

static unsigned int buflen =;
module_param(buflen, uint, S_IRUGO);
MODULE_PARM_DESC();

static unsigned int qlen =;
module_param(qlen, uint, S_IRUGO);
MODULE_PARM_DESC();

static unsigned int in_ports =;
module_param(in_ports, uint, S_IRUGO);
MODULE_PARM_DESC();

static unsigned int out_ports =;
module_param(out_ports, uint, S_IRUGO);
MODULE_PARM_DESC();

/* Thanks to Grey Innovation for donating this product ID.
 *
 * DO NOT REUSE THESE IDs with a protocol-incompatible driver!!  Ever!!
 * Instead:  allocate your own, using normal USB-IF procedures.
 */
#define DRIVER_VENDOR_NUM
#define DRIVER_PRODUCT_NUM

/* string IDs are assigned dynamically */

#define STRING_DESCRIPTION_IDX

static struct usb_device_descriptor device_desc =;

static struct usb_string strings_dev[] =;

static struct usb_gadget_strings stringtab_dev =;

static struct usb_gadget_strings *dev_strings[] =;

static struct usb_function_instance *fi_midi;
static struct usb_function *f_midi;

static int midi_unbind(struct usb_composite_dev *dev)
{}

static struct usb_configuration midi_config =;

static int midi_bind_config(struct usb_configuration *c)
{}

static int midi_bind(struct usb_composite_dev *cdev)
{}

static struct usb_composite_driver midi_driver =;

module_usb_composite_driver();