1/* $NetBSD: x1input_rdesc.h,v 1.2 2016/04/23 10:15:32 skrll Exp $ */
2
3/*-
4 * Copyright (C) 2014 Loic Nageleisen
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * Neither the name of the copyright holders nor the
15 * names of its contributors may be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#define USBIF_IS_X1INPUT(uiaa) \
31 ((uiaa)->uiaa_class == UICLASS_VENDOR && \
32 (uiaa)->uiaa_subclass == 0x47 && \
33 (uiaa)->uiaa_proto == 0xd0)
34
35static const uByte uhid_x1input_report_descr[] = {
36 0x05, 0x01, // Usage Page (Generic Desktop)
37 0x09, 0x05, // Usage (Game Pad)
38 0xa1, 0x01, // Collection (Application)
39
40 // # button packet
41 0xa1, 0x00, // Collection (Physical)
42 0x85, 0x20, // Report ID (0x20)
43
44 // # skip unknown field and counter
45 0x05, 0x01, // Usage Page (Generic Desktop)
46 0x09, 0x00, // Usage (Undefined)
47 0x75, 0x08, // Report Size (8)
48 0x95, 0x02, // Report Count (2)
49 0x81, 0x03, // Input (Constant, Variable, Absolute)
50
51 // payload size
52 0x05, 0x01, // Usage Page (Generic Desktop)
53 0x09, 0x3b, // Usage (Byte Count)
54 0x75, 0x08, // Report Size (8)
55 0x95, 0x01, // Report Count (1)
56 0x81, 0x02, // Input (Data, Variable, Absolute)
57
58 // # 16 buttons
59 0x05, 0x09, // Usage Page (Button)
60 0x19, 0x01, // Usage Minimum (Button 1)
61 0x29, 0x10, // Usage Maximum (Button 16)
62 0x15, 0x00, // Logical Minimum (0)
63 0x25, 0x01, // Logical Maximum (1)
64 0x75, 0x01, // Report Size (1)
65 0x95, 0x10, // Report Count (16)
66 0x81, 0x02, // Input (Data, Variable, Absolute)
67
68 // # triggers
69 0x15, 0x00, // Logical Minimum (0)
70 0x26, 0xff, 0x03, // Logical Maximum (1023)
71 0x35, 0x00, // Physical Minimum (0)
72 0x46, 0xff, 0x03, // Physical Maximum (1023)
73 0x75, 0x10, // Report Size (16)
74 0x95, 0x02, // Report Count (2)
75 0x05, 0x01, // Usage Page (Generic Desktop)
76 0x09, 0x33, // Usage (Rx)
77 0x09, 0x34, // Usage (Ry)
78 0x81, 0x02, // Input (Data, Variable, Absolute)
79
80 // # sticks
81 0x75, 0x10, // Report Size (16)
82 0x16, 0x00, 0x80, // Logical Minimum (-32768)
83 0x26, 0xff, 0x7f, // Logical Maximum (32767)
84 0x36, 0x00, 0x80, // Physical Minimum (-32768)
85 0x46, 0xff, 0x7f, // Physical Maximum (32767)
86 0x05, 0x01, // Usage Page (Generic Desktop)
87 0x09, 0x01, // Usage (Pointer)
88 0xa1, 0x00, // Collection (Physical)
89 0x95, 0x02, // Report Count (2)
90 0x05, 0x01, // Usage Page (Generic Desktop)
91 0x09, 0x30, // Usage (X)
92 0x09, 0x31, // Usage (Y)
93 0x81, 0x02, // Input (Data, Variable, Absolute)
94 0xc0, // End Collection
95 0x05, 0x01, // Usage Page (Generic Desktop)
96 0x09, 0x01, // Usage (Pointer)
97 0xa1, 0x00, // Collection (Physical)
98 0x95, 0x02, // Report Count (2)
99 0x05, 0x01, // Usage Page (Generic Desktop)
100 0x09, 0x32, // Usage (Z)
101 0x09, 0x35, // Usage (Rz)
102 0x81, 0x02, // Input (Data, Variable, Absolute)
103 0xc0, // End Collection
104 0xc0, // End Collection
105};
106