38#ifdef USB_GLOBAL_INCLUDE_FILE
39#include USB_GLOBAL_INCLUDE_FILE
41#include <sys/stdint.h>
42#include <sys/stddef.h>
47#include <sys/kernel.h>
49#include <sys/module.h>
52#include <sys/condvar.h>
53#include <sys/sysctl.h>
55#include <sys/unistd.h>
56#include <sys/callout.h>
57#include <sys/malloc.h>
82#define ETH_DEFAULT_VENDOR_ID USB_TEMPLATE_VENDOR
83#define ETH_DEFAULT_PRODUCT_ID 0x27e1
84#define ETH_DEFAULT_MAC "2A02030405060789AB"
85#define ETH_DEFAULT_CONTROL "USB Ethernet Comm Interface"
86#define ETH_DEFAULT_DATA "USB Ethernet Data Interface"
87#define ETH_DEFAULT_CONFIG "Default Config"
88#define ETH_DEFAULT_MANUFACTURER USB_TEMPLATE_MANUFACTURER
89#define ETH_DEFAULT_PRODUCT "USB Ethernet Adapter"
90#define ETH_DEFAULT_SERIAL_NUMBER "December 2007"
128 .wMaxSegmentSize = {0xEA, 0x05},
129 .wNumberMCFilters = {0, 0},
130 .bNumberPowerFilters = 0,
152#ifdef USB_HIP_IN_EP_0
153 .bEndpointAddress = USB_HIP_IN_EP_0,
162#ifdef USB_HIP_OUT_EP_0
163 .bEndpointAddress = USB_HIP_OUT_EP_0,
186 .bInterfaceProtocol = 0,
199 .bInterfaceSubClass = 0,
200 .bInterfaceProtocol = 0,
208 .bInterfaceProtocol = 0,
239 .bDeviceSubClass = 0,
240 .bDeviceProtocol = 0,
267 if (string_index == 0) {
270 if (lang_id != 0x0409) {
274 return (ptr[string_index]);
282 struct sysctl_oid *parent;
300 snprintf(parent_name,
sizeof(parent_name),
"%d",
USB_TEMP_CDCE);
304 SYSCTL_STATIC_CHILDREN(_hw_usb_templates), OID_AUTO,
305 parent_name, CTLFLAG_RW | CTLFLAG_MPSAFE,
306 0,
"USB CDC Ethernet device side template");
307 SYSCTL_ADD_U16(&
eth_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
308 "vendor_id", CTLFLAG_RWTUN,
310 SYSCTL_ADD_U16(&
eth_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
311 "product_id", CTLFLAG_RWTUN,
313 SYSCTL_ADD_PROC(&
eth_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
314 "mac", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
316 "A",
"MAC address string");
318 SYSCTL_ADD_PROC(&
eth_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
319 "control", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
321 "A",
"Control interface string");
322 SYSCTL_ADD_PROC(&
eth_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
323 "data", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
325 "A",
"Data interface string");
326 SYSCTL_ADD_PROC(&
eth_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
327 "configuration", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
329 "A",
"Configuration string");
331 SYSCTL_ADD_PROC(&
eth_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
332 "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
334 "A",
"Manufacturer string");
335 SYSCTL_ADD_PROC(&
eth_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
336 "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
338 "A",
"Product string");
339 SYSCTL_ADD_PROC(&
eth_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
340 "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
342 "A",
"Serial number string");
uDWord bmEthernetStatistics
const struct usb_temp_interface_desc ** ppIfaceDesc
usb_temp_get_string_desc_t * getStringDesc
const struct usb_temp_packet_size * pPacketSize
const struct usb_temp_endpoint_desc ** ppEndpoints
uint16_t mps[USB_SPEED_MAX]
#define UDESC_CS_INTERFACE
#define UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL
#define UDESCSUB_CDC_UNION
#define UDESCSUB_CDC_HEADER
const struct usb_string_lang usb_string_lang_en
int usb_temp_sysctl(SYSCTL_HANDLER_ARGS)
const void *() usb_temp_get_string_desc_t(uint16_t lang_id, uint8_t string_index)
static usb_temp_get_string_desc_t eth_get_string_desc
static const struct usb_temp_interface_desc eth_control_interface
static struct usb_string_descriptor eth_configuration
static struct usb_string_descriptor eth_data
#define ETH_DEFAULT_PRODUCT
static const struct usb_temp_interface_desc eth_data_null_interface
static void eth_init(void *arg __unused)
SYSUNINIT(eth_uninit, SI_SUB_LOCK, SI_ORDER_FIRST, eth_uninit, NULL)
static const struct usb_cdc_ethernet_descriptor eth_enf_desc
#define ETH_DEFAULT_PRODUCT_ID
#define ETH_DEFAULT_CONTROL
#define ETH_DEFAULT_VENDOR_ID
static const struct usb_temp_packet_size bulk_mps
static struct usb_string_descriptor eth_product
#define ETH_DEFAULT_CONFIG
static const struct usb_cdc_union_descriptor eth_union_desc
#define ETH_DEFAULT_MANUFACTURER
static void eth_uninit(void *arg __unused)
static const struct usb_temp_endpoint_desc * eth_intr_endpoints[]
static const struct usb_temp_endpoint_desc bulk_out_ep
static const struct usb_temp_config_desc eth_config_desc
static const struct usb_temp_endpoint_desc bulk_in_ep
static struct usb_string_descriptor eth_mac
#define ETH_DEFAULT_SERIAL_NUMBER
static struct usb_string_descriptor eth_control
static const struct usb_temp_packet_size intr_mps
static const void * eth_control_if_desc[]
static struct usb_string_descriptor eth_serial_number
static const struct usb_temp_endpoint_desc intr_in_ep
static struct sysctl_ctx_list eth_ctx_list
static const struct usb_temp_endpoint_desc * eth_data_endpoints[]
static const struct usb_temp_interface_desc * eth_interfaces[]
static struct usb_string_descriptor eth_manufacturer
@ ETH_CONFIGURATION_INDEX
@ ETH_SERIAL_NUMBER_INDEX
static const struct usb_cdc_header_descriptor eth_header_desc
static const struct usb_temp_interface_desc eth_data_interface
struct usb_temp_device_desc usb_template_cdce
SYSINIT(eth_init, SI_SUB_LOCK, SI_ORDER_FIRST, eth_init, NULL)
static const struct usb_temp_config_desc * eth_configs[]
uint8_t usb_make_str_desc(void *ptr, uint16_t max_len, const char *s)