// SPDX-License-Identifier: GPL-2.0+ /* * ncm.c -- NCM gadget driver * * Copyright (C) 2010 Nokia Corporation * Contact: Yauheni Kaliuta <[email protected]> * * The driver borrows from ether.c which is: * * Copyright (C) 2003-2005,2008 David Brownell * Copyright (C) 2003-2004 Robert Schwebel, Benedikt Spranger * Copyright (C) 2008 Nokia Corporation */ /* #define DEBUG */ /* #define VERBOSE_DEBUG */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/usb/composite.h> #include "u_ether.h" #include "u_ncm.h" #define DRIVER_DESC … /*-------------------------------------------------------------------------*/ /* 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. * It's for devices with only CDC Ethernet configurations. */ #define CDC_VENDOR_NUM … #define CDC_PRODUCT_NUM … /*-------------------------------------------------------------------------*/ USB_GADGET_COMPOSITE_OPTIONS(…); USB_ETHERNET_MODULE_PARAMETERS(…); static struct usb_device_descriptor device_desc = …; static const struct usb_descriptor_header *otg_desc[2]; /* string IDs are assigned dynamically */ 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 *f_ncm_inst; static struct usb_function *f_ncm; /*-------------------------------------------------------------------------*/ static int ncm_do_config(struct usb_configuration *c) { … } static struct usb_configuration ncm_config_driver = …; /*-------------------------------------------------------------------------*/ static int gncm_bind(struct usb_composite_dev *cdev) { … } static int gncm_unbind(struct usb_composite_dev *cdev) { … } static struct usb_composite_driver ncm_driver = …; module_usb_composite_driver(…); MODULE_DESCRIPTION(…); MODULE_AUTHOR(…) …; MODULE_LICENSE(…) …;