usbhid.h revision 192984
1184610Salfred/* $FreeBSD: head/sys/dev/usb/usbhid.h 192984 2009-05-28 17:36:36Z thompsa $ */ 2184610Salfred/*- 3184610Salfred * Copyright (c) 2008 Hans Petter Selasky. All rights reserved. 4184610Salfred * Copyright (c) 1998 The NetBSD Foundation, Inc. All rights reserved. 5184610Salfred * Copyright (c) 1998 Lennart Augustsson. All rights reserved. 6184610Salfred * 7184610Salfred * Redistribution and use in source and binary forms, with or without 8184610Salfred * modification, are permitted provided that the following conditions 9184610Salfred * are met: 10184610Salfred * 1. Redistributions of source code must retain the above copyright 11184610Salfred * notice, this list of conditions and the following disclaimer. 12184610Salfred * 2. Redistributions in binary form must reproduce the above copyright 13184610Salfred * notice, this list of conditions and the following disclaimer in the 14184610Salfred * documentation and/or other materials provided with the distribution. 15184610Salfred * 16184610Salfred * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17184610Salfred * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18184610Salfred * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19184610Salfred * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20184610Salfred * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21184610Salfred * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22184610Salfred * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23184610Salfred * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24184610Salfred * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25184610Salfred * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26184610Salfred * SUCH DAMAGE. 27184610Salfred */ 28184610Salfred 29184610Salfred#ifndef _USB2_HID_H_ 30184610Salfred#define _USB2_HID_H_ 31184610Salfred 32188942Sthompsa#include <dev/usb/usb_endian.h> 33187994Salfred 34184610Salfred#define UR_GET_HID_DESCRIPTOR 0x06 35184610Salfred#define UDESC_HID 0x21 36184610Salfred#define UDESC_REPORT 0x22 37184610Salfred#define UDESC_PHYSICAL 0x23 38184610Salfred#define UR_SET_HID_DESCRIPTOR 0x07 39184610Salfred#define UR_GET_REPORT 0x01 40184610Salfred#define UR_SET_REPORT 0x09 41184610Salfred#define UR_GET_IDLE 0x02 42184610Salfred#define UR_SET_IDLE 0x0a 43184610Salfred#define UR_GET_PROTOCOL 0x03 44184610Salfred#define UR_SET_PROTOCOL 0x0b 45184610Salfred 46192984Sthompsastruct usb_hid_descriptor { 47184610Salfred uByte bLength; 48184610Salfred uByte bDescriptorType; 49184610Salfred uWord bcdHID; 50184610Salfred uByte bCountryCode; 51184610Salfred uByte bNumDescriptors; 52184610Salfred struct { 53184610Salfred uByte bDescriptorType; 54184610Salfred uWord wDescriptorLength; 55184610Salfred } descrs[1]; 56184610Salfred} __packed; 57184610Salfred 58184610Salfred#define USB_HID_DESCRIPTOR_SIZE(n) (9+((n)*3)) 59184610Salfred 60184610Salfred/* Usage pages */ 61184610Salfred#define HUP_UNDEFINED 0x0000 62184610Salfred#define HUP_GENERIC_DESKTOP 0x0001 63184610Salfred#define HUP_SIMULATION 0x0002 64184610Salfred#define HUP_VR_CONTROLS 0x0003 65184610Salfred#define HUP_SPORTS_CONTROLS 0x0004 66184610Salfred#define HUP_GAMING_CONTROLS 0x0005 67184610Salfred#define HUP_KEYBOARD 0x0007 68184610Salfred#define HUP_LEDS 0x0008 69184610Salfred#define HUP_BUTTON 0x0009 70184610Salfred#define HUP_ORDINALS 0x000a 71184610Salfred#define HUP_TELEPHONY 0x000b 72184610Salfred#define HUP_CONSUMER 0x000c 73184610Salfred#define HUP_DIGITIZERS 0x000d 74184610Salfred#define HUP_PHYSICAL_IFACE 0x000e 75184610Salfred#define HUP_UNICODE 0x0010 76184610Salfred#define HUP_ALPHANUM_DISPLAY 0x0014 77184610Salfred#define HUP_MONITOR 0x0080 78184610Salfred#define HUP_MONITOR_ENUM_VAL 0x0081 79184610Salfred#define HUP_VESA_VC 0x0082 80184610Salfred#define HUP_VESA_CMD 0x0083 81184610Salfred#define HUP_POWER 0x0084 82184610Salfred#define HUP_BATTERY_SYSTEM 0x0085 83184610Salfred#define HUP_BARCODE_SCANNER 0x008b 84184610Salfred#define HUP_SCALE 0x008c 85184610Salfred#define HUP_CAMERA_CONTROL 0x0090 86184610Salfred#define HUP_ARCADE 0x0091 87184610Salfred#define HUP_MICROSOFT 0xff00 88184610Salfred 89184610Salfred/* Usages, generic desktop */ 90184610Salfred#define HUG_POINTER 0x0001 91184610Salfred#define HUG_MOUSE 0x0002 92184610Salfred#define HUG_JOYSTICK 0x0004 93184610Salfred#define HUG_GAME_PAD 0x0005 94184610Salfred#define HUG_KEYBOARD 0x0006 95184610Salfred#define HUG_KEYPAD 0x0007 96184610Salfred#define HUG_X 0x0030 97184610Salfred#define HUG_Y 0x0031 98184610Salfred#define HUG_Z 0x0032 99184610Salfred#define HUG_RX 0x0033 100184610Salfred#define HUG_RY 0x0034 101184610Salfred#define HUG_RZ 0x0035 102184610Salfred#define HUG_SLIDER 0x0036 103184610Salfred#define HUG_DIAL 0x0037 104184610Salfred#define HUG_WHEEL 0x0038 105184610Salfred#define HUG_HAT_SWITCH 0x0039 106184610Salfred#define HUG_COUNTED_BUFFER 0x003a 107184610Salfred#define HUG_BYTE_COUNT 0x003b 108184610Salfred#define HUG_MOTION_WAKEUP 0x003c 109184610Salfred#define HUG_VX 0x0040 110184610Salfred#define HUG_VY 0x0041 111184610Salfred#define HUG_VZ 0x0042 112184610Salfred#define HUG_VBRX 0x0043 113184610Salfred#define HUG_VBRY 0x0044 114184610Salfred#define HUG_VBRZ 0x0045 115184610Salfred#define HUG_VNO 0x0046 116184610Salfred#define HUG_TWHEEL 0x0048 /* M$ Wireless Intellimouse Wheel */ 117184610Salfred#define HUG_SYSTEM_CONTROL 0x0080 118184610Salfred#define HUG_SYSTEM_POWER_DOWN 0x0081 119184610Salfred#define HUG_SYSTEM_SLEEP 0x0082 120184610Salfred#define HUG_SYSTEM_WAKEUP 0x0083 121184610Salfred#define HUG_SYSTEM_CONTEXT_MENU 0x0084 122184610Salfred#define HUG_SYSTEM_MAIN_MENU 0x0085 123184610Salfred#define HUG_SYSTEM_APP_MENU 0x0086 124184610Salfred#define HUG_SYSTEM_MENU_HELP 0x0087 125184610Salfred#define HUG_SYSTEM_MENU_EXIT 0x0088 126184610Salfred#define HUG_SYSTEM_MENU_SELECT 0x0089 127184610Salfred#define HUG_SYSTEM_MENU_RIGHT 0x008a 128184610Salfred#define HUG_SYSTEM_MENU_LEFT 0x008b 129184610Salfred#define HUG_SYSTEM_MENU_UP 0x008c 130184610Salfred#define HUG_SYSTEM_MENU_DOWN 0x008d 131192925Sthompsa#define HUG_APPLE_EJECT 0x00b8 132184610Salfred 133184610Salfred/* Usages Digitizers */ 134184610Salfred#define HUD_UNDEFINED 0x0000 135184610Salfred#define HUD_TIP_PRESSURE 0x0030 136184610Salfred#define HUD_BARREL_PRESSURE 0x0031 137184610Salfred#define HUD_IN_RANGE 0x0032 138184610Salfred#define HUD_TOUCH 0x0033 139184610Salfred#define HUD_UNTOUCH 0x0034 140184610Salfred#define HUD_TAP 0x0035 141184610Salfred#define HUD_QUALITY 0x0036 142184610Salfred#define HUD_DATA_VALID 0x0037 143184610Salfred#define HUD_TRANSDUCER_INDEX 0x0038 144184610Salfred#define HUD_TABLET_FKEYS 0x0039 145184610Salfred#define HUD_PROGRAM_CHANGE_KEYS 0x003a 146184610Salfred#define HUD_BATTERY_STRENGTH 0x003b 147184610Salfred#define HUD_INVERT 0x003c 148184610Salfred#define HUD_X_TILT 0x003d 149184610Salfred#define HUD_Y_TILT 0x003e 150184610Salfred#define HUD_AZIMUTH 0x003f 151184610Salfred#define HUD_ALTITUDE 0x0040 152184610Salfred#define HUD_TWIST 0x0041 153184610Salfred#define HUD_TIP_SWITCH 0x0042 154184610Salfred#define HUD_SEC_TIP_SWITCH 0x0043 155184610Salfred#define HUD_BARREL_SWITCH 0x0044 156184610Salfred#define HUD_ERASER 0x0045 157184610Salfred#define HUD_TABLET_PICK 0x0046 158184610Salfred 159184610Salfred#define HID_USAGE2(p,u) (((p) << 16) | (u)) 160184610Salfred 161184610Salfred#define UHID_INPUT_REPORT 0x01 162184610Salfred#define UHID_OUTPUT_REPORT 0x02 163184610Salfred#define UHID_FEATURE_REPORT 0x03 164184610Salfred 165184610Salfred/* Bits in the input/output/feature items */ 166184610Salfred#define HIO_CONST 0x001 167184610Salfred#define HIO_VARIABLE 0x002 168184610Salfred#define HIO_RELATIVE 0x004 169184610Salfred#define HIO_WRAP 0x008 170184610Salfred#define HIO_NONLINEAR 0x010 171184610Salfred#define HIO_NOPREF 0x020 172184610Salfred#define HIO_NULLSTATE 0x040 173184610Salfred#define HIO_VOLATILE 0x080 174184610Salfred#define HIO_BUFBYTES 0x100 175184610Salfred 176184610Salfred#endif /* _USB2_HID_H_ */ 177