kernel - Refactor vnode_free_list, vnode reuse algorithm
[dragonfly.git] / sys / bus / usb / usbhid.h
blob08d294df934072df99545091dd301769fb286ec8
1 /*
2 * $NetBSD: usbhid.h,v 1.9 2000/09/03 19:09:14 augustss Exp $
3 * $FreeBSD: src/sys/dev/usb/usbhid.h,v 1.13 2002/01/02 20:16:53 joe Exp $
4 * $DragonFly: src/sys/bus/usb/usbhid.h,v 1.4 2007/12/30 20:02:56 hasso Exp $
5 */
7 /*
8 * Copyright (c) 1998 The NetBSD Foundation, Inc.
9 * All rights reserved.
11 * This code is derived from software contributed to The NetBSD Foundation
12 * by Lennart Augustsson (lennart@augustsson.net) at
13 * Carlstedt Research & Technology.
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 * 3. All advertising materials mentioning features or use of this software
24 * must display the following acknowledgement:
25 * This product includes software developed by the NetBSD
26 * Foundation, Inc. and its contributors.
27 * 4. Neither the name of The NetBSD Foundation nor the names of its
28 * contributors may be used to endorse or promote products derived
29 * from this software without specific prior written permission.
31 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
32 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
33 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
34 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
35 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41 * POSSIBILITY OF SUCH DAMAGE.
45 #ifndef _USBHID_H_
46 #define _USBHID_H_
48 #define UR_GET_HID_DESCRIPTOR 0x06
49 #define UDESC_HID 0x21
50 #define UDESC_REPORT 0x22
51 #define UDESC_PHYSICAL 0x23
52 #define UR_SET_HID_DESCRIPTOR 0x07
53 #define UR_GET_REPORT 0x01
54 #define UR_SET_REPORT 0x09
55 #define UR_GET_IDLE 0x02
56 #define UR_SET_IDLE 0x0a
57 #define UR_GET_PROTOCOL 0x03
58 #define UR_SET_PROTOCOL 0x0b
60 typedef struct usb_hid_descriptor {
61 uByte bLength;
62 uByte bDescriptorType;
63 uWord bcdHID;
64 uByte bCountryCode;
65 uByte bNumDescriptors;
66 struct {
67 uByte bDescriptorType;
68 uWord wDescriptorLength;
69 } descrs[1];
70 } UPACKED usb_hid_descriptor_t;
71 #define USB_HID_DESCRIPTOR_SIZE(n) (9+(n)*3)
73 /* Usage pages */
74 #define HUP_UNDEFINED 0x0000
75 #define HUP_GENERIC_DESKTOP 0x0001
76 #define HUP_SIMULATION 0x0002
77 #define HUP_VR_CONTROLS 0x0003
78 #define HUP_SPORTS_CONTROLS 0x0004
79 #define HUP_GAMING_CONTROLS 0x0005
80 #define HUP_KEYBOARD 0x0007
81 #define HUP_LEDS 0x0008
82 #define HUP_BUTTON 0x0009
83 #define HUP_ORDINALS 0x000a
84 #define HUP_TELEPHONY 0x000b
85 #define HUP_CONSUMER 0x000c
86 #define HUP_DIGITIZERS 0x000d
87 #define HUP_PHYSICAL_IFACE 0x000e
88 #define HUP_UNICODE 0x0010
89 #define HUP_ALPHANUM_DISPLAY 0x0014
90 #define HUP_MONITOR 0x0080
91 #define HUP_MONITOR_ENUM_VAL 0x0081
92 #define HUP_VESA_VC 0x0082
93 #define HUP_VESA_CMD 0x0083
94 #define HUP_POWER 0x0084
95 #define HUP_BATTERY_SYSTEM 0x0085
96 #define HUP_BARCODE_SCANNER 0x008b
97 #define HUP_SCALE 0x008c
98 #define HUP_CAMERA_CONTROL 0x0090
99 #define HUP_ARCADE 0x0091
100 #define HUP_MICROSOFT 0xff00
102 /* Usages, generic desktop */
103 #define HUG_POINTER 0x0001
104 #define HUG_MOUSE 0x0002
105 #define HUG_JOYSTICK 0x0004
106 #define HUG_GAME_PAD 0x0005
107 #define HUG_KEYBOARD 0x0006
108 #define HUG_KEYPAD 0x0007
109 #define HUG_X 0x0030
110 #define HUG_Y 0x0031
111 #define HUG_Z 0x0032
112 #define HUG_RX 0x0033
113 #define HUG_RY 0x0034
114 #define HUG_RZ 0x0035
115 #define HUG_SLIDER 0x0036
116 #define HUG_DIAL 0x0037
117 #define HUG_WHEEL 0x0038
118 #define HUG_HAT_SWITCH 0x0039
119 #define HUG_COUNTED_BUFFER 0x003a
120 #define HUG_BYTE_COUNT 0x003b
121 #define HUG_MOTION_WAKEUP 0x003c
122 #define HUG_VX 0x0040
123 #define HUG_VY 0x0041
124 #define HUG_VZ 0x0042
125 #define HUG_VBRX 0x0043
126 #define HUG_VBRY 0x0044
127 #define HUG_VBRZ 0x0045
128 #define HUG_VNO 0x0046
129 #define HUG_SYSTEM_CONTROL 0x0080
130 #define HUG_SYSTEM_POWER_DOWN 0x0081
131 #define HUG_SYSTEM_SLEEP 0x0082
132 #define HUG_SYSTEM_WAKEUP 0x0083
133 #define HUG_SYSTEM_CONTEXT_MENU 0x0084
134 #define HUG_SYSTEM_MAIN_MENU 0x0085
135 #define HUG_SYSTEM_APP_MENU 0x0086
136 #define HUG_SYSTEM_MENU_HELP 0x0087
137 #define HUG_SYSTEM_MENU_EXIT 0x0088
138 #define HUG_SYSTEM_MENU_SELECT 0x0089
139 #define HUG_SYSTEM_MENU_RIGHT 0x008a
140 #define HUG_SYSTEM_MENU_LEFT 0x008b
141 #define HUG_SYSTEM_MENU_UP 0x008c
142 #define HUG_SYSTEM_MENU_DOWN 0x008d
144 /* Usages Digitizers */
145 #define HUD_UNDEFINED 0x0000
146 #define HUD_TIP_PRESSURE 0x0030
147 #define HUD_BARREL_PRESSURE 0x0031
148 #define HUD_IN_RANGE 0x0032
149 #define HUD_TOUCH 0x0033
150 #define HUD_UNTOUCH 0x0034
151 #define HUD_TAP 0x0035
152 #define HUD_QUALITY 0x0036
153 #define HUD_DATA_VALID 0x0037
154 #define HUD_TRANSDUCER_INDEX 0x0038
155 #define HUD_TABLET_FKEYS 0x0039
156 #define HUD_PROGRAM_CHANGE_KEYS 0x003a
157 #define HUD_BATTERY_STRENGTH 0x003b
158 #define HUD_INVERT 0x003c
159 #define HUD_X_TILT 0x003d
160 #define HUD_Y_TILT 0x003e
161 #define HUD_AZIMUTH 0x003f
162 #define HUD_ALTITUDE 0x0040
163 #define HUD_TWIST 0x0041
164 #define HUD_TIP_SWITCH 0x0042
165 #define HUD_SEC_TIP_SWITCH 0x0043
166 #define HUD_BARREL_SWITCH 0x0044
167 #define HUD_ERASER 0x0045
168 #define HUD_TABLET_PICK 0x0046
170 /* Usages, Consumer */
171 #define HUC_AC_PAN 0x0238
173 #define HID_USAGE2(p,u) (((p) << 16) | u)
175 #define UHID_INPUT_REPORT 0x01
176 #define UHID_OUTPUT_REPORT 0x02
177 #define UHID_FEATURE_REPORT 0x03
179 /* Bits in the input/output/feature items */
180 #define HIO_CONST 0x001
181 #define HIO_VARIABLE 0x002
182 #define HIO_RELATIVE 0x004
183 #define HIO_WRAP 0x008
184 #define HIO_NONLINEAR 0x010
185 #define HIO_NOPREF 0x020
186 #define HIO_NULLSTATE 0x040
187 #define HIO_VOLATILE 0x080
188 #define HIO_BUFBYTES 0x100
190 #endif /* _USBHID_H_ */