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 KBD_DEFAULT_VENDOR_ID USB_TEMPLATE_VENDOR
80#define KBD_DEFAULT_PRODUCT_ID 0x27db
81#define KBD_DEFAULT_INTERFACE "Keyboard Interface"
82#define KBD_DEFAULT_MANUFACTURER USB_TEMPLATE_MANUFACTURER
83#define KBD_DEFAULT_PRODUCT "Keyboard Test Device"
84#define KBD_DEFAULT_SERIAL_NUMBER "March 2008"
110 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07,
111 0x19, 0xe0, 0x29, 0xe7, 0x15, 0x00, 0x25, 0x01,
112 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x95, 0x01,
113 0x75, 0x08, 0x81, 0x01, 0x95, 0x03, 0x75, 0x01,
114 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x91, 0x02,
115 0x95, 0x05, 0x75, 0x01, 0x91, 0x01, 0x95, 0x06,
116 0x75, 0x08, 0x15, 0x00, 0x26, 0xff, 0x00, 0x05,
117 0x07, 0x19, 0x00, 0x2a, 0xff, 0x00, 0x81, 0x00,
181 .bDeviceSubClass = 0,
182 .bDeviceProtocol = 0,
198 if ((
req->bmRequestType == 0x81) && (
req->bRequest == 0x06) &&
199 (
req->wValue[0] == 0x00) && (
req->wValue[1] == 0x22) &&
200 (
req->wIndex[1] == 0) && (
req->wIndex[0] == 0)) {
225 if (string_index == 0) {
228 if (lang_id != 0x0409) {
232 return (ptr[string_index]);
240 struct sysctl_oid *parent;
252 snprintf(parent_name,
sizeof(parent_name),
"%d",
USB_TEMP_KBD);
256 SYSCTL_STATIC_CHILDREN(_hw_usb_templates), OID_AUTO,
257 parent_name, CTLFLAG_RW | CTLFLAG_MPSAFE,
258 0,
"USB Keyboard device side template");
259 SYSCTL_ADD_U16(&
kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
260 "vendor_id", CTLFLAG_RWTUN,
262 SYSCTL_ADD_U16(&
kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
263 "product_id", CTLFLAG_RWTUN,
266 SYSCTL_ADD_PROC(&
kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
267 "interface", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
269 "A",
"Interface string");
271 SYSCTL_ADD_PROC(&
kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
272 "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
274 "A",
"Manufacturer string");
275 SYSCTL_ADD_PROC(&
kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
276 "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
278 "A",
"Product string");
279 SYSCTL_ADD_PROC(&
kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
280 "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
282 "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]
#define UIPROTO_BOOT_KEYBOARD
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)
#define KBD_DEFAULT_VENDOR_ID
#define KBD_DEFAULT_MANUFACTURER
static void kbd_init(void *arg __unused)
SYSINIT(kbd_init, SI_SUB_LOCK, SI_ORDER_FIRST, kbd_init, NULL)
static usb_temp_get_vendor_desc_t keyboard_get_vendor_desc
static struct usb_string_descriptor kbd_manufacturer
static const uint8_t keyboard_raw_desc[]
#define KBD_DEFAULT_INTERFACE
static struct usb_string_descriptor kbd_product
@ KBD_SERIAL_NUMBER_INDEX
#define KBD_DEFAULT_SERIAL_NUMBER
static struct usb_string_descriptor kbd_serial_number
static struct usb_string_descriptor kbd_interface
static uint8_t keyboard_hid_descriptor[]
static const struct usb_temp_endpoint_desc keyboard_ep_0
static const struct usb_temp_endpoint_desc * keyboard_endpoints[]
static const struct usb_temp_packet_size keyboard_intr_mps
static const struct usb_temp_config_desc * keyboard_configs[]
static const struct usb_temp_interface_desc keyboard_iface_0
static usb_temp_get_string_desc_t keyboard_get_string_desc
static const void * keyboard_iface_0_desc[]
static const struct usb_temp_interface_desc * keyboard_interfaces[]
SYSUNINIT(kbd_uninit, SI_SUB_LOCK, SI_ORDER_FIRST, kbd_uninit, NULL)
static struct sysctl_ctx_list kbd_ctx_list
static const struct usb_temp_interval keyboard_intr_interval
#define KBD_DEFAULT_PRODUCT
static void kbd_uninit(void *arg __unused)
struct usb_temp_device_desc usb_template_kbd
#define KBD_DEFAULT_PRODUCT_ID
static const struct usb_temp_config_desc keyboard_config_desc
uint8_t usb_make_str_desc(void *ptr, uint16_t max_len, const char *s)