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>
79#define MOUSE_DEFAULT_VENDOR_ID USB_TEMPLATE_VENDOR
80#define MOUSE_DEFAULT_PRODUCT_ID 0x27da
81#define MOUSE_DEFAULT_INTERFACE "Mouse interface"
82#define MOUSE_DEFAULT_MANUFACTURER USB_TEMPLATE_MANUFACTURER
83#define MOUSE_DEFAULT_PRODUCT "Mouse Test Interface"
84#define MOUSE_DEFAULT_SERIAL_NUMBER "March 2008"
98 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x09, 0x01,
99 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03,
100 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01,
101 0x81, 0x02, 0x95, 0x05, 0x81, 0x03, 0x05, 0x01,
102 0x09, 0x30, 0x09, 0x31, 0x09, 0x38, 0x15, 0x81,
103 0x25, 0x7f, 0x75, 0x08, 0x95, 0x03, 0x81, 0x06,
179 .bDeviceSubClass = 0,
180 .bDeviceProtocol = 0,
196 if ((
req->bmRequestType == 0x81) && (
req->bRequest == 0x06) &&
197 (
req->wValue[0] == 0x00) && (
req->wValue[1] == 0x22) &&
198 (
req->wIndex[1] == 0) && (
req->wIndex[0] == 0)) {
223 if (string_index == 0) {
226 if (lang_id != 0x0409) {
230 return (ptr[string_index]);
238 struct sysctl_oid *parent;
254 SYSCTL_STATIC_CHILDREN(_hw_usb_templates), OID_AUTO,
255 parent_name, CTLFLAG_RW | CTLFLAG_MPSAFE,
256 0,
"USB Mouse device side template");
257 SYSCTL_ADD_U16(&
mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
258 "vendor_id", CTLFLAG_RWTUN,
260 SYSCTL_ADD_U16(&
mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
261 "product_id", CTLFLAG_RWTUN,
264 SYSCTL_ADD_PROC(&
mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
265 "interface", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
267 "A",
"Interface string");
269 SYSCTL_ADD_PROC(&
mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
270 "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
272 "A",
"Manufacturer string");
273 SYSCTL_ADD_PROC(&
mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
274 "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
276 "A",
"Product string");
277 SYSCTL_ADD_PROC(&
mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
278 "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
280 "A",
"Serial number string");
const struct usb_temp_interface_desc ** ppIfaceDesc
usb_temp_get_string_desc_t * getStringDesc
uint8_t bInterval[USB_SPEED_MAX]
uint16_t mps[USB_SPEED_MAX]
const struct usb_string_lang usb_string_lang_en
int usb_temp_sysctl(SYSCTL_HANDLER_ARGS)
const void *() usb_temp_get_vendor_desc_t(const struct usb_device_request *req, uint16_t *plen)
const void *() usb_temp_get_string_desc_t(uint16_t lang_id, uint8_t string_index)
SYSINIT(mouse_init, SI_SUB_LOCK, SI_ORDER_FIRST, mouse_init, NULL)
#define MOUSE_DEFAULT_VENDOR_ID
static const struct usb_temp_packet_size mouse_intr_mps
struct usb_temp_device_desc usb_template_mouse
static struct usb_string_descriptor mouse_serial_number
static const struct usb_temp_config_desc * mouse_configs[]
static const struct usb_temp_config_desc mouse_config_desc
static void mouse_uninit(void *arg __unused)
static struct usb_string_descriptor mouse_product
static uint8_t mouse_hid_descriptor[]
static const struct usb_temp_interval mouse_intr_interval
static const struct usb_temp_interface_desc mouse_iface_0
@ MOUSE_MANUFACTURER_INDEX
@ MOUSE_SERIAL_NUMBER_INDEX
static struct usb_string_descriptor mouse_interface
static const struct usb_temp_interface_desc * mouse_interfaces[]
static struct sysctl_ctx_list mouse_ctx_list
static const struct usb_temp_endpoint_desc * mouse_endpoints[]
static struct usb_string_descriptor mouse_manufacturer
static usb_temp_get_string_desc_t mouse_get_string_desc
#define MOUSE_DEFAULT_SERIAL_NUMBER
#define MOUSE_DEFAULT_MANUFACTURER
static const struct usb_temp_endpoint_desc mouse_ep_0
static const uint8_t mouse_raw_desc[]
static usb_temp_get_vendor_desc_t mouse_get_vendor_desc
static void mouse_init(void *arg __unused)
#define MOUSE_DEFAULT_PRODUCT_ID
#define MOUSE_DEFAULT_INTERFACE
SYSUNINIT(mouse_uninit, SI_SUB_LOCK, SI_ORDER_FIRST, mouse_uninit, NULL)
#define MOUSE_DEFAULT_PRODUCT
static const void * mouse_iface_0_desc[]
uint8_t usb_make_str_desc(void *ptr, uint16_t max_len, const char *s)