usb_rdesc.h 14.9 KB
Newer Older
W
wenjun 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
/*-
 * Copyright (c) 2000 Nick Hibma <n_hibma@FreeBSD.org>
 * All rights reserved.
 *
 * Copyright (c) 2005 Ed Schouten <ed@FreeBSD.org>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 * $FreeBSD: releng/11.4/sys/dev/usb/input/usb_rdesc.h 331722 2018-03-29 02:50:57Z eadler $
 *
 * This file contains replacements for broken HID report descriptors.
 */

#define	UHID_GRAPHIRE_REPORT_DESCR(...) \
    0x05, 0x0d,                    /*  USAGE_PAGE (Digitizers)		*/\
    0x09, 0x01,                    /*  USAGE (Digitizer)		*/\
    0xa1, 0x01,                    /*  COLLECTION (Application)		*/\
    0x85, 0x02,                    /*    REPORT_ID (2)			*/\
    0x05, 0x0d,                    /*    USAGE_PAGE (Digitizers)	*/\
    0x09, 0x01,                    /*    USAGE (Digitizer)		*/\
    0xa1, 0x00,                    /*    COLLECTION (Physical)		*/\
    0x15, 0x00,                    /*      LOGICAL_MINIMUM (0)		*/\
    0x25, 0x01,                    /*      LOGICAL_MAXIMUM (1)		*/\
    0x09, 0x33,                    /*      USAGE (Touch)		*/\
    0x95, 0x01,                    /*      REPORT_COUNT (1)		*/\
    0x75, 0x01,                    /*      REPORT_SIZE (1)		*/\
    0x81, 0x02,                    /*      INPUT (Data,Var,Abs)		*/\
    0x09, 0x44,                    /*      USAGE (Barrel Switch)	*/\
    0x95, 0x02,                    /*      REPORT_COUNT (2)		*/\
    0x75, 0x01,                    /*      REPORT_SIZE (1)		*/\
    0x81, 0x02,                    /*      INPUT (Data,Var,Abs)		*/\
    0x09, 0x00,                    /*      USAGE (Undefined)		*/\
    0x95, 0x02,                    /*      REPORT_COUNT (2)		*/\
    0x75, 0x01,                    /*      REPORT_SIZE (1)		*/\
    0x81, 0x03,                    /*      INPUT (Cnst,Var,Abs)		*/\
    0x09, 0x3c,                    /*      USAGE (Invert)		*/\
    0x95, 0x01,                    /*      REPORT_COUNT (1)		*/\
    0x75, 0x01,                    /*      REPORT_SIZE (1)		*/\
    0x81, 0x02,                    /*      INPUT (Data,Var,Abs)		*/\
    0x09, 0x38,                    /*      USAGE (Transducer Index)	*/\
    0x95, 0x01,                    /*      REPORT_COUNT (1)		*/\
    0x75, 0x01,                    /*      REPORT_SIZE (1)		*/\
    0x81, 0x02,                    /*      INPUT (Data,Var,Abs)		*/\
    0x09, 0x32,                    /*      USAGE (In Range)		*/\
    0x95, 0x01,                    /*      REPORT_COUNT (1)		*/\
    0x75, 0x01,                    /*      REPORT_SIZE (1)		*/\
    0x81, 0x02,                    /*      INPUT (Data,Var,Abs)		*/\
    0x05, 0x01,                    /*      USAGE_PAGE (Generic Desktop)	*/\
    0x09, 0x30,                    /*      USAGE (X)			*/\
    0x15, 0x00,                    /*      LOGICAL_MINIMUM (0)		*/\
    0x26, 0xde, 0x27,              /*      LOGICAL_MAXIMUM (10206)	*/\
    0x95, 0x01,                    /*      REPORT_COUNT (1)		*/\
    0x75, 0x10,                    /*      REPORT_SIZE (16)		*/\
    0x81, 0x02,                    /*      INPUT (Data,Var,Abs)		*/\
    0x09, 0x31,                    /*      USAGE (Y)			*/\
    0x26, 0xfe, 0x1c,              /*      LOGICAL_MAXIMUM (7422)	*/\
    0x95, 0x01,                    /*      REPORT_COUNT (1)		*/\
    0x75, 0x10,                    /*      REPORT_SIZE (16)		*/\
    0x81, 0x02,                    /*      INPUT (Data,Var,Abs)		*/\
    0x05, 0x0d,                    /*      USAGE_PAGE (Digitizers)	*/\
    0x09, 0x30,                    /*      USAGE (Tip Pressure)		*/\
    0x26, 0xff, 0x01,              /*      LOGICAL_MAXIMUM (511)	*/\
    0x95, 0x01,                    /*      REPORT_COUNT (1)		*/\
    0x75, 0x10,                    /*      REPORT_SIZE (16)		*/\
    0x81, 0x02,                    /*      INPUT (Data,Var,Abs)		*/\
    0xc0,                          /*    END_COLLECTION			*/\
    0x05, 0x0d,                    /*    USAGE_PAGE (Digitizers)	*/\
    0x09, 0x00,                    /*    USAGE (Undefined)		*/\
    0x85, 0x02,                    /*    REPORT_ID (2)			*/\
    0x95, 0x01,                    /*    REPORT_COUNT (1)		*/\
    0xb1, 0x02,                    /*    FEATURE (Data,Var,Abs)		*/\
    0x09, 0x00,                    /*    USAGE (Undefined)		*/\
    0x85, 0x03,                    /*    REPORT_ID (3)			*/\
    0x95, 0x01,                    /*    REPORT_COUNT (1)		*/\
    0xb1, 0x02,                    /*    FEATURE (Data,Var,Abs)		*/\
    0xc0,                          /*  END_COLLECTION			*/\

#define	UHID_GRAPHIRE3_4X5_REPORT_DESCR(...) \
    0x05, 0x01,                    /* USAGE_PAGE (Generic Desktop)	*/\
    0x09, 0x02,                    /* USAGE (Mouse)			*/\
    0xa1, 0x01,                    /* COLLECTION (Application)		*/\
    0x85, 0x01,                    /*   REPORT_ID (1)			*/\
    0x09, 0x01,                    /*   USAGE (Pointer)			*/\
    0xa1, 0x00,                    /*   COLLECTION (Physical)		*/\
    0x05, 0x09,                    /*     USAGE_PAGE (Button)		*/\
    0x19, 0x01,                    /*     USAGE_MINIMUM (Button 1)	*/\
    0x29, 0x03,                    /*     USAGE_MAXIMUM (Button 3)	*/\
    0x15, 0x00,                    /*     LOGICAL_MINIMUM (0)		*/\
    0x25, 0x01,                    /*     LOGICAL_MAXIMUM (1)		*/\
    0x95, 0x03,                    /*     REPORT_COUNT (3)		*/\
    0x75, 0x01,                    /*     REPORT_SIZE (1)		*/\
    0x81, 0x02,                    /*     INPUT (Data,Var,Abs)		*/\
    0x95, 0x01,                    /*     REPORT_COUNT (1)		*/\
    0x75, 0x05,                    /*     REPORT_SIZE (5)		*/\
    0x81, 0x01,                    /*     INPUT (Cnst,Ary,Abs)		*/\
    0x05, 0x01,                    /*     USAGE_PAGE (Generic Desktop)	*/\
    0x09, 0x30,                    /*     USAGE (X)			*/\
    0x09, 0x31,                    /*     USAGE (Y)			*/\
    0x09, 0x38,                    /*     USAGE (Wheel)			*/\
    0x15, 0x81,                    /*     LOGICAL_MINIMUM (-127)	*/\
    0x25, 0x7f,                    /*     LOGICAL_MAXIMUM (127)		*/\
    0x75, 0x08,                    /*     REPORT_SIZE (8)		*/\
    0x95, 0x03,                    /*     REPORT_COUNT (3)		*/\
    0x81, 0x06,                    /*     INPUT (Data,Var,Rel)		*/\
    0xc0,                          /*   END_COLLECTION			*/\
    0xc0,                          /* END_COLLECTION			*/\
    0x05, 0x0d,                    /* USAGE_PAGE (Digitizers)		*/\
    0x09, 0x01,                    /* USAGE (Pointer)			*/\
    0xa1, 0x01,                    /* COLLECTION (Applicaption)		*/\
    0x85, 0x02,                    /*   REPORT_ID (2)			*/\
    0x05, 0x0d,                    /*   USAGE_PAGE (Digitizers)		*/\
    0x09, 0x01,                    /*   USAGE (Digitizer)		*/\
    0xa1, 0x00,                    /*   COLLECTION (Physical)		*/\
    0x09, 0x33,                    /*     USAGE (Touch)			*/\
    0x09, 0x44,                    /*     USAGE (Barrel Switch)		*/\
    0x09, 0x44,                    /*     USAGE (Barrel Switch)		*/\
    0x15, 0x00,                    /*     LOGICAL_MINIMUM (0)		*/\
    0x25, 0x01,                    /*     LOGICAL_MAXIMUM (1)		*/\
    0x75, 0x01,                    /*     REPORT_SIZE (1)		*/\
    0x95, 0x03,                    /*     REPORT_COUNT (3)		*/\
    0x81, 0x02,                    /*     INPUT (Data,Var,Abs)		*/\
    0x75, 0x01,                    /*     REPORT_SIZE (1)		*/\
    0x95, 0x02,                    /*     REPORT_COUNT (2)		*/\
    0x81, 0x01,                    /*     INPUT (Cnst,Ary,Abs)		*/\
    0x09, 0x3c,                    /*     USAGE (Invert)		*/\
    0x09, 0x38,                    /*     USAGE (Transducer Index)	*/\
    0x09, 0x32,                    /*     USAGE (In Range)		*/\
    0x75, 0x01,                    /*     REPORT_SIZE (1)		*/\
    0x95, 0x03,                    /*     REPORT_COUNT (3)		*/\
    0x81, 0x02,                    /*     INPUT (Data,Var,Abs)		*/\
    0x05, 0x01,                    /*     USAGE_PAGE (Generic Desktop)	*/\
    0x09, 0x30,                    /*     USAGE (X)			*/\
    0x15, 0x00,                    /*     LOGICAL_MINIMUM (0)		*/\
    0x26, 0xde, 0x27,              /*     LOGICAL_MAXIMUM (10206)	*/\
    0x75, 0x10,                    /*     REPORT_SIZE (16)		*/\
    0x95, 0x01,                    /*     REPORT_COUNT (1)		*/\
    0x81, 0x02,                    /*     INPUT (Data,Var,Abs)		*/\
    0x09, 0x31,                    /*     USAGE (Y)			*/\
    0x26, 0xfe, 0x1c,              /*     LOGICAL_MAXIMUM (7422)	*/\
    0x75, 0x10,                    /*     REPORT_SIZE (16)		*/\
    0x95, 0x01,                    /*     REPORT_COUNT (1)		*/\
    0x81, 0x02,                    /*     INPUT (Data,Var,Abs)		*/\
    0x05, 0x0d,                    /*     USAGE_PAGE (Digitizers)	*/\
    0x09, 0x30,                    /*     USAGE (Tip Pressure)		*/\
    0x26, 0xff, 0x01,              /*     LOGICAL_MAXIMUM (511)		*/\
    0x75, 0x10,                    /*     REPORT_SIZE (16)		*/\
    0x95, 0x01,                    /*     REPORT_COUNT (1)		*/\
    0x81, 0x02,                    /*     INPUT (Data,Var,Abs)		*/\
    0xc0,                          /*   END_COLLECTION			*/\
    0x05, 0x0d,                    /*   USAGE_PAGE (Digitizers)		*/\
    0x09, 0x00,                    /*   USAGE (Undefined)		*/\
    0x85, 0x02,                    /*   REPORT_ID (2)			*/\
    0x95, 0x01,                    /*   REPORT_COUNT (1)		*/\
    0xb1, 0x02,                    /*   FEATURE (Data,Var,Abs)		*/\
    0x09, 0x00,                    /*   USAGE (Undefined)		*/\
    0x85, 0x03,                    /*   REPORT_ID (3)			*/\
    0x95, 0x01,                    /*   REPORT_COUNT (1)		*/\
    0xb1, 0x02,                    /*   FEATURE (Data,Var,Abs)		*/\
    0xc0                           /* END_COLLECTION			*/\

/*
 * The descriptor has no output report format, thus preventing you from
 * controlling the LEDs and the built-in rumblers.
 */
#define	UHID_XB360GP_REPORT_DESCR(...) \
    0x05, 0x01,		/* USAGE PAGE (Generic Desktop)		*/\
    0x09, 0x05,		/* USAGE (Gamepad)			*/\
    0xa1, 0x01,		/* COLLECTION (Application)		*/\
    /* Unused */\
    0x75, 0x08,		/*  REPORT SIZE (8)			*/\
    0x95, 0x01,		/*  REPORT COUNT (1)			*/\
    0x81, 0x01,		/*  INPUT (Constant)			*/\
    /* Byte count */\
    0x75, 0x08,		/*  REPORT SIZE (8)			*/\
    0x95, 0x01,		/*  REPORT COUNT (1)			*/\
    0x05, 0x01,		/*  USAGE PAGE (Generic Desktop)	*/\
    0x09, 0x3b,		/*  USAGE (Byte Count)			*/\
    0x81, 0x01,		/*  INPUT (Constant)			*/\
    /* D-Pad */\
    0x05, 0x01,		/*  USAGE PAGE (Generic Desktop)	*/\
    0x09, 0x01,		/*  USAGE (Pointer)			*/\
    0xa1, 0x00,		/*  COLLECTION (Physical)		*/\
    0x75, 0x01,		/*   REPORT SIZE (1)			*/\
    0x15, 0x00,		/*   LOGICAL MINIMUM (0)		*/\
    0x25, 0x01,		/*   LOGICAL MAXIMUM (1)		*/\
    0x35, 0x00,		/*   PHYSICAL MINIMUM (0)		*/\
    0x45, 0x01,		/*   PHYSICAL MAXIMUM (1)		*/\
    0x95, 0x04,		/*   REPORT COUNT (4)			*/\
    0x05, 0x01,		/*   USAGE PAGE (Generic Desktop)	*/\
    0x09, 0x90,		/*   USAGE (D-Pad Up)			*/\
    0x09, 0x91,		/*   USAGE (D-Pad Down)			*/\
    0x09, 0x93,		/*   USAGE (D-Pad Left)			*/\
    0x09, 0x92,		/*   USAGE (D-Pad Right)		*/\
    0x81, 0x02,		/*   INPUT (Data, Variable, Absolute)	*/\
    0xc0,		/*  END COLLECTION			*/\
    /* Buttons 5-11 */\
    0x75, 0x01,		/*  REPORT SIZE (1)			*/\
    0x15, 0x00,		/*  LOGICAL MINIMUM (0)			*/\
    0x25, 0x01,		/*  LOGICAL MAXIMUM (1)			*/\
    0x35, 0x00,		/*  PHYSICAL MINIMUM (0)		*/\
    0x45, 0x01,		/*  PHYSICAL MAXIMUM (1)		*/\
    0x95, 0x07,		/*  REPORT COUNT (7)			*/\
    0x05, 0x09,		/*  USAGE PAGE (Button)			*/\
    0x09, 0x08,		/*  USAGE (Button 8)			*/\
    0x09, 0x07,		/*  USAGE (Button 7)			*/\
    0x09, 0x09,		/*  USAGE (Button 9)			*/\
    0x09, 0x0a,		/*  USAGE (Button 10)			*/\
    0x09, 0x05,		/*  USAGE (Button 5)			*/\
    0x09, 0x06,		/*  USAGE (Button 6)			*/\
    0x09, 0x0b,		/*  USAGE (Button 11)			*/\
    0x81, 0x02,		/*  INPUT (Data, Variable, Absolute)	*/\
    /* Unused */\
    0x75, 0x01,		/*  REPORT SIZE (1)			*/\
    0x95, 0x01,		/*  REPORT COUNT (1)			*/\
    0x81, 0x01,		/*  INPUT (Constant)			*/\
    /* Buttons 1-4 */\
    0x75, 0x01,		/*  REPORT SIZE (1)			*/\
    0x15, 0x00,		/*  LOGICAL MINIMUM (0)			*/\
    0x25, 0x01,		/*  LOGICAL MAXIMUM (1)			*/\
    0x35, 0x00,		/*  PHYSICAL MINIMUM (0)		*/\
    0x45, 0x01,		/*  PHYSICAL MAXIMUM (1)		*/\
    0x95, 0x04,		/*  REPORT COUNT (4)			*/\
    0x05, 0x09,		/*  USAGE PAGE (Button)			*/\
    0x19, 0x01,		/*  USAGE MINIMUM (Button 1)		*/\
    0x29, 0x04,		/*  USAGE MAXIMUM (Button 4)		*/\
    0x81, 0x02,		/*  INPUT (Data, Variable, Absolute)	*/\
    /* Triggers */\
    0x75, 0x08,		/*  REPORT SIZE (8)			*/\
    0x15, 0x00,		/*  LOGICAL MINIMUM (0)			*/\
    0x26, 0xff, 0x00,	/*  LOGICAL MAXIMUM (255)		*/\
    0x35, 0x00,		/*  PHYSICAL MINIMUM (0)		*/\
    0x46, 0xff, 0x00,	/*  PHYSICAL MAXIMUM (255)		*/\
    0x95, 0x02,		/*  REPORT SIZE (2)			*/\
    0x05, 0x01,		/*  USAGE PAGE (Generic Desktop)	*/\
    0x09, 0x32,		/*  USAGE (Z)				*/\
    0x09, 0x35,		/*  USAGE (Rz)				*/\
    0x81, 0x02,		/*  INPUT (Data, Variable, Absolute)	*/\
    /* Sticks */\
    0x75, 0x10,		/*  REPORT SIZE (16)			*/\
    0x16, 0x00, 0x80,	/*  LOGICAL MINIMUM (-32768)		*/\
    0x26, 0xff, 0x7f,	/*  LOGICAL MAXIMUM (32767)		*/\
    0x36, 0x00, 0x80,	/*  PHYSICAL MINIMUM (-32768)		*/\
    0x46, 0xff, 0x7f,	/*  PHYSICAL MAXIMUM (32767)		*/\
    0x95, 0x04,		/*  REPORT COUNT (4)			*/\
    0x05, 0x01,		/*  USAGE PAGE (Generic Desktop)	*/\
    0x09, 0x30,		/*  USAGE (X)				*/\
    0x09, 0x31,		/*  USAGE (Y)				*/\
    0x09, 0x33,		/*  USAGE (Rx)				*/\
    0x09, 0x34,		/*  USAGE (Ry)				*/\
    0x81, 0x02,		/*  INPUT (Data, Variable, Absolute)	*/\
    /* Unused */\
    0x75, 0x30,		/*  REPORT SIZE (48)			*/\
    0x95, 0x01,		/*  REPORT COUNT (1)			*/\
    0x81, 0x01,		/*  INPUT (Constant)			*/\
    0xc0		/* END COLLECTION			*/\