1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include "TestHidDescriptor.h"
17 #include "TestHidSensorSpec.h"
18 #include <cstring>
19 
20 /**
21  * Example HID sensor descriptors in this file is extracted from published document
22  * "HID Sensors Usage" (hid-sensors-usage.docx). They are added for testing of HidParser.
23  *
24  * It is slightly modified in order to compile.
25  */
26 namespace {
27 /**
28  * Two sensors collection skeleton example.
29  */
30 const unsigned char col1_report_descriptor[] = {
31     HID_USAGE_PAGE_SENSOR,
32     HID_USAGE_SENSOR_TYPE_COLLECTION,
33     HID_COLLECTION(Application),
34 
35     HID_REPORT_ID(1),
36     HID_USAGE_PAGE_SENSOR,
37 
38     HID_USAGE_SENSOR_TYPE_MOTION_ACCELEROMETER_3D,
39     HID_COLLECTION(Physical),
40 
41     //Feature Report Descriptor for Sensor Report ID = 1
42 
43     //Input Report Descriptor for Sensor Report ID = 1
44 
45     HID_END_COLLECTION, //for Report ID = 1
46 
47     HID_REPORT_ID(2),
48     HID_USAGE_PAGE_SENSOR,
49     HID_USAGE_SENSOR_TYPE_MOTION_GYROMETER_3D,
50     HID_COLLECTION(Physical),
51 
52     //Feature Report Descriptor for Sensor Report ID = 2
53 
54     //Input Report Descriptor for Sensor Report ID = 2
55 
56     HID_END_COLLECTION, //for Report ID = 2
57 
58     //More sensors follow using the same pattern
59 
60     HID_END_COLLECTION //Application
61 };
62 
63 
64 /**
65  * Composite device descriptor example: two sensors with a keyboard and a mouse.
66  */
67 const unsigned char col2_report_descriptor[] = {
68     //keyboard
69     0x05U, 0x01U,         // USAGE PAGE (Generic Desktop)
70     0x09U, 0x06U,         // USAGE (Keyboard)
71     0xA1U, 0x01U,         // COLLECTION (Application)
72 
73     0x85U, 0x03U,         // REPORT_ID (1)
74 
75     0x15U, 0x00U,         //   LOGICAL MINIMUM (0)
76     0x25U, 0x01U,         //   LOGICAL MAXIMUM (1)
77     0x75U, 0x01U,         //   REPORT SIZE (1)
78     0x95U, 0x08U,         //   REPORT COUNT (8)
79     0x05U, 0x07U,         //   USAGE PAGE (Keyboard)
80     0x19U, 0xE0U,         //   USAGE MINIMUM (Keyboard LeftControl)
81     0x29U, 0xE7U,         //   USAGE MAXIMUM (Keyboard Right GUI)
82     0x81U, 0x02U,         //   INPUT (Var)
83 
84     0x75U, 0x08U,         //   REPORT SIZE (8)
85     0x95U, 0x0AU,         //   REPORT COUNT (10)
86     0x19U, 0x00U,         //   USAGE MINIMUM (No event)
87     0x29U, 0x91U,         //   USAGE MAXIMUM (Keyboard LANG2)
88     0x26U, 0xFFU, 0x00U,  //   LOGICAL MAXIMUM (0xFF)
89     0x81U, 0x00U,         //   INPUT (Data,Ary,Abs)
90 
91     0xC0U,                // END COLLECTION, //keyboard
92 
93     // Two sensor collection skeleton example:
94     HID_USAGE_PAGE_SENSOR,
95     HID_USAGE_SENSOR_TYPE_COLLECTION,
96     HID_COLLECTION(Application),
97 
98     HID_REPORT_ID(2),
99     HID_USAGE_PAGE_SENSOR,
100 
101     HID_USAGE_SENSOR_TYPE_MOTION_ACCELEROMETER_3D,
102     HID_COLLECTION(Physical),
103 
104     //Feature Report Descriptor for Sensor Report ID = 2
105 
106     //Input Report Descriptor for Sensor Report ID = 2
107 
108     HID_END_COLLECTION, //for Report ID = 2
109 
110     HID_REPORT_ID(3),
111     HID_USAGE_PAGE_SENSOR,
112     HID_USAGE_SENSOR_TYPE_MOTION_GYROMETER_3D,
113     HID_COLLECTION(Physical),
114 
115     //Feature Report Descriptor for Sensor Report ID = 3
116 
117     //Input Report Descriptor for Sensor Report ID = 3
118 
119     HID_END_COLLECTION, //for Report ID = 3
120 
121     //More sensors follow using the same pattern
122 
123     HID_END_COLLECTION, //Sensor collection
124 
125     //mouse
126     0x05U, 0x01U,         // USAGE PAGE (Generic Desktop)
127     0x09U, 0x02U,         // USAGE (Mouse)
128     0xA1U, 0x01U,         // COLLECTION (Application)
129     0x85U, 0x04U,         // REPORT_ID (4)
130 
131     // 5 mouse buttons
132     0x05U, 0x09U,         //   USAGE PAGE (Button)
133     0x19U, 0x01U,         //   USAGE MINIMUM (Button 1)
134     0x29U, 0x05U,         //   USAGE MAXIMUM (Button 5)
135     0x15U, 0x00U,         //   LOGICAL MINIMUM (0)
136     0x25U, 0x01U,         //   LOGICAL MAXIMUM (1)
137     0x95U, 0x05U,         //   REPORT COUNT (5)
138     0x75U, 0x01U,         //   REPORT SIZE (1)
139     0x81U, 0x02U,         //   INPUT (Data,Var,Abs)
140 
141     //  3 unused buttons:
142     0x95U, 0x01U,         //   REPORT COUNT (1)
143     0x75U, 0x03U,         //   REPORT SIZE (3)
144     0x81U, 0x03U,         //   INPUT (Cnst,Var,Abs)
145 
146     // mouse (delta x, delta y) position
147     0x15U, 0x81U,         //   LOGICAL MINIMUM (-127)
148     0x25U, 0x7fU,         //   LOGICAL MAXIMUM (+127)
149     0x75U, 0x08U,         //   REPORT SIZE (8)
150     0x95U, 0x02U,         //   REPORT COUNT (2)
151     0x05U, 0x01U,         //   USAGE PAGE (Generic Desktop)
152     0x09U, 0x30U,         //   USAGE(X)
153     0x09U, 0x31U,         //   USAGE (Y)
154     0x81U, 0x06U,         //   INPUT (Data,Var,Rel)
155 
156     0xC0U,                // END COLLECTION //mouse
157 };
158 
159 
160 /**
161  * Composite device descriptor example: one sensor with a keyboard and a mouse.
162  */
163 const unsigned char col3_report_descriptor[] = {
164     //keyboard
165     0x05U, 0x01U,         // USAGE PAGE (Generic Desktop)
166     0x09U, 0x06U,         // USAGE (Keyboard)
167     0xA1U, 0x01U,         // COLLECTION (Application)
168 
169     0x85U, 0x03U,         // REPORT_ID (1)
170 
171     0x15U, 0x00U,         //   LOGICAL MINIMUM (0)
172     0x25U, 0x01U,         //   LOGICAL MAXIMUM (1)
173     0x75U, 0x01U,         //   REPORT SIZE (1)
174     0x95U, 0x08U,         //   REPORT COUNT (8)
175     0x05U, 0x07U,         //   USAGE PAGE (Keyboard)
176     0x19U, 0xE0U,         //   USAGE MINIMUM (Keyboard LeftControl)
177     0x29U, 0xE7U,         //   USAGE MAXIMUM (Keyboard Right GUI)
178     0x81U, 0x02U,         //   INPUT (Var)
179 
180     0x75U, 0x08U,         //   REPORT SIZE (8)
181     0x95U, 0x0AU,         //   REPORT COUNT (10)
182     0x19U, 0x00U,         //   USAGE MINIMUM (No event)
183     0x29U, 0x91U,         //   USAGE MAXIMUM (Keyboard LANG2)
184     0x26U, 0xFFU, 0x00U,  //   LOGICAL MAXIMUM (0xFF)
185     0x81U, 0x00U,         //   INPUT (Data,Ary,Abs)
186 
187     0xC0U,                // END COLLECTION, //keyboard
188 
189     // One sensor collection skeleton example:
190     HID_USAGE_PAGE_SENSOR,
191     HID_USAGE_SENSOR_TYPE_COLLECTION,
192     HID_COLLECTION(Application),
193 
194     HID_REPORT_ID(2),
195     HID_USAGE_PAGE_SENSOR,
196 
197     HID_USAGE_SENSOR_TYPE_MOTION_GYROMETER_3D,
198     HID_COLLECTION(Physical),
199 
200     //Feature Report Descriptor for Sensor Report ID = 2
201 
202     //Input Report Descriptor for Sensor Report ID = 2
203 
204     HID_END_COLLECTION, //for Report ID = 2
205 
206     HID_END_COLLECTION, //Sensor collection
207 
208     //mouse
209     0x05U, 0x01U,         // USAGE PAGE (Generic Desktop)
210     0x09U, 0x02U,         // USAGE (Mouse)
211     0xA1U, 0x01U,         // COLLECTION (Application)
212     0x85U, 0x04U,         // REPORT_ID (3)
213 
214     // 5 mouse buttons
215     0x05U, 0x09U,         //   USAGE PAGE (Button)
216     0x19U, 0x01U,         //   USAGE MINIMUM (Button 1)
217     0x29U, 0x05U,         //   USAGE MAXIMUM (Button 5)
218     0x15U, 0x00U,         //   LOGICAL MINIMUM (0)
219     0x25U, 0x01U,         //   LOGICAL MAXIMUM (1)
220     0x95U, 0x05U,         //   REPORT COUNT (5)
221     0x75U, 0x01U,         //   REPORT SIZE (1)
222     0x81U, 0x02U,         //   INPUT (Data,Var,Abs)
223 
224     //  3 unused buttons:
225     0x95U, 0x01U,         //   REPORT COUNT (1)
226     0x75U, 0x03U,         //   REPORT SIZE (3)
227     0x81U, 0x03U,         //   INPUT (Cnst,Var,Abs)
228 
229     // mouse (delta x, delta y) position
230     0x15U, 0x81U,         //   LOGICAL MINIMUM (-127)
231     0x25U, 0x7fU,         //   LOGICAL MAXIMUM (+127)
232     0x75U, 0x08U,         //   REPORT SIZE (8)
233     0x95U, 0x02U,         //   REPORT COUNT (2)
234     0x05U, 0x01U,         //   USAGE PAGE (Generic Desktop)
235     0x09U, 0x30U,         //   USAGE(X)
236     0x09U, 0x31U,         //   USAGE (Y)
237     0x81U, 0x06U,         //   INPUT (Data,Var,Rel)
238 
239     0xC0U,                 //   END COLLECTION //mouse
240 };
241 
242 
243 /**
244  * Simple custom sensor example.
245  */
246 const unsigned char cus1_report_descriptor[] = {
247     HID_USAGE_PAGE_SENSOR,         // USAGE_PAGE (Sensor)
248     HID_USAGE_SENSOR_TYPE_OTHER_CUSTOM, // USAGE (Simple Custom)
249     HID_COLLECTION(Physical),
250 
251     //input reports (transmit)
252     HID_USAGE_PAGE_SENSOR,
253     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_1,
254     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
255     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
256     HID_REPORT_SIZE(16),
257     HID_REPORT_COUNT(1),
258     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
259     HID_INPUT(Data_Var_Abs), // = HID_USAGE_SENSOR_DATA_MOTION_SPEED value
260 
261     HID_END_COLLECTION
262 };
263 
264 
265 /**
266  * More complex custom sensor example.
267  */
268 const unsigned char cus2_report_descriptor[] = {
269     HID_USAGE_PAGE_SENSOR,         // USAGE_PAGE (Sensor)
270     HID_USAGE_SENSOR_TYPE_OTHER_CUSTOM, // USAGE (Simple Custom)
271     HID_COLLECTION(Physical),
272 
273     //input reports (transmit)
274     HID_USAGE_PAGE_SENSOR,
275     HID_USAGE_SENSOR_DATA_CUSTOM_USAGE,
276     HID_LOGICAL_MIN_8(0),
277     HID_LOGICAL_MAX_16(0xFF,0xFF),
278     HID_REPORT_SIZE(16),
279     HID_REPORT_COUNT(1),
280     HID_INPUT(Data_Var_Abs), // = HID_USAGE_SENSOR_TYPE_MOTION_SPEEDOMETER
281     HID_USAGE_SENSOR_DATA_CUSTOM_BOOLEAN_ARRAY,
282     HID_LOGICAL_MIN_8(0),
283     HID_LOGICAL_MAX_16(0xFF,0xFF),
284     HID_REPORT_SIZE(16),
285     HID_REPORT_COUNT(1),
286     HID_INPUT(Data_Var_Abs), // = HID_USAGE_SENSOR_TYPE_MOTION_SPEEDOMETER
287     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_1,
288     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
289     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
290     HID_REPORT_SIZE(16),
291     HID_REPORT_COUNT(1),
292     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
293     HID_INPUT(Data_Var_Abs), // = HID_USAGE_SENSOR_DATA_MOTION_SPEED value
294     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_2,
295     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
296     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
297     HID_REPORT_SIZE(16),
298     HID_REPORT_COUNT(1),
299     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
300     HID_INPUT(Data_Var_Abs), // = HID_USAGE_SENSOR_DATA_MOTION_SPEED value
301     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_3,
302     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
303     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
304     HID_REPORT_SIZE(16),
305     HID_REPORT_COUNT(1),
306     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
307     HID_INPUT(Data_Var_Abs), // = HID_USAGE_SENSOR_DATA_MOTION_SPEED value
308     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_4,
309     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
310     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
311     HID_REPORT_SIZE(16),
312     HID_REPORT_COUNT(1),
313     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
314     HID_INPUT(Data_Var_Abs), // = HID_USAGE_SENSOR_DATA_MOTION_SPEED value
315     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_5,
316     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
317     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
318     HID_REPORT_SIZE(16),
319     HID_REPORT_COUNT(1),
320     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
321     HID_INPUT(Data_Var_Abs), // = HID_USAGE_SENSOR_DATA_MOTION_SPEED value
322     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_6,
323     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
324     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
325     HID_REPORT_SIZE(16),
326     HID_REPORT_COUNT(1),
327     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
328     HID_INPUT(Data_Var_Abs), // = HID_USAGE_SENSOR_DATA_MOTION_SPEED value
329 
330     HID_END_COLLECTION
331 };
332 
333 
334 /**
335  * Custom sensor example with features
336  */
337 const unsigned char cus3_report_descriptor[] = {
338     HID_USAGE_PAGE_SENSOR,         // USAGE_PAGE (Sensor)
339     HID_USAGE_SENSOR_TYPE_OTHER_CUSTOM, // USAGE (Simple Custom)
340     HID_COLLECTION(Physical),
341 
342     //feature reports (xmit/receive)
343     HID_USAGE_PAGE_SENSOR,
344     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
345     HID_LOGICAL_MIN_8(0),
346     HID_LOGICAL_MAX_8(2),
347     HID_REPORT_SIZE(8),
348     HID_REPORT_COUNT(1),
349     HID_COLLECTION(Logical),
350     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
351     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
352     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
353     HID_FEATURE(Data_Arr_Abs),
354     HID_END_COLLECTION,
355     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
356     HID_LOGICAL_MIN_8(0),
357     HID_LOGICAL_MAX_8(5),
358     HID_REPORT_SIZE(8),
359     HID_REPORT_COUNT(1),
360     HID_COLLECTION(Logical),
361     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
362     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
363     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
364     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
365     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
366     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
367     HID_FEATURE(Data_Arr_Abs),
368     HID_END_COLLECTION,
369     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
370     HID_LOGICAL_MIN_8(0),
371     HID_LOGICAL_MAX_8(5),
372     HID_REPORT_SIZE(8),
373     HID_REPORT_COUNT(1),
374     HID_COLLECTION(Logical),
375     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
376     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
377     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
378     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
379     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
380     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
381     HID_FEATURE(Data_Arr_Abs),
382     HID_END_COLLECTION,
383     HID_USAGE_SENSOR_STATE,
384     HID_LOGICAL_MIN_8(0),
385     HID_LOGICAL_MAX_8(6),
386     HID_REPORT_SIZE(8),
387     HID_REPORT_COUNT(1),
388     HID_COLLECTION(Logical),
389     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
390     HID_USAGE_SENSOR_STATE_READY_SEL,
391     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
392     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
393     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
394     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
395     HID_USAGE_SENSOR_STATE_ERROR_SEL,
396     HID_FEATURE(Data_Arr_Abs),
397     HID_END_COLLECTION,
398     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
399     HID_LOGICAL_MIN_8(0),
400     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
401     HID_REPORT_SIZE(32),
402     HID_REPORT_COUNT(1),
403     HID_UNIT_EXPONENT(0),
404     HID_FEATURE(Data_Var_Abs),
405     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM,
406                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
407     HID_LOGICAL_MIN_8(0),
408     HID_LOGICAL_MAX_16(0xFF,0xFF),
409     HID_REPORT_SIZE(16),
410     HID_REPORT_COUNT(1),
411     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
412     HID_FEATURE(Data_Var_Abs),
413     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM,HID_USAGE_SENSOR_DATA_MOD_MAX),
414     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
415     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
416     HID_REPORT_SIZE(16),
417     HID_REPORT_COUNT(1),
418     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
419     HID_FEATURE(Data_Var_Abs),
420     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM,HID_USAGE_SENSOR_DATA_MOD_MIN),
421     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
422     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
423     HID_REPORT_SIZE(16),
424     HID_REPORT_COUNT(1),
425     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
426     HID_FEATURE(Data_Var_Abs),
427 
428     //input reports (transmit)
429     HID_USAGE_PAGE_SENSOR,
430     HID_USAGE_SENSOR_STATE,
431     HID_LOGICAL_MIN_8(0),
432     HID_LOGICAL_MAX_8(6),
433     HID_REPORT_SIZE(8),
434     HID_REPORT_COUNT(1),
435     HID_COLLECTION(Logical),
436     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
437     HID_USAGE_SENSOR_STATE_READY_SEL,
438     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
439     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
440     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
441     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
442     HID_USAGE_SENSOR_STATE_ERROR_SEL,
443     HID_INPUT(Data_Arr_Abs),
444     HID_END_COLLECTION,
445     HID_USAGE_SENSOR_EVENT,
446     HID_LOGICAL_MIN_8(0),
447     HID_LOGICAL_MAX_8(5),
448     HID_REPORT_SIZE(8),
449     HID_REPORT_COUNT(1),
450     HID_COLLECTION(Logical),
451     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
452     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
453     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
454     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
455     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
456     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
457     HID_INPUT(Data_Arr_Abs),
458     HID_END_COLLECTION,
459     HID_USAGE_SENSOR_DATA_CUSTOM_USAGE,
460     HID_LOGICAL_MIN_8(0),
461     HID_LOGICAL_MAX_16(0xFF,0xFF),
462     HID_REPORT_SIZE(16),
463     HID_REPORT_COUNT(1),
464     HID_INPUT(Data_Var_Abs), // = HID_USAGE_SENSOR_TYPE_MOTION_SPEEDOMETER
465     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_1,
466     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
467     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
468     HID_REPORT_SIZE(16),
469     HID_REPORT_COUNT(1),
470     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
471     HID_INPUT(Data_Var_Abs), // = HID_USAGE_SENSOR_DATA_MOTION_SPEED value
472 
473     HID_END_COLLECTION
474 };
475 
476 
477 /**
478  * Full custom sensor example with feature.
479  */
480 const unsigned char cus4_report_descriptor[] = {
481     HID_USAGE_PAGE_SENSOR,         // USAGE_PAGE (Sensor)
482     HID_USAGE_SENSOR_TYPE_OTHER_CUSTOM, // USAGE (Simple Custom)
483     HID_COLLECTION(Application),
484 
485     //feature reports (xmit/receive)
486     HID_USAGE_PAGE_SENSOR,
487     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
488     HID_LOGICAL_MIN_8(0),
489     HID_LOGICAL_MAX_8(2),
490     HID_REPORT_SIZE(8),
491     HID_REPORT_COUNT(1),
492     HID_COLLECTION(Logical),
493     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
494     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
495     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
496     HID_FEATURE(Data_Arr_Abs),
497     HID_END_COLLECTION,
498     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
499     HID_LOGICAL_MIN_8(0),
500     HID_LOGICAL_MAX_8(5),
501     HID_REPORT_SIZE(8),
502     HID_REPORT_COUNT(1),
503     HID_COLLECTION(Logical),
504     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
505     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
506     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
507     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
508     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
509     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
510     HID_FEATURE(Data_Arr_Abs),
511     HID_END_COLLECTION,
512     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
513     HID_LOGICAL_MIN_8(0),
514     HID_LOGICAL_MAX_8(5),
515     HID_REPORT_SIZE(8),
516     HID_REPORT_COUNT(1),
517     HID_COLLECTION(Logical),
518     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
519     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
520     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
521     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
522     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
523     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
524     HID_FEATURE(Data_Arr_Abs),
525     HID_END_COLLECTION,
526     HID_USAGE_SENSOR_STATE,
527     HID_LOGICAL_MIN_8(0),
528     HID_LOGICAL_MAX_8(6),
529     HID_REPORT_SIZE(8),
530     HID_REPORT_COUNT(1),
531     HID_COLLECTION(Logical),
532     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
533     HID_USAGE_SENSOR_STATE_READY_SEL,
534     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
535     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
536     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
537     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
538     HID_USAGE_SENSOR_STATE_ERROR_SEL,
539     HID_FEATURE(Data_Arr_Abs),
540     HID_END_COLLECTION,
541     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
542     HID_LOGICAL_MIN_8(0),
543     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
544     HID_REPORT_SIZE(32),
545     HID_REPORT_COUNT(1),
546     HID_UNIT_EXPONENT(0),
547     HID_FEATURE(Data_Var_Abs),
548     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM,
549                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
550     HID_LOGICAL_MIN_8(0),
551     HID_LOGICAL_MAX_16(0xFF,0xFF),
552     HID_REPORT_SIZE(16),
553     HID_REPORT_COUNT(1),
554     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
555     HID_FEATURE(Data_Var_Abs),
556     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM,HID_USAGE_SENSOR_DATA_MOD_MAX),
557     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
558     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
559     HID_REPORT_SIZE(16),
560     HID_REPORT_COUNT(1),
561     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
562     HID_FEATURE(Data_Var_Abs),
563     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_CUSTOM,HID_USAGE_SENSOR_DATA_MOD_MIN),
564     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
565     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
566     HID_REPORT_SIZE(16),
567     HID_REPORT_COUNT(1),
568     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
569     HID_FEATURE(Data_Var_Abs),
570 
571     //input reports (transmit)
572     HID_USAGE_PAGE_SENSOR,
573     HID_USAGE_SENSOR_STATE,
574     HID_LOGICAL_MIN_8(0),
575     HID_LOGICAL_MAX_8(6),
576     HID_REPORT_SIZE(8),
577     HID_REPORT_COUNT(1),
578     HID_COLLECTION(Logical),
579     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
580     HID_USAGE_SENSOR_STATE_READY_SEL,
581     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
582     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
583     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
584     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
585     HID_USAGE_SENSOR_STATE_ERROR_SEL,
586     HID_INPUT(Data_Arr_Abs),
587     HID_END_COLLECTION,
588     HID_USAGE_SENSOR_EVENT,
589     HID_LOGICAL_MIN_8(0),
590     HID_LOGICAL_MAX_8(5),
591     HID_REPORT_SIZE(8),
592     HID_REPORT_COUNT(1),
593     HID_COLLECTION(Logical),
594     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
595     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
596     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
597     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
598     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
599     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
600     HID_INPUT(Data_Arr_Abs),
601     HID_END_COLLECTION,
602     HID_USAGE_SENSOR_DATA_CUSTOM_USAGE,
603     HID_LOGICAL_MIN_8(0),
604     HID_LOGICAL_MAX_16(0xFF,0xFF),
605     HID_REPORT_SIZE(16),
606     HID_REPORT_COUNT(1),
607     HID_INPUT(Data_Var_Abs),
608     HID_USAGE_SENSOR_DATA_CUSTOM_BOOLEAN_ARRAY,
609     HID_LOGICAL_MIN_8(0),
610     HID_LOGICAL_MAX_16(0xFF,0xFF),
611     HID_REPORT_SIZE(16),
612     HID_REPORT_COUNT(1),
613     HID_INPUT(Data_Var_Abs),
614     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_1,
615     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
616     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
617     HID_REPORT_SIZE(16),
618     HID_REPORT_COUNT(1),
619     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
620     HID_INPUT(Data_Var_Abs),
621     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_2,
622     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
623     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
624     HID_REPORT_SIZE(16),
625     HID_REPORT_COUNT(1),
626     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
627     HID_INPUT(Data_Var_Abs),
628     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_3,
629     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
630     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
631     HID_REPORT_SIZE(16),
632     HID_REPORT_COUNT(1),
633     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
634     HID_INPUT(Data_Var_Abs),
635     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_4,
636     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
637     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
638     HID_REPORT_SIZE(16),
639     HID_REPORT_COUNT(1),
640     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
641     HID_INPUT(Data_Var_Abs),
642     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_5,
643     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
644     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
645     HID_REPORT_SIZE(16),
646     HID_REPORT_COUNT(1),
647     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
648     HID_INPUT(Data_Var_Abs),
649     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_6,
650     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
651     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
652     HID_REPORT_SIZE(16),
653     HID_REPORT_COUNT(1),
654     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
655     HID_INPUT(Data_Var_Abs),
656 
657 #if 1 //define vendor-specific (non-spec) custom datafields
658     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_7,
659     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
660     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
661     HID_REPORT_SIZE(16),
662     HID_REPORT_COUNT(1),
663     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
664     HID_INPUT(Data_Var_Abs),
665     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_8,
666     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
667     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
668     HID_REPORT_SIZE(16),
669     HID_REPORT_COUNT(1),
670     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
671     HID_INPUT(Data_Var_Abs),
672     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_9,
673     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
674     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
675     HID_REPORT_SIZE(16),
676     HID_REPORT_COUNT(1),
677     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
678     HID_INPUT(Data_Var_Abs),
679     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_10,
680     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
681     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
682     HID_REPORT_SIZE(16),
683     HID_REPORT_COUNT(1),
684     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
685     HID_INPUT(Data_Var_Abs),
686     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_11,
687     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
688     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
689     HID_REPORT_SIZE(16),
690     HID_REPORT_COUNT(1),
691     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
692     HID_INPUT(Data_Var_Abs),
693     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_12,
694     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
695     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
696     HID_REPORT_SIZE(16),
697     HID_REPORT_COUNT(1),
698     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
699     HID_INPUT(Data_Var_Abs),
700     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_13,
701     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
702     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
703     HID_REPORT_SIZE(16),
704     HID_REPORT_COUNT(1),
705     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
706     HID_INPUT(Data_Var_Abs),
707     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_14,
708     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
709     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
710     HID_REPORT_SIZE(16),
711     HID_REPORT_COUNT(1),
712     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
713     HID_INPUT(Data_Var_Abs),
714     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_15,
715     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
716     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
717     HID_REPORT_SIZE(16),
718     HID_REPORT_COUNT(1),
719     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
720     HID_INPUT(Data_Var_Abs),
721     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_16,
722     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
723     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
724     HID_REPORT_SIZE(16),
725     HID_REPORT_COUNT(1),
726     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
727     HID_INPUT(Data_Var_Abs),
728     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_17,
729     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
730     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
731     HID_REPORT_SIZE(16),
732     HID_REPORT_COUNT(1),
733     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
734     HID_INPUT(Data_Var_Abs),
735     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_18,
736     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
737     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
738     HID_REPORT_SIZE(16),
739     HID_REPORT_COUNT(1),
740     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
741     HID_INPUT(Data_Var_Abs),
742     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_19,
743     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
744     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
745     HID_REPORT_SIZE(16),
746     HID_REPORT_COUNT(1),
747     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
748     HID_INPUT(Data_Var_Abs),
749     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_20,
750     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
751     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
752     HID_REPORT_SIZE(16),
753     HID_REPORT_COUNT(1),
754     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
755     HID_INPUT(Data_Var_Abs),
756     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_21,
757     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
758     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
759     HID_REPORT_SIZE(16),
760     HID_REPORT_COUNT(1),
761     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
762     HID_INPUT(Data_Var_Abs),
763     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_22,
764     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
765     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
766     HID_REPORT_SIZE(16),
767     HID_REPORT_COUNT(1),
768     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
769     HID_INPUT(Data_Var_Abs),
770     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_23,
771     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
772     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
773     HID_REPORT_SIZE(16),
774     HID_REPORT_COUNT(1),
775     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
776     HID_INPUT(Data_Var_Abs),
777     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_24,
778     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
779     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
780     HID_REPORT_SIZE(16),
781     HID_REPORT_COUNT(1),
782     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
783     HID_INPUT(Data_Var_Abs),
784     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_25,
785     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
786     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
787     HID_REPORT_SIZE(16),
788     HID_REPORT_COUNT(1),
789     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
790     HID_INPUT(Data_Var_Abs),
791     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_26,
792     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
793     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
794     HID_REPORT_SIZE(16),
795     HID_REPORT_COUNT(1),
796     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
797     HID_INPUT(Data_Var_Abs),
798     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_27,
799     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
800     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
801     HID_REPORT_SIZE(16),
802     HID_REPORT_COUNT(1),
803     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
804     HID_INPUT(Data_Var_Abs),
805     HID_USAGE_SENSOR_DATA_CUSTOM_VALUE_28,
806     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
807     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
808     HID_REPORT_SIZE(16),
809     HID_REPORT_COUNT(1),
810     HID_UNIT_EXPONENT(0x0E), // scale unit to provide 2 digits past the decimal point
811     HID_INPUT(Data_Var_Abs),
812 #endif
813     HID_END_COLLECTION
814 };
815 
816 
817 /**
818  * Human presence sensor example.
819  */
820 const unsigned char pres_report_descriptor[] = {
821     HID_USAGE_PAGE_SENSOR,
822     HID_USAGE_SENSOR_TYPE_BIOMETRIC_PRESENCE,
823     HID_COLLECTION(Physical),
824 
825     //feature reports (xmit/receive)
826     HID_USAGE_PAGE_SENSOR,
827     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
828     HID_LOGICAL_MIN_8(0),
829     HID_LOGICAL_MAX_8(2),
830     HID_REPORT_SIZE(8),
831     HID_REPORT_COUNT(1),
832     HID_COLLECTION(Logical),
833     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
834     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
835     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
836     HID_FEATURE(Data_Arr_Abs),
837     HID_END_COLLECTION,
838     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
839     HID_LOGICAL_MIN_8(0),
840     HID_LOGICAL_MAX_8(5),
841     HID_REPORT_SIZE(8),
842     HID_REPORT_COUNT(1),
843     HID_COLLECTION(Logical),
844     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
845     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
846     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
847     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
848     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
849     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
850     HID_FEATURE(Data_Arr_Abs),
851     HID_END_COLLECTION,
852     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
853     HID_LOGICAL_MIN_8(0),
854     HID_LOGICAL_MAX_8(5),
855     HID_REPORT_SIZE(8),
856     HID_REPORT_COUNT(1),
857     HID_COLLECTION(Logical),
858     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
859     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
860     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
861     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
862     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
863     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
864     HID_FEATURE(Data_Arr_Abs),
865     HID_END_COLLECTION,
866     HID_USAGE_SENSOR_STATE,
867     HID_LOGICAL_MIN_8(0),
868     HID_LOGICAL_MAX_8(6),
869     HID_REPORT_SIZE(8),
870     HID_REPORT_COUNT(1),
871     HID_COLLECTION(Logical),
872     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
873     HID_USAGE_SENSOR_STATE_READY_SEL,
874     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
875     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
876     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
877     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
878     HID_USAGE_SENSOR_STATE_ERROR_SEL,
879     HID_FEATURE(Data_Arr_Abs),
880     HID_END_COLLECTION,
881     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
882     HID_LOGICAL_MIN_8(0),
883     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
884     HID_REPORT_SIZE(32),
885     HID_REPORT_COUNT(1),
886     HID_UNIT_EXPONENT(0),
887     HID_FEATURE(Data_Var_Abs),
888 
889     //input reports (transmit)
890     HID_USAGE_PAGE_SENSOR,
891     HID_USAGE_SENSOR_STATE,
892     HID_LOGICAL_MIN_8(0),
893     HID_LOGICAL_MAX_8(6),
894     HID_REPORT_SIZE(8),
895     HID_REPORT_COUNT(1),
896     HID_COLLECTION(Logical),
897     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
898     HID_USAGE_SENSOR_STATE_READY_SEL,
899     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
900     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
901     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
902     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
903     HID_USAGE_SENSOR_STATE_ERROR_SEL,
904     HID_INPUT(Data_Arr_Abs),
905     HID_END_COLLECTION,
906     HID_USAGE_SENSOR_EVENT,
907     HID_LOGICAL_MIN_8(0),
908     HID_LOGICAL_MAX_8(5),
909     HID_REPORT_SIZE(8),
910     HID_REPORT_COUNT(1),
911     HID_COLLECTION(Logical),
912     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
913     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
914     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
915     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
916     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
917     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
918     HID_INPUT(Data_Arr_Abs),
919     HID_END_COLLECTION,
920     HID_USAGE_SENSOR_DATA_BIOMETRIC_HUMAN_PRESENCE,
921     HID_LOGICAL_MIN_8(0), // False
922     HID_LOGICAL_MAX_8(1), // True
923     HID_REPORT_SIZE(8),
924     HID_REPORT_COUNT(1),
925     HID_INPUT(Data_Var_Abs),
926 
927     HID_END_COLLECTION
928 };
929 
930 
931 /**
932  * Proximity sensor example.
933  */
934 const unsigned char prox_report_descriptor[] = {
935     HID_USAGE_PAGE_SENSOR,
936     HID_USAGE_SENSOR_TYPE_BIOMETRIC_PROXIMITY,
937     HID_COLLECTION(Physical),
938 
939     //feature reports (xmit/receive)
940     HID_USAGE_PAGE_SENSOR,
941     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
942     HID_LOGICAL_MIN_8(0),
943     HID_LOGICAL_MAX_8(2),
944     HID_REPORT_SIZE(8),
945     HID_REPORT_COUNT(1),
946     HID_COLLECTION(Logical),
947     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
948     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
949     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
950     HID_FEATURE(Data_Arr_Abs),
951     HID_END_COLLECTION,
952     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
953     HID_LOGICAL_MIN_8(0),
954     HID_LOGICAL_MAX_8(5),
955     HID_REPORT_SIZE(8),
956     HID_REPORT_COUNT(1),
957     HID_COLLECTION(Logical),
958     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
959     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
960     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
961     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
962     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
963     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
964     HID_FEATURE(Data_Arr_Abs),
965     HID_END_COLLECTION,
966     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
967     HID_LOGICAL_MIN_8(0),
968     HID_LOGICAL_MAX_8(5),
969     HID_REPORT_SIZE(8),
970     HID_REPORT_COUNT(1),
971     HID_COLLECTION(Logical),
972     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
973     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
974     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
975     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
976     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
977     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
978     HID_FEATURE(Data_Arr_Abs),
979     HID_END_COLLECTION,
980     HID_USAGE_SENSOR_STATE,
981     HID_LOGICAL_MIN_8(0),
982     HID_LOGICAL_MAX_8(6),
983     HID_REPORT_SIZE(8),
984     HID_REPORT_COUNT(1),
985     HID_COLLECTION(Logical),
986     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
987     HID_USAGE_SENSOR_STATE_READY_SEL,
988     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
989     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
990     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
991     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
992     HID_USAGE_SENSOR_STATE_ERROR_SEL,
993     HID_FEATURE(Data_Arr_Abs),
994     HID_END_COLLECTION,
995     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
996     HID_LOGICAL_MIN_8(0),
997     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
998     HID_REPORT_SIZE(32),
999     HID_REPORT_COUNT(1),
1000     HID_UNIT_EXPONENT(0),
1001     HID_FEATURE(Data_Var_Abs),
1002     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_BIOMETRIC_HUMAN_PROXIMITY_RANGE,
1003                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
1004     HID_LOGICAL_MIN_8(0),
1005     HID_LOGICAL_MAX_16(0xFF,0xFF),
1006     HID_REPORT_SIZE(16),
1007     HID_REPORT_COUNT(1),
1008     HID_UNIT_EXPONENT(0x0D), // scale default unit "meter" to "centimeter"
1009     // to provide 2 digits past decimal point
1010     HID_FEATURE(Data_Var_Abs),
1011     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_BIOMETRIC_HUMAN_PROXIMITY_RANGE,
1012                           HID_USAGE_SENSOR_DATA_MOD_MAX),
1013     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1014     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1015     HID_REPORT_SIZE(16),
1016     HID_REPORT_COUNT(1),
1017     HID_UNIT_EXPONENT(0x0D), // scale default unit "meter" to "centimeter"
1018     // to provide 2 digits past decimal point
1019     HID_FEATURE(Data_Var_Abs),
1020     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_BIOMETRIC_HUMAN_PROXIMITY_RANGE,
1021                           HID_USAGE_SENSOR_DATA_MOD_MIN),
1022     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1023     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1024     HID_REPORT_SIZE(16),
1025     HID_REPORT_COUNT(1),
1026     HID_UNIT_EXPONENT(0x0D), // scale default unit "meter" to "centimeter"
1027     // to provide 2 digits past decimal point
1028     HID_FEATURE(Data_Var_Abs),
1029 
1030     //input reports (transmit)
1031     HID_USAGE_PAGE_SENSOR,
1032     HID_USAGE_SENSOR_STATE,
1033     HID_LOGICAL_MIN_8(0),
1034     HID_LOGICAL_MAX_8(6),
1035     HID_REPORT_SIZE(8),
1036     HID_REPORT_COUNT(1),
1037     HID_COLLECTION(Logical),
1038     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1039     HID_USAGE_SENSOR_STATE_READY_SEL,
1040     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1041     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1042     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1043     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1044     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1045     HID_INPUT(Data_Arr_Abs),
1046     HID_END_COLLECTION,
1047     HID_USAGE_SENSOR_EVENT,
1048     HID_LOGICAL_MIN_8(0),
1049     HID_LOGICAL_MAX_8(5),
1050     HID_REPORT_SIZE(8),
1051     HID_REPORT_COUNT(1),
1052     HID_COLLECTION(Logical),
1053     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
1054     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
1055     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
1056     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
1057     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
1058     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
1059     HID_INPUT(Data_Arr_Abs),
1060     HID_END_COLLECTION,
1061     HID_USAGE_SENSOR_DATA_BIOMETRIC_HUMAN_PROXIMITY_OUT_OF_RANGE,
1062     HID_LOGICAL_MIN_8(0), // False
1063     HID_LOGICAL_MAX_8(1), // True
1064     HID_REPORT_SIZE(8),
1065     HID_REPORT_COUNT(1),
1066     HID_INPUT(Data_Var_Abs),
1067     HID_USAGE_SENSOR_DATA_BIOMETRIC_HUMAN_PROXIMITY_RANGE,
1068     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1069     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1070     HID_REPORT_SIZE(16),
1071     HID_REPORT_COUNT(1),
1072     HID_UNIT_EXPONENT(0x0D),  // scale default unit "meter" to "centimeter"
1073     // to provide 2 digits past decimal point
1074     HID_INPUT(Data_Var_Abs),
1075 
1076     HID_END_COLLECTION
1077 };
1078 
1079 
1080 /**
1081  * Barometer sensor example.
1082  */
1083 const unsigned char bar_report_descriptor[] = {
1084     HID_USAGE_PAGE_SENSOR,
1085     HID_USAGE_SENSOR_TYPE_ENVIRONMENTAL_ATMOSPHERIC_PRESSURE,
1086     HID_COLLECTION(Physical),
1087 
1088     //feature reports (xmit/receive)
1089     HID_USAGE_PAGE_SENSOR,
1090     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
1091     HID_LOGICAL_MIN_8(0),
1092     HID_LOGICAL_MAX_8(2),
1093     HID_REPORT_SIZE(8),
1094     HID_REPORT_COUNT(1),
1095     HID_COLLECTION(Logical),
1096     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
1097     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
1098     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
1099     HID_FEATURE(Data_Arr_Abs),
1100     HID_END_COLLECTION,
1101     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
1102     HID_LOGICAL_MIN_8(0),
1103     HID_LOGICAL_MAX_8(5),
1104     HID_REPORT_SIZE(8),
1105     HID_REPORT_COUNT(1),
1106     HID_COLLECTION(Logical),
1107     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
1108     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
1109     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
1110     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
1111     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
1112     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
1113     HID_FEATURE(Data_Arr_Abs),
1114     HID_END_COLLECTION,
1115     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
1116     HID_LOGICAL_MIN_8(0),
1117     HID_LOGICAL_MAX_8(5),
1118     HID_REPORT_SIZE(8),
1119     HID_REPORT_COUNT(1),
1120     HID_COLLECTION(Logical),
1121     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
1122     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
1123     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
1124     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
1125     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
1126     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
1127     HID_FEATURE(Data_Arr_Abs),
1128     HID_END_COLLECTION,
1129     HID_USAGE_SENSOR_STATE,
1130     HID_LOGICAL_MIN_8(0),
1131     HID_LOGICAL_MAX_8(6),
1132     HID_REPORT_SIZE(8),
1133     HID_REPORT_COUNT(1),
1134     HID_COLLECTION(Logical),
1135     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1136     HID_USAGE_SENSOR_STATE_READY_SEL,
1137     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1138     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1139     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1140     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1141     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1142     HID_FEATURE(Data_Arr_Abs),
1143     HID_END_COLLECTION,
1144     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
1145     HID_LOGICAL_MIN_8(0),
1146     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
1147     HID_REPORT_SIZE(32),
1148     HID_REPORT_COUNT(1),
1149     HID_UNIT_EXPONENT(0),
1150     HID_FEATURE(Data_Var_Abs),
1151     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_ATMOSPHERIC_PRESSURE,
1152                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
1153     HID_LOGICAL_MIN_8(0),
1154     HID_LOGICAL_MAX_16(0xFF,0xFF),
1155     HID_REPORT_SIZE(16),
1156     HID_REPORT_COUNT(1),
1157     HID_UNIT_EXPONENT(0x0E), // scale default unit "Bar" to provide 2 digits past the decimal point
1158     HID_FEATURE(Data_Var_Abs),
1159     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_ATMOSPHERIC_PRESSURE,
1160                           HID_USAGE_SENSOR_DATA_MOD_MAX),
1161     HID_LOGICAL_MIN_8(0),
1162     HID_LOGICAL_MAX_16(0xFF,0xFF),
1163     HID_REPORT_SIZE(16),
1164     HID_REPORT_COUNT(1),
1165     HID_UNIT_EXPONENT(0x0E), // scale default unit "Bar" to provide 2 digits past the decimal point
1166     HID_FEATURE(Data_Var_Abs),
1167     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_ATMOSPHERIC_PRESSURE,
1168                           HID_USAGE_SENSOR_DATA_MOD_MIN),
1169     HID_LOGICAL_MIN_8(0),
1170     HID_LOGICAL_MAX_16(0xFF,0xFF),
1171     HID_REPORT_SIZE(16),
1172     HID_REPORT_COUNT(1),
1173     HID_UNIT_EXPONENT(0x0E), // scale default unit "Bar" to provide 2 digits past the decimal point
1174     HID_FEATURE(Data_Var_Abs),
1175 
1176     //input reports (transmit)
1177     HID_USAGE_PAGE_SENSOR,
1178     HID_USAGE_SENSOR_STATE,
1179     HID_LOGICAL_MIN_8(0),
1180     HID_LOGICAL_MAX_8(6),
1181     HID_REPORT_SIZE(8),
1182     HID_REPORT_COUNT(1),
1183     HID_COLLECTION(Logical),
1184     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1185     HID_USAGE_SENSOR_STATE_READY_SEL,
1186     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1187     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1188     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1189     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1190     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1191     HID_INPUT(Data_Arr_Abs),
1192     HID_END_COLLECTION,
1193     HID_USAGE_SENSOR_EVENT,
1194     HID_LOGICAL_MIN_8(0),
1195     HID_LOGICAL_MAX_8(5),
1196     HID_REPORT_SIZE(8),
1197     HID_REPORT_COUNT(1),
1198     HID_COLLECTION(Logical),
1199     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
1200     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
1201     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
1202     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
1203     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
1204     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
1205     HID_INPUT(Data_Arr_Abs),
1206     HID_END_COLLECTION,
1207     HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_ATMOSPHERIC_PRESSURE,
1208     HID_LOGICAL_MIN_8(0),
1209     HID_LOGICAL_MAX_16(0xFF,0xFF),
1210     HID_REPORT_SIZE(16),
1211     HID_REPORT_COUNT(1),
1212     HID_UNIT_EXPONENT(0x0E), // scale default unit "Bar" to provide 2 digits past the decimal point
1213     HID_INPUT(Data_Var_Abs),
1214 
1215     HID_END_COLLECTION
1216 };
1217 
1218 
1219 /**
1220  * Humidity sensor example.
1221  */
1222 const unsigned char humi_report_descriptor[] = {
1223     HID_USAGE_PAGE_SENSOR,
1224     HID_USAGE_SENSOR_TYPE_ENVIRONMENTAL_HUMIDITY,
1225     HID_COLLECTION(Physical),
1226 
1227     //feature reports (xmit/receive)
1228     HID_USAGE_PAGE_SENSOR,
1229     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
1230     HID_LOGICAL_MIN_8(0),
1231     HID_LOGICAL_MAX_8(2),
1232     HID_REPORT_SIZE(8),
1233     HID_REPORT_COUNT(1),
1234     HID_COLLECTION(Logical),
1235     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
1236     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
1237     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
1238     HID_FEATURE(Data_Arr_Abs),
1239     HID_END_COLLECTION,
1240     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
1241     HID_LOGICAL_MIN_8(0),
1242     HID_LOGICAL_MAX_8(5),
1243     HID_REPORT_SIZE(8),
1244     HID_REPORT_COUNT(1),
1245     HID_COLLECTION(Logical),
1246     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
1247     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
1248     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
1249     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
1250     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
1251     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
1252     HID_FEATURE(Data_Arr_Abs),
1253     HID_END_COLLECTION,
1254     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
1255     HID_LOGICAL_MIN_8(0),
1256     HID_LOGICAL_MAX_8(5),
1257     HID_REPORT_SIZE(8),
1258     HID_REPORT_COUNT(1),
1259     HID_COLLECTION(Logical),
1260     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
1261     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
1262     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
1263     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
1264     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
1265     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
1266     HID_FEATURE(Data_Arr_Abs),
1267     HID_END_COLLECTION,
1268     HID_USAGE_SENSOR_STATE,
1269     HID_LOGICAL_MIN_8(0),
1270     HID_LOGICAL_MAX_8(6),
1271     HID_REPORT_SIZE(8),
1272     HID_REPORT_COUNT(1),
1273     HID_COLLECTION(Logical),
1274     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1275     HID_USAGE_SENSOR_STATE_READY_SEL,
1276     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1277     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1278     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1279     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1280     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1281     HID_FEATURE(Data_Arr_Abs),
1282     HID_END_COLLECTION,
1283     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
1284     HID_LOGICAL_MIN_8(0),
1285     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
1286     HID_REPORT_SIZE(32),
1287     HID_REPORT_COUNT(1),
1288     HID_UNIT_EXPONENT(0),
1289     HID_FEATURE(Data_Var_Abs),
1290     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_RELATIVE_HUMIDITY,
1291                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
1292     HID_LOGICAL_MIN_8(0),
1293     HID_LOGICAL_MAX_16(0x10,0x27), // 10000 = 0.00 to 100.00 percent with 2 digits past decimal point
1294     HID_REPORT_SIZE(16),
1295     HID_REPORT_COUNT(1),
1296     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past the decimal point
1297     HID_FEATURE(Data_Var_Abs),
1298     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_RELATIVE_HUMIDITY,
1299                           HID_USAGE_SENSOR_DATA_MOD_MAX),
1300     HID_LOGICAL_MIN_8(0),
1301     HID_LOGICAL_MAX_16(0x10,0x27), // 10000 = 0.00 to 100.00 percent with 2 digits past decimal point
1302     HID_REPORT_SIZE(16),
1303     HID_REPORT_COUNT(1),
1304     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past the decimal point
1305     HID_FEATURE(Data_Var_Abs),
1306     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_RELATIVE_HUMIDITY,
1307                           HID_USAGE_SENSOR_DATA_MOD_MIN),
1308     HID_LOGICAL_MIN_8(0),
1309     HID_LOGICAL_MAX_16(0x10,0x27), // 10000 = 0.00 to 100.00 percent with 2 digits past decimal point
1310     HID_REPORT_SIZE(16),
1311     HID_REPORT_COUNT(1),
1312     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past the decimal point
1313     HID_FEATURE(Data_Var_Abs),
1314 
1315     //input reports (transmit)
1316     HID_USAGE_PAGE_SENSOR,
1317     HID_USAGE_SENSOR_STATE,
1318     HID_LOGICAL_MIN_8(0),
1319     HID_LOGICAL_MAX_8(6),
1320     HID_REPORT_SIZE(8),
1321     HID_REPORT_COUNT(1),
1322     HID_COLLECTION(Logical),
1323     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1324     HID_USAGE_SENSOR_STATE_READY_SEL,
1325     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1326     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1327     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1328     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1329     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1330     HID_INPUT(Data_Arr_Abs),
1331     HID_END_COLLECTION,
1332     HID_USAGE_SENSOR_EVENT,
1333     HID_LOGICAL_MIN_8(0),
1334     HID_LOGICAL_MAX_8(5),
1335     HID_REPORT_SIZE(8),
1336     HID_REPORT_COUNT(1),
1337     HID_COLLECTION(Logical),
1338     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
1339     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
1340     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
1341     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
1342     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
1343     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
1344     HID_INPUT(Data_Arr_Abs),
1345     HID_END_COLLECTION,
1346     HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_RELATIVE_HUMIDITY,
1347     HID_LOGICAL_MIN_8(0),
1348     HID_LOGICAL_MAX_16(0x10,0x27), // 10000 = 0.00 to 100.00 percent with 2 digits past decimal point
1349     HID_REPORT_SIZE(16),
1350     HID_REPORT_COUNT(1),
1351     HID_UNIT_EXPONENT(0x0E), // scale default unit "percent"
1352     // to provide 2 digits past the decimal point
1353     HID_INPUT(Data_Var_Abs),
1354 
1355     HID_END_COLLECTION
1356 };
1357 
1358 
1359 /**
1360  * Temperature sensor example.
1361  */
1362 const unsigned char temp_report_descriptor[] = {
1363     HID_USAGE_PAGE_SENSOR,
1364     HID_USAGE_SENSOR_TYPE_ENVIRONMENTAL_TEMPERATURE,
1365     HID_COLLECTION(Physical),
1366 
1367     //feature reports (xmit/receive)
1368     HID_USAGE_PAGE_SENSOR,
1369     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
1370     HID_LOGICAL_MIN_8(0),
1371     HID_LOGICAL_MAX_8(2),
1372     HID_REPORT_SIZE(8),
1373     HID_REPORT_COUNT(1),
1374     HID_COLLECTION(Logical),
1375     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
1376     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
1377     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
1378     HID_FEATURE(Data_Arr_Abs),
1379     HID_END_COLLECTION,
1380     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
1381     HID_LOGICAL_MIN_8(0),
1382     HID_LOGICAL_MAX_8(5),
1383     HID_REPORT_SIZE(8),
1384     HID_REPORT_COUNT(1),
1385     HID_COLLECTION(Logical),
1386     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
1387     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
1388     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
1389     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
1390     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
1391     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
1392     HID_FEATURE(Data_Arr_Abs),
1393     HID_END_COLLECTION,
1394     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
1395     HID_LOGICAL_MIN_8(0),
1396     HID_LOGICAL_MAX_8(5),
1397     HID_REPORT_SIZE(8),
1398     HID_REPORT_COUNT(1),
1399     HID_COLLECTION(Logical),
1400     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
1401     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
1402     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
1403     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
1404     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
1405     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
1406     HID_FEATURE(Data_Arr_Abs),
1407     HID_END_COLLECTION,
1408     HID_USAGE_SENSOR_STATE,
1409     HID_LOGICAL_MIN_8(0),
1410     HID_LOGICAL_MAX_8(6),
1411     HID_REPORT_SIZE(8),
1412     HID_REPORT_COUNT(1),
1413     HID_COLLECTION(Logical),
1414     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1415     HID_USAGE_SENSOR_STATE_READY_SEL,
1416     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1417     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1418     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1419     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1420     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1421     HID_FEATURE(Data_Arr_Abs),
1422     HID_END_COLLECTION,
1423     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
1424     HID_LOGICAL_MIN_8(0),
1425     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
1426     HID_REPORT_SIZE(32),
1427     HID_REPORT_COUNT(1),
1428     HID_UNIT_EXPONENT(0),
1429     HID_FEATURE(Data_Var_Abs),
1430     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE,
1431                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
1432     HID_LOGICAL_MIN_8(0),
1433     HID_LOGICAL_MAX_16(0xFF,0xFF),
1434     HID_REPORT_SIZE(16),
1435     HID_REPORT_COUNT(1),
1436     HID_UNIT_EXPONENT(0x0E), // scale default unit "Celsius"
1437     // to provide 2 digits past the decimal point
1438     HID_FEATURE(Data_Var_Abs),
1439     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE,
1440                           HID_USAGE_SENSOR_DATA_MOD_MAX),
1441     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1442     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1443     HID_REPORT_SIZE(16),
1444     HID_REPORT_COUNT(1),
1445     HID_UNIT_EXPONENT(0x0E), // scale default unit "Celsius"
1446     // to provide 2 digits past the decimal point
1447     HID_FEATURE(Data_Var_Abs),
1448     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE,
1449                           HID_USAGE_SENSOR_DATA_MOD_MIN),
1450     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1451     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1452     HID_REPORT_SIZE(16),
1453     HID_REPORT_COUNT(1),
1454     HID_UNIT_EXPONENT(0x0E), // scale default unit "Celsius"
1455     // to provide 2 digits past the decimal point
1456     HID_FEATURE(Data_Var_Abs),
1457 
1458     //input reports (transmit)
1459     HID_USAGE_PAGE_SENSOR,
1460     HID_USAGE_SENSOR_STATE,
1461     HID_LOGICAL_MIN_8(0),
1462     HID_LOGICAL_MAX_8(6),
1463     HID_REPORT_SIZE(8),
1464     HID_REPORT_COUNT(1),
1465     HID_COLLECTION(Logical),
1466     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1467     HID_USAGE_SENSOR_STATE_READY_SEL,
1468     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1469     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1470     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1471     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1472     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1473     HID_INPUT(Data_Arr_Abs),
1474     HID_END_COLLECTION,
1475     HID_USAGE_SENSOR_EVENT,
1476     HID_LOGICAL_MIN_8(0),
1477     HID_LOGICAL_MAX_8(16),
1478     HID_REPORT_SIZE(8),
1479     HID_REPORT_COUNT(1),
1480     HID_COLLECTION(Logical),
1481     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
1482     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
1483     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
1484     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
1485     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
1486     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
1487     HID_INPUT(Data_Arr_Abs),
1488     HID_END_COLLECTION,
1489     HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE,
1490     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1491     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1492     HID_REPORT_SIZE(16),
1493     HID_REPORT_COUNT(1),
1494     HID_UNIT_EXPONENT(0x0E), // scale default unit "Celsius"
1495     // to provide 2 digits past the decimal point
1496     HID_INPUT(Data_Var_Abs),
1497 
1498     HID_END_COLLECTION
1499 };
1500 
1501 
1502 /**
1503  * Ambient light sensor example.
1504  */
1505 const unsigned char als_report_descriptor[] = {
1506     HID_USAGE_PAGE_SENSOR,         // USAGE_PAGE (Sensor)
1507     HID_USAGE_SENSOR_TYPE_LIGHT_AMBIENTLIGHT, // USAGE (AmbientLight)
1508     HID_COLLECTION(Physical),
1509 
1510     //feature reports (xmit/receive)
1511     HID_USAGE_PAGE_SENSOR,
1512     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
1513     HID_LOGICAL_MIN_8(0),
1514     HID_LOGICAL_MAX_8(2),
1515     HID_REPORT_SIZE(8),
1516     HID_REPORT_COUNT(1),
1517     HID_COLLECTION(Logical),
1518     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
1519     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
1520     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
1521     HID_FEATURE(Data_Arr_Abs),
1522     HID_END_COLLECTION,
1523     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
1524     HID_LOGICAL_MIN_8(0),
1525     HID_LOGICAL_MAX_8(5),
1526     HID_REPORT_SIZE(8),
1527     HID_REPORT_COUNT(1),
1528     HID_COLLECTION(Logical),
1529     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
1530     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
1531     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
1532     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
1533     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
1534     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
1535     HID_FEATURE(Data_Arr_Abs),
1536     HID_END_COLLECTION,
1537     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
1538     HID_LOGICAL_MIN_8(0),
1539     HID_LOGICAL_MAX_8(5),
1540     HID_REPORT_SIZE(8),
1541     HID_REPORT_COUNT(1),
1542     HID_COLLECTION(Logical),
1543     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
1544     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
1545     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
1546     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
1547     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
1548     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
1549     HID_FEATURE(Data_Arr_Abs),
1550     HID_END_COLLECTION,
1551     HID_USAGE_SENSOR_STATE,
1552     HID_LOGICAL_MIN_8(0),
1553     HID_LOGICAL_MAX_8(6),
1554     HID_REPORT_SIZE(8),
1555     HID_REPORT_COUNT(1),
1556     HID_COLLECTION(Logical),
1557     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1558     HID_USAGE_SENSOR_STATE_READY_SEL,
1559     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1560     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1561     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1562     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1563     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1564     HID_FEATURE(Data_Arr_Abs),
1565     HID_END_COLLECTION,
1566     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
1567     HID_LOGICAL_MIN_8(0),
1568     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
1569     HID_REPORT_SIZE(32),
1570     HID_REPORT_COUNT(1),
1571     HID_UNIT_EXPONENT(0),
1572     HID_FEATURE(Data_Var_Abs),
1573     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_LIGHT_ILLUMINANCE,
1574                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_REL_PCT),
1575     HID_LOGICAL_MIN_8(0),
1576     HID_LOGICAL_MAX_16(0x10,0x27), // 10000 = 0.00 to 100.00 percent with 2 digits past decimal point
1577     HID_REPORT_SIZE(16),
1578     HID_REPORT_COUNT(1),
1579     HID_UNIT_EXPONENT(0x0E),  // scale default unit to provide 2 digits past decimal point
1580     HID_FEATURE(Data_Var_Abs),
1581     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_LIGHT_ILLUMINANCE,HID_USAGE_SENSOR_DATA_MOD_MAX),
1582     HID_LOGICAL_MIN_8(0),
1583     HID_LOGICAL_MAX_16(0xFF,0xFF),
1584     HID_REPORT_SIZE(16),
1585     HID_REPORT_COUNT(1),
1586     HID_UNIT_EXPONENT(0x0F), // scale default unit to provide 1 digit past decimal point
1587     HID_FEATURE(Data_Var_Abs),
1588     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_LIGHT_ILLUMINANCE,HID_USAGE_SENSOR_DATA_MOD_MIN),
1589     HID_LOGICAL_MIN_8(0),
1590     HID_LOGICAL_MAX_16(0xFF,0xFF),
1591     HID_REPORT_SIZE(16),
1592     HID_REPORT_COUNT(1),
1593     HID_UNIT_EXPONENT(0x0F), // scale default unit to provide 1 digit past decimal point
1594     HID_FEATURE(Data_Var_Abs),
1595 
1596     //add this definition if required by the specific application
1597     HID_USAGE_SENSOR_PROPERTY_RESPONSE_CURVE,
1598     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1599     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1600     HID_REPORT_SIZE(16),
1601     HID_REPORT_COUNT(10), //as required for n pair of values
1602     HID_UNIT_EXPONENT(0x0), // scale default unit to provide 0 digits past the decimal point
1603     HID_FEATURE(Data_Var_Abs),
1604 
1605     //input reports (transmit)
1606     HID_USAGE_PAGE_SENSOR,
1607     HID_USAGE_SENSOR_STATE,
1608     HID_LOGICAL_MIN_8(0),
1609     HID_LOGICAL_MAX_8(6),
1610     HID_REPORT_SIZE(8),
1611     HID_REPORT_COUNT(1),
1612     HID_COLLECTION(Logical),
1613     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1614     HID_USAGE_SENSOR_STATE_READY_SEL,
1615     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1616     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1617     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1618     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1619     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1620     HID_INPUT(Data_Arr_Abs),
1621     HID_END_COLLECTION,
1622     HID_USAGE_SENSOR_EVENT,
1623     HID_LOGICAL_MIN_8(0),
1624     HID_LOGICAL_MAX_8(5),
1625     HID_REPORT_SIZE(8),
1626     HID_REPORT_COUNT(1),
1627     HID_COLLECTION(Logical),
1628     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
1629     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
1630     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
1631     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
1632     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
1633     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
1634     HID_INPUT(Data_Arr_Abs),
1635     HID_END_COLLECTION,
1636     HID_USAGE_SENSOR_DATA_LIGHT_ILLUMINANCE,
1637     HID_LOGICAL_MIN_8(0),
1638     HID_LOGICAL_MAX_16(0xFF,0xFF),
1639     HID_UNIT_EXPONENT(0x0F), // scale default unit to provide 1 digit past decimal point
1640     HID_REPORT_SIZE(16),
1641     HID_REPORT_COUNT(1),
1642     HID_INPUT(Data_Var_Abs),
1643     HID_USAGE_SENSOR_DATA_LIGHT_COLOR_TEMPERATURE,
1644     HID_LOGICAL_MIN_8(0),
1645     HID_LOGICAL_MAX_16(0xFF,0xFF),
1646     HID_UNIT_EXPONENT(0),
1647     HID_REPORT_SIZE(16),
1648     HID_REPORT_COUNT(1),
1649     HID_INPUT(Data_Var_Abs),
1650     HID_USAGE_SENSOR_DATA_LIGHT_CHROMATICITY_X,
1651     HID_LOGICAL_MIN_8(0),
1652     HID_LOGICAL_MAX_16(0xFF,0xFF),
1653     HID_UNIT_EXPONENT(0x0C), // scale default unit to provide 4 digits past decimal point
1654     HID_REPORT_SIZE(16),
1655     HID_REPORT_COUNT(1),
1656     HID_INPUT(Data_Var_Abs),
1657     HID_USAGE_SENSOR_DATA_LIGHT_CHROMATICITY_Y,
1658     HID_LOGICAL_MIN_8(0),
1659     HID_LOGICAL_MAX_16(0xFF,0xFF),
1660     HID_UNIT_EXPONENT(0x0C), // scale default unit to provide 4 digits past decimal point
1661     HID_REPORT_SIZE(16),
1662     HID_REPORT_COUNT(1),
1663     HID_INPUT(Data_Var_Abs),
1664 
1665     HID_END_COLLECTION
1666 };
1667 
1668 
1669 /**
1670  * 3D accelerometer sensor example.
1671  */
1672 const unsigned char accel3_report_descriptor[] = {
1673     HID_USAGE_PAGE_SENSOR,
1674     HID_USAGE_SENSOR_TYPE_MOTION_ACCELEROMETER_3D,
1675     HID_COLLECTION(Physical),
1676 
1677     //feature reports (xmit/receive)
1678     HID_USAGE_PAGE_SENSOR,
1679     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
1680     HID_LOGICAL_MIN_8(0),
1681     HID_LOGICAL_MAX_8(2),
1682     HID_REPORT_SIZE(8),
1683     HID_REPORT_COUNT(1),
1684     HID_COLLECTION(Logical),
1685     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
1686     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
1687     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
1688     HID_FEATURE(Data_Arr_Abs),
1689     HID_END_COLLECTION,
1690     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
1691     HID_LOGICAL_MIN_8(0),
1692     HID_LOGICAL_MAX_8(5),
1693     HID_REPORT_SIZE(8),
1694     HID_REPORT_COUNT(1),
1695     HID_COLLECTION(Logical),
1696     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
1697     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
1698     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
1699     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
1700     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
1701     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
1702     HID_FEATURE(Data_Arr_Abs),
1703     HID_END_COLLECTION,
1704     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
1705     HID_LOGICAL_MIN_8(0),
1706     HID_LOGICAL_MAX_8(5),
1707     HID_REPORT_SIZE(8),
1708     HID_REPORT_COUNT(1),
1709     HID_COLLECTION(Logical),
1710     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
1711     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
1712     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
1713     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
1714     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
1715     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
1716     HID_FEATURE(Data_Arr_Abs),
1717     HID_END_COLLECTION,
1718     HID_USAGE_SENSOR_STATE,
1719     HID_LOGICAL_MIN_8(0),
1720     HID_LOGICAL_MAX_8(6),
1721     HID_REPORT_SIZE(8),
1722     HID_REPORT_COUNT(1),
1723     HID_COLLECTION(Logical),
1724     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1725     HID_USAGE_SENSOR_STATE_READY_SEL,
1726     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1727     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1728     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1729     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1730     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1731     HID_FEATURE(Data_Arr_Abs),
1732     HID_END_COLLECTION,
1733     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
1734     HID_LOGICAL_MIN_8(0),
1735     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
1736     HID_REPORT_SIZE(32),
1737     HID_REPORT_COUNT(1),
1738     HID_UNIT_EXPONENT(0),
1739     HID_FEATURE(Data_Var_Abs),
1740 
1741     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_MOTION_ACCELERATION,
1742                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
1743     HID_LOGICAL_MIN_8(0),
1744     HID_LOGICAL_MAX_16(0xFF,0xFF),
1745     HID_REPORT_SIZE(16),
1746     HID_REPORT_COUNT(1),
1747     HID_UNIT_EXPONENT(0x0E),  // scale default unit Gs to centi-Gs
1748     // to provide 2 digits past Gs decimal point
1749     HID_FEATURE(Data_Var_Abs),
1750 
1751     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_MOTION_ACCELERATION,HID_USAGE_SENSOR_DATA_MOD_MAX),
1752     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1753     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1754     HID_REPORT_SIZE(16),
1755     HID_REPORT_COUNT(1),
1756     HID_UNIT_EXPONENT(0x0E),  // scale default unit Gs to centi-Gs
1757     // to provide 2 digits past Gs decimal point
1758     HID_FEATURE(Data_Var_Abs),
1759 
1760     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_MOTION_ACCELERATION,HID_USAGE_SENSOR_DATA_MOD_MIN),
1761     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1762     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1763     HID_REPORT_SIZE(16),
1764     HID_REPORT_COUNT(1),
1765     HID_UNIT_EXPONENT(0x0E),  // scale default unit Gs to centi-Gs
1766     // to provide 2 digits past Gs decimal point
1767     HID_FEATURE(Data_Var_Abs),
1768 
1769     //input reports (transmit)
1770     HID_USAGE_PAGE_SENSOR,
1771     HID_USAGE_SENSOR_STATE,
1772     HID_LOGICAL_MIN_8(0),
1773     HID_LOGICAL_MAX_8(6),
1774     HID_REPORT_SIZE(8),
1775     HID_REPORT_COUNT(1),
1776     HID_COLLECTION(Logical),
1777     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1778     HID_USAGE_SENSOR_STATE_READY_SEL,
1779     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1780     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1781     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1782     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1783     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1784     HID_INPUT(Data_Arr_Abs),
1785     HID_END_COLLECTION,
1786     HID_USAGE_SENSOR_EVENT,
1787     HID_LOGICAL_MIN_8(0),
1788     HID_LOGICAL_MAX_8(5),
1789     HID_REPORT_SIZE(8),
1790     HID_REPORT_COUNT(1),
1791     HID_COLLECTION(Logical),
1792     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
1793     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
1794     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
1795     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
1796     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
1797     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
1798     HID_INPUT(Data_Arr_Abs),
1799     HID_END_COLLECTION,
1800     HID_USAGE_SENSOR_DATA_MOTION_ACCELERATION_X_AXIS,
1801     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1802     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1803     HID_REPORT_SIZE(16),
1804     HID_REPORT_COUNT(1),
1805     HID_UNIT_EXPONENT(0x0E),  // scale default unit Gs to centi-Gs
1806     // to provide 2 digits past Gs decimal point
1807     HID_INPUT(Data_Var_Abs),
1808     HID_USAGE_SENSOR_DATA_MOTION_ACCELERATION_Y_AXIS,
1809     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1810     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1811     HID_REPORT_SIZE(16),
1812     HID_REPORT_COUNT(1),
1813     HID_UNIT_EXPONENT(0x0E),  // scale default unit Gs to centi-Gs
1814     // to provide 2 digits past Gs decimal point
1815     HID_INPUT(Data_Var_Abs),
1816     HID_USAGE_SENSOR_DATA_MOTION_ACCELERATION_Z_AXIS,
1817     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1818     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1819     HID_REPORT_SIZE(16),
1820     HID_REPORT_COUNT(1),
1821     HID_UNIT_EXPONENT(0x0E),  // scale default unit Gs to centi-Gs
1822     // to provide 2 digits past Gs decimal point
1823     HID_INPUT(Data_Var_Abs),
1824 
1825     //include the following datafield if required to support the �shake� event
1826     HID_USAGE_SENSOR_DATA_MOTION_STATE,
1827     HID_LOGICAL_MIN_8(0), // False = Still
1828     HID_LOGICAL_MAX_8(1), // True = In Motion
1829     HID_REPORT_SIZE(8),
1830     HID_REPORT_COUNT(1),
1831     HID_INPUT(Data_Var_Abs),
1832 
1833     HID_END_COLLECTION
1834 };
1835 
1836 
1837 /**
1838  * 3D gyroscope sensor example.
1839  */
1840 const unsigned char gyro3_report_descriptor[] = {
1841     HID_USAGE_PAGE_SENSOR,
1842     HID_USAGE_SENSOR_TYPE_MOTION_GYROMETER_3D,
1843     HID_COLLECTION(Physical),
1844 
1845     //feature reports (xmit/receive)
1846     HID_USAGE_PAGE_SENSOR,
1847     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
1848     HID_LOGICAL_MIN_8(0),
1849     HID_LOGICAL_MAX_8(2),
1850     HID_REPORT_SIZE(8),
1851     HID_REPORT_COUNT(1),
1852     HID_COLLECTION(Logical),
1853     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
1854     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
1855     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
1856     HID_FEATURE(Data_Arr_Abs),
1857     HID_END_COLLECTION,
1858     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
1859     HID_LOGICAL_MIN_8(0),
1860     HID_LOGICAL_MAX_8(5),
1861     HID_REPORT_SIZE(8),
1862     HID_REPORT_COUNT(1),
1863     HID_COLLECTION(Logical),
1864     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
1865     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
1866     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
1867     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
1868     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
1869     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
1870     HID_FEATURE(Data_Arr_Abs),
1871     HID_END_COLLECTION,
1872     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
1873     HID_LOGICAL_MIN_8(0),
1874     HID_LOGICAL_MAX_8(5),
1875     HID_REPORT_SIZE(8),
1876     HID_REPORT_COUNT(1),
1877     HID_COLLECTION(Logical),
1878     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
1879     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
1880     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
1881     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
1882     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
1883     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
1884     HID_FEATURE(Data_Arr_Abs),
1885     HID_END_COLLECTION,
1886     HID_USAGE_SENSOR_STATE,
1887     HID_LOGICAL_MIN_8(0),
1888     HID_LOGICAL_MAX_8(6),
1889     HID_REPORT_SIZE(8),
1890     HID_REPORT_COUNT(1),
1891     HID_COLLECTION(Logical),
1892     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1893     HID_USAGE_SENSOR_STATE_READY_SEL,
1894     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1895     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1896     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1897     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1898     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1899     HID_FEATURE(Data_Arr_Abs),
1900     HID_END_COLLECTION,
1901     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
1902     HID_LOGICAL_MIN_8(0),
1903     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
1904     HID_REPORT_SIZE(32),
1905     HID_REPORT_COUNT(1),
1906     HID_UNIT_EXPONENT(0),
1907     HID_FEATURE(Data_Var_Abs),
1908     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_MOTION_ANGULAR_VELOCITY,
1909                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
1910     HID_LOGICAL_MIN_8(0),
1911     HID_LOGICAL_MAX_16(0xFF,0xFF),
1912     HID_REPORT_SIZE(16),
1913     HID_REPORT_COUNT(1),
1914     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
1915     HID_FEATURE(Data_Var_Abs),
1916     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_MOTION_ANGULAR_VELOCITY,
1917                           HID_USAGE_SENSOR_DATA_MOD_MAX),
1918     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1919     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1920     HID_REPORT_SIZE(16),
1921     HID_REPORT_COUNT(1),
1922     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
1923     HID_FEATURE(Data_Var_Abs),
1924     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_MOTION_ANGULAR_VELOCITY,
1925                           HID_USAGE_SENSOR_DATA_MOD_MIN),
1926     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1927     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1928     HID_REPORT_SIZE(16),
1929     HID_REPORT_COUNT(1),
1930     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
1931     HID_FEATURE(Data_Var_Abs),
1932 
1933     //input reports (transmit)
1934     HID_USAGE_PAGE_SENSOR,
1935     HID_USAGE_SENSOR_STATE,
1936     HID_LOGICAL_MIN_8(0),
1937     HID_LOGICAL_MAX_8(6),
1938     HID_REPORT_SIZE(8),
1939     HID_REPORT_COUNT(1),
1940     HID_COLLECTION(Logical),
1941     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
1942     HID_USAGE_SENSOR_STATE_READY_SEL,
1943     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
1944     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
1945     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
1946     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
1947     HID_USAGE_SENSOR_STATE_ERROR_SEL,
1948     HID_INPUT(Data_Arr_Abs),
1949     HID_END_COLLECTION,
1950     HID_USAGE_SENSOR_EVENT,
1951     HID_LOGICAL_MIN_8(0),
1952     HID_LOGICAL_MAX_8(5),
1953     HID_REPORT_SIZE(8),
1954     HID_REPORT_COUNT(1),
1955     HID_COLLECTION(Logical),
1956     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
1957     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
1958     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
1959     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
1960     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
1961     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
1962     HID_INPUT(Data_Arr_Abs),
1963     HID_END_COLLECTION,
1964     HID_USAGE_SENSOR_DATA_MOTION_ANGULAR_VELOCITY_X_AXIS,
1965     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1966     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1967     HID_REPORT_SIZE(16),
1968     HID_REPORT_COUNT(1),
1969     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
1970     HID_INPUT(Data_Var_Abs),
1971     HID_USAGE_SENSOR_DATA_MOTION_ANGULAR_VELOCITY_Y_AXIS,
1972     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1973     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1974     HID_REPORT_SIZE(16),
1975     HID_REPORT_COUNT(1),
1976     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
1977     HID_INPUT(Data_Var_Abs),
1978     HID_USAGE_SENSOR_DATA_MOTION_ANGULAR_VELOCITY_Z_AXIS,
1979     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
1980     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
1981     HID_REPORT_SIZE(16),
1982     HID_REPORT_COUNT(1),
1983     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
1984     HID_INPUT(Data_Var_Abs),
1985 
1986     HID_END_COLLECTION
1987 };
1988 
1989 
1990 /**
1991  * 3D compass sensor example.
1992  */
1993 const unsigned char comp3_report_descriptor[] = {
1994     HID_USAGE_PAGE_SENSOR,
1995     HID_USAGE_SENSOR_TYPE_ORIENTATION_COMPASS_3D,
1996     HID_COLLECTION(Physical),
1997 
1998     //feature reports (xmit/receive)
1999     HID_USAGE_PAGE_SENSOR,
2000     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
2001     HID_LOGICAL_MIN_8(0),
2002     HID_LOGICAL_MAX_8(2),
2003     HID_REPORT_SIZE(8),
2004     HID_REPORT_COUNT(1),
2005     HID_COLLECTION(Logical),
2006     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
2007     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
2008     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
2009     HID_FEATURE(Data_Arr_Abs),
2010     HID_END_COLLECTION,
2011     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
2012     HID_LOGICAL_MIN_8(0),
2013     HID_LOGICAL_MAX_8(5),
2014     HID_REPORT_SIZE(8),
2015     HID_REPORT_COUNT(1),
2016     HID_COLLECTION(Logical),
2017     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
2018     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
2019     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
2020     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
2021     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
2022     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
2023     HID_FEATURE(Data_Arr_Abs),
2024     HID_END_COLLECTION,
2025     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
2026     HID_LOGICAL_MIN_8(0),
2027     HID_LOGICAL_MAX_8(5),
2028     HID_REPORT_SIZE(8),
2029     HID_REPORT_COUNT(1),
2030     HID_COLLECTION(Logical),
2031     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
2032     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
2033     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
2034     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
2035     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
2036     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
2037     HID_FEATURE(Data_Arr_Abs),
2038     HID_END_COLLECTION,
2039     HID_USAGE_SENSOR_STATE,
2040     HID_LOGICAL_MIN_8(0),
2041     HID_LOGICAL_MAX_8(6),
2042     HID_REPORT_SIZE(8),
2043     HID_REPORT_COUNT(1),
2044     HID_COLLECTION(Logical),
2045     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
2046     HID_USAGE_SENSOR_STATE_READY_SEL,
2047     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
2048     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
2049     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
2050     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
2051     HID_USAGE_SENSOR_STATE_ERROR_SEL,
2052     HID_FEATURE(Data_Arr_Abs),
2053     HID_END_COLLECTION,
2054     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
2055     HID_LOGICAL_MIN_8(0),
2056     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
2057     HID_REPORT_SIZE(32),
2058     HID_REPORT_COUNT(1),
2059     HID_UNIT_EXPONENT(0),
2060     HID_FEATURE(Data_Var_Abs),
2061     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETIC_HEADING,
2062                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
2063     HID_LOGICAL_MIN_8(0),
2064     HID_LOGICAL_MAX_16(0xFF,0xFF),
2065     HID_REPORT_SIZE(16),
2066     HID_REPORT_COUNT(1),
2067     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
2068     HID_FEATURE(Data_Var_Abs),
2069     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETIC_HEADING,
2070                           HID_USAGE_SENSOR_DATA_MOD_MAX),
2071     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2072     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2073     HID_REPORT_SIZE(16),
2074     HID_REPORT_COUNT(1),
2075     HID_UNIT_EXPONENT(0x0F), // scale default unit to provide 1 digit past decimal point
2076     HID_FEATURE(Data_Var_Abs),
2077     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETIC_HEADING,
2078                           HID_USAGE_SENSOR_DATA_MOD_MIN),
2079     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2080     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2081     HID_REPORT_SIZE(16),
2082     HID_REPORT_COUNT(1),
2083     HID_UNIT_EXPONENT(0x0F), // scale default unit to provide 1 digit past decimal point
2084     HID_FEATURE(Data_Var_Abs),
2085     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETIC_FLUX,
2086                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
2087     HID_LOGICAL_MIN_8(0),
2088     HID_LOGICAL_MAX_16(0xFF,0xFF),
2089     HID_REPORT_SIZE(16),
2090     HID_REPORT_COUNT(1),
2091     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
2092     HID_FEATURE(Data_Var_Abs),
2093     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETIC_FLUX,
2094                           HID_USAGE_SENSOR_DATA_MOD_MAX),
2095     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2096     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2097     HID_REPORT_SIZE(16),
2098     HID_REPORT_COUNT(1),
2099     HID_UNIT_EXPONENT(0x0F), // scale default unit to provide 1 digit past decimal point
2100     HID_FEATURE(Data_Var_Abs),
2101     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETIC_FLUX,
2102                           HID_USAGE_SENSOR_DATA_MOD_MIN),
2103     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2104     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2105     HID_REPORT_SIZE(16),
2106     HID_REPORT_COUNT(1),
2107     HID_UNIT_EXPONENT(0x0F), // scale default unit to provide 1 digit past decimal point
2108     HID_FEATURE(Data_Var_Abs),
2109 
2110     //input reports (transmit)
2111     HID_USAGE_PAGE_SENSOR,
2112     HID_USAGE_SENSOR_STATE,
2113     HID_LOGICAL_MIN_8(0),
2114     HID_LOGICAL_MAX_8(6),
2115     HID_REPORT_SIZE(8),
2116     HID_REPORT_COUNT(1),
2117     HID_COLLECTION(Logical),
2118     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
2119     HID_USAGE_SENSOR_STATE_READY_SEL,
2120     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
2121     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
2122     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
2123     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
2124     HID_USAGE_SENSOR_STATE_ERROR_SEL,
2125     HID_INPUT(Data_Arr_Abs),
2126     HID_END_COLLECTION,
2127     HID_USAGE_SENSOR_EVENT,
2128     HID_LOGICAL_MIN_8(0),
2129     HID_LOGICAL_MAX_8(5),
2130     HID_REPORT_SIZE(8),
2131     HID_REPORT_COUNT(1),
2132     HID_COLLECTION(Logical),
2133     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
2134     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
2135     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
2136     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
2137     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
2138     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
2139     HID_INPUT(Data_Arr_Abs),
2140     HID_END_COLLECTION,
2141     HID_USAGE_SENSOR_DATA_ORIENTATION_COMPENSATED_MAGNETIC_NORTH,
2142     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2143     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2144     HID_REPORT_SIZE(16),
2145     HID_REPORT_COUNT(1),
2146     HID_UNIT_EXPONENT(0x0F), // scale default unit to provide 1 digit past decimal point
2147     HID_INPUT(Data_Var_Abs),
2148     HID_USAGE_SENSOR_DATA_ORIENTATION_COMPENSATED_TRUE_NORTH,
2149     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2150     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2151     HID_REPORT_SIZE(16),
2152     HID_REPORT_COUNT(1),
2153     HID_UNIT_EXPONENT(0x0F), // scale default unit to provide 1 digit past decimal point
2154     HID_INPUT(Data_Var_Abs),
2155     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETIC_NORTH,
2156     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2157     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2158     HID_REPORT_SIZE(16),
2159     HID_REPORT_COUNT(1),
2160     HID_UNIT_EXPONENT(0x0F), // scale default unit to provide 1 digit past decimal point
2161     HID_INPUT(Data_Var_Abs),
2162     HID_USAGE_SENSOR_DATA_ORIENTATION_TRUE_NORTH,
2163     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2164     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2165     HID_REPORT_SIZE(16),
2166     HID_REPORT_COUNT(1),
2167     HID_UNIT_EXPONENT(0x0F), // scale default unit to provide 1 digit past decimal point
2168     HID_INPUT(Data_Var_Abs),
2169     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETIC_FLUX_X_AXIS,
2170     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2171     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2172     HID_REPORT_SIZE(16),
2173     HID_REPORT_COUNT(1),
2174     HID_UNIT_EXPONENT(0x0D), // scale default unit to "milliGauss"
2175     // to provide 3 digits past decimal point
2176     HID_INPUT(Data_Var_Abs),
2177     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETIC_FLUX_Y_AXIS,
2178     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2179     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2180     HID_REPORT_SIZE(16),
2181     HID_REPORT_COUNT(1),
2182     HID_UNIT_EXPONENT(0x0D), // scale default unit to "milliGauss"
2183     // to provide 3 digits past decimal point
2184     HID_INPUT(Data_Var_Abs),
2185     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETIC_FLUX_Z_AXIS,
2186     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2187     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2188     HID_REPORT_SIZE(16),
2189     HID_REPORT_COUNT(1),
2190     HID_UNIT_EXPONENT(0x0D), // scale default unit to "milliGauss"
2191     // to provide 3 digits past decimal point
2192     HID_INPUT(Data_Var_Abs),
2193     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY,
2194     HID_LOGICAL_MIN_8(0),
2195     HID_LOGICAL_MAX_8(2),
2196     HID_REPORT_SIZE(8),
2197     HID_REPORT_COUNT(1),
2198     HID_COLLECTION(Logical),
2199     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY_LOW,
2200     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY_MEDIUM,
2201     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY_HIGH,
2202     HID_INPUT(Data_Arr_Abs),
2203     HID_END_COLLECTION,
2204 
2205     HID_END_COLLECTION
2206 };
2207 
2208 
2209 /**
2210  * 3D inclinomater example.
2211  */
2212 const unsigned char inc3_report_descriptor[] = {
2213     HID_USAGE_PAGE_SENSOR,
2214     HID_USAGE_SENSOR_TYPE_ORIENTATION_INCLINOMETER_3D,
2215     HID_COLLECTION(Physical),
2216 
2217     //feature reports (xmit/receive)
2218     HID_USAGE_PAGE_SENSOR,
2219     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
2220     HID_LOGICAL_MIN_8(0),
2221     HID_LOGICAL_MAX_8(2),
2222     HID_REPORT_SIZE(8),
2223     HID_REPORT_COUNT(1),
2224     HID_COLLECTION(Logical),
2225     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
2226     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
2227     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
2228     HID_FEATURE(Data_Arr_Abs),
2229     HID_END_COLLECTION,
2230     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
2231     HID_LOGICAL_MIN_8(0),
2232     HID_LOGICAL_MAX_8(5),
2233     HID_REPORT_SIZE(8),
2234     HID_REPORT_COUNT(1),
2235     HID_COLLECTION(Logical),
2236     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
2237     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
2238     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
2239     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
2240     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
2241     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
2242     HID_FEATURE(Data_Arr_Abs),
2243     HID_END_COLLECTION,
2244     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
2245     HID_LOGICAL_MIN_8(0),
2246     HID_LOGICAL_MAX_8(5),
2247     HID_REPORT_SIZE(8),
2248     HID_REPORT_COUNT(1),
2249     HID_COLLECTION(Logical),
2250     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
2251     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
2252     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
2253     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
2254     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
2255     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
2256     HID_FEATURE(Data_Arr_Abs),
2257     HID_END_COLLECTION,
2258     HID_USAGE_SENSOR_STATE,
2259     HID_LOGICAL_MIN_8(0),
2260     HID_LOGICAL_MAX_8(6),
2261     HID_REPORT_SIZE(8),
2262     HID_REPORT_COUNT(1),
2263     HID_COLLECTION(Logical),
2264     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
2265     HID_USAGE_SENSOR_STATE_READY_SEL,
2266     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
2267     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
2268     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
2269     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
2270     HID_USAGE_SENSOR_STATE_ERROR_SEL,
2271     HID_FEATURE(Data_Arr_Abs),
2272     HID_END_COLLECTION,
2273     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
2274     HID_LOGICAL_MIN_8(0),
2275     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
2276     HID_REPORT_SIZE(32),
2277     HID_REPORT_COUNT(1),
2278     HID_UNIT_EXPONENT(0),
2279     HID_FEATURE(Data_Var_Abs),
2280     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_TILT,
2281                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
2282     HID_LOGICAL_MIN_8(0),
2283     HID_LOGICAL_MAX_16(0xFF,0xFF),
2284     HID_REPORT_SIZE(16),
2285     HID_REPORT_COUNT(1),
2286     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
2287     HID_FEATURE(Data_Var_Abs),
2288     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_TILT,HID_USAGE_SENSOR_DATA_MOD_MAX),
2289     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2290     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2291     HID_REPORT_SIZE(16),
2292     HID_REPORT_COUNT(1),
2293     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
2294     HID_FEATURE(Data_Var_Abs),
2295     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_TILT,HID_USAGE_SENSOR_DATA_MOD_MIN),
2296     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2297     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2298     HID_REPORT_SIZE(16),
2299     HID_REPORT_COUNT(1),
2300     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
2301     HID_FEATURE(Data_Var_Abs),
2302 
2303     //input reports (transmit)
2304     HID_USAGE_PAGE_SENSOR,
2305     HID_USAGE_SENSOR_STATE,
2306     HID_LOGICAL_MIN_8(0),
2307     HID_LOGICAL_MAX_8(6),
2308     HID_REPORT_SIZE(8),
2309     HID_REPORT_COUNT(1),
2310     HID_COLLECTION(Logical),
2311     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
2312     HID_USAGE_SENSOR_STATE_READY_SEL,
2313     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
2314     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
2315     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
2316     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
2317     HID_USAGE_SENSOR_STATE_ERROR_SEL,
2318     HID_INPUT(Data_Arr_Abs),
2319     HID_END_COLLECTION,
2320     HID_USAGE_SENSOR_EVENT,
2321     HID_LOGICAL_MIN_8(0),
2322     HID_LOGICAL_MAX_8(5),
2323     HID_REPORT_SIZE(8),
2324     HID_REPORT_COUNT(1),
2325     HID_COLLECTION(Logical),
2326     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
2327     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
2328     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
2329     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
2330     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
2331     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
2332     HID_INPUT(Data_Arr_Abs),
2333     HID_END_COLLECTION,
2334     HID_USAGE_SENSOR_DATA_ORIENTATION_TILT_X,
2335     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2336     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2337     HID_REPORT_SIZE(16),
2338     HID_REPORT_COUNT(1),
2339     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
2340     HID_INPUT(Data_Var_Abs),
2341     HID_USAGE_SENSOR_DATA_ORIENTATION_TILT_Y,
2342     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2343     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2344     HID_REPORT_SIZE(16),
2345     HID_REPORT_COUNT(1),
2346     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
2347     HID_INPUT(Data_Var_Abs),
2348     HID_USAGE_SENSOR_DATA_ORIENTATION_TILT_Z,
2349     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2350     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2351     HID_REPORT_SIZE(16),
2352     HID_REPORT_COUNT(1),
2353     HID_UNIT_EXPONENT(0x0E), // scale default unit to provide 2 digits past decimal point
2354     HID_INPUT(Data_Var_Abs),
2355     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY,
2356     HID_LOGICAL_MIN_8(0),
2357     HID_LOGICAL_MAX_8(2),
2358     HID_REPORT_SIZE(8),
2359     HID_REPORT_COUNT(1),
2360     HID_COLLECTION(Logical),
2361     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY_LOW,
2362     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY_MEDIUM,
2363     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY_HIGH,
2364     HID_INPUT(Data_Arr_Abs),
2365     HID_END_COLLECTION,
2366 
2367     HID_END_COLLECTION
2368 };
2369 
2370 
2371 /**
2372  * Device orientation sensor example. Note this maps to rotation vector sensor in android.
2373  */
2374 const unsigned char devor_report_descriptor[] = {
2375     HID_USAGE_PAGE_SENSOR,
2376     HID_USAGE_SENSOR_TYPE_ORIENTATION_DEVICE_ORIENTATION,
2377     HID_COLLECTION(Physical),
2378 
2379     //feature reports (xmit/receive)
2380     HID_USAGE_PAGE_SENSOR,
2381     HID_USAGE_SENSOR_PROPERTY_SENSOR_CONNECTION_TYPE,  // NAry
2382     HID_LOGICAL_MIN_8(0),
2383     HID_LOGICAL_MAX_8(2),
2384     HID_REPORT_SIZE(8),
2385     HID_REPORT_COUNT(1),
2386     HID_COLLECTION(Logical),
2387     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_INTEGRATED_SEL,
2388     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_ATTACHED_SEL,
2389     HID_USAGE_SENSOR_PROPERTY_CONNECTION_TYPE_PC_EXTERNAL_SEL,
2390     HID_FEATURE(Data_Arr_Abs),
2391     HID_END_COLLECTION,
2392     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE,
2393     HID_LOGICAL_MIN_8(0),
2394     HID_LOGICAL_MAX_8(5),
2395     HID_REPORT_SIZE(8),
2396     HID_REPORT_COUNT(1),
2397     HID_COLLECTION(Logical),
2398     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_SEL,
2399     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_SEL,
2400     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_SEL,
2401     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_NO_EVENTS_WAKE_SEL,
2402     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_ALL_EVENTS_WAKE_SEL,
2403     HID_USAGE_SENSOR_PROPERTY_REPORTING_STATE_THRESHOLD_EVENTS_WAKE_SEL,
2404     HID_FEATURE(Data_Arr_Abs),
2405     HID_END_COLLECTION,
2406     HID_USAGE_SENSOR_PROPERTY_POWER_STATE,
2407     HID_LOGICAL_MIN_8(0),
2408     HID_LOGICAL_MAX_8(5),
2409     HID_REPORT_SIZE(8),
2410     HID_REPORT_COUNT(1),
2411     HID_COLLECTION(Logical),
2412     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_UNDEFINED_SEL,
2413     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D0_FULL_POWER_SEL,
2414     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D1_LOW_POWER_SEL,
2415     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D2_STANDBY_WITH_WAKE_SEL,
2416     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D3_SLEEP_WITH_WAKE_SEL,
2417     HID_USAGE_SENSOR_PROPERTY_POWER_STATE_D4_POWER_OFF_SEL,
2418     HID_FEATURE(Data_Arr_Abs),
2419     HID_END_COLLECTION,
2420     HID_USAGE_SENSOR_STATE,
2421     HID_LOGICAL_MIN_8(0),
2422     HID_LOGICAL_MAX_8(6),
2423     HID_REPORT_SIZE(8),
2424     HID_REPORT_COUNT(1),
2425     HID_COLLECTION(Logical),
2426     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
2427     HID_USAGE_SENSOR_STATE_READY_SEL,
2428     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
2429     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
2430     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
2431     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
2432     HID_USAGE_SENSOR_STATE_ERROR_SEL,
2433     HID_FEATURE(Data_Arr_Abs),
2434     HID_END_COLLECTION,
2435     HID_USAGE_SENSOR_PROPERTY_REPORT_INTERVAL,
2436     HID_LOGICAL_MIN_8(0),
2437     HID_LOGICAL_MAX_32(0xFF,0xFF,0xFF,0xFF),
2438     HID_REPORT_SIZE(32),
2439     HID_REPORT_COUNT(1),
2440     HID_UNIT_EXPONENT(0),
2441     HID_FEATURE(Data_Var_Abs),
2442     HID_USAGE_SENSOR_PROPERTY_CHANGE_SENSITIVITY_ABS,
2443     HID_LOGICAL_MIN_8(0),
2444     HID_LOGICAL_MAX_16(0xFF,0xFF),
2445     HID_REPORT_SIZE(16),
2446     HID_REPORT_COUNT(1),
2447     HID_UNIT_EXPONENT(0x0E), // scale default unit "meter" to provide 2 digits past the decimal point
2448     HID_FEATURE(Data_Var_Abs),
2449     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_QUATERNION,
2450                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
2451     HID_LOGICAL_MIN_8(0),
2452     HID_LOGICAL_MAX_16(0xFF,0xFF),
2453     HID_REPORT_SIZE(16),
2454     HID_REPORT_COUNT(1),
2455     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_QUATERNION,
2456                           HID_USAGE_SENSOR_DATA_MOD_MAX),
2457     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2458     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2459     HID_REPORT_SIZE(16),
2460     HID_REPORT_COUNT(1),
2461     HID_UNIT_EXPONENT(0x01),
2462     HID_FEATURE(Data_Var_Abs),
2463     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_QUATERNION,
2464                           HID_USAGE_SENSOR_DATA_MOD_MIN),
2465     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2466     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2467     HID_REPORT_SIZE(16),
2468     HID_REPORT_COUNT(1),
2469     HID_UNIT_EXPONENT(0x01),
2470     HID_FEATURE(Data_Var_Abs),
2471 
2472     //include this if the values are calculated in firmware
2473     //otherwise, the driver will calculate these values from the Quaternion
2474     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_ROTATION_MATRIX,
2475                           HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS),
2476     HID_LOGICAL_MIN_8(0),
2477     HID_LOGICAL_MAX_16(0xFF,0xFF),
2478     HID_REPORT_SIZE(16),
2479     HID_REPORT_COUNT(1),
2480     HID_UNIT_EXPONENT(0x0E),
2481     HID_FEATURE(Data_Var_Abs),
2482     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_ROTATION_MATRIX,
2483                           HID_USAGE_SENSOR_DATA_MOD_MAX),
2484     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2485     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2486     HID_REPORT_SIZE(16),
2487     HID_REPORT_COUNT(1),
2488     HID_UNIT_EXPONENT(0x0E),
2489     HID_FEATURE(Data_Var_Abs),
2490     HID_USAGE_SENSOR_DATA(HID_USAGE_SENSOR_DATA_ORIENTATION_ROTATION_MATRIX,
2491                           HID_USAGE_SENSOR_DATA_MOD_MIN),
2492     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2493     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2494     HID_REPORT_SIZE(16),
2495     HID_REPORT_COUNT(1),
2496     HID_UNIT_EXPONENT(0x0E),
2497     HID_FEATURE(Data_Var_Abs),
2498 
2499     //input reports (transmit)
2500     HID_USAGE_PAGE_SENSOR,
2501     HID_USAGE_SENSOR_STATE,
2502     HID_LOGICAL_MIN_8(0),
2503     HID_LOGICAL_MAX_8(6),
2504     HID_REPORT_SIZE(8),
2505     HID_REPORT_COUNT(1),
2506     HID_COLLECTION(Logical),
2507     HID_USAGE_SENSOR_STATE_UNKNOWN_SEL,
2508     HID_USAGE_SENSOR_STATE_READY_SEL,
2509     HID_USAGE_SENSOR_STATE_NOT_AVAILABLE_SEL,
2510     HID_USAGE_SENSOR_STATE_NO_DATA_SEL,
2511     HID_USAGE_SENSOR_STATE_INITIALIZING_SEL,
2512     HID_USAGE_SENSOR_STATE_ACCESS_DENIED_SEL,
2513     HID_USAGE_SENSOR_STATE_ERROR_SEL,
2514     HID_INPUT(Data_Arr_Abs),
2515     HID_END_COLLECTION,
2516     HID_USAGE_SENSOR_EVENT,
2517     HID_LOGICAL_MIN_8(0),
2518     HID_LOGICAL_MAX_8(5),
2519     HID_REPORT_SIZE(8),
2520     HID_REPORT_COUNT(1),
2521     HID_COLLECTION(Logical),
2522     HID_USAGE_SENSOR_EVENT_UNKNOWN_SEL,
2523     HID_USAGE_SENSOR_EVENT_STATE_CHANGED_SEL,
2524     HID_USAGE_SENSOR_EVENT_PROPERTY_CHANGED_SEL,
2525     HID_USAGE_SENSOR_EVENT_DATA_UPDATED_SEL,
2526     HID_USAGE_SENSOR_EVENT_POLL_RESPONSE_SEL,
2527     HID_USAGE_SENSOR_EVENT_CHANGE_SENSITIVITY_SEL,
2528     HID_INPUT(Data_Arr_Abs),
2529     HID_END_COLLECTION,
2530     HID_USAGE_SENSOR_DATA_ORIENTATION_QUATERNION,
2531     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2532     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2533     HID_REPORT_SIZE(16),
2534     HID_REPORT_COUNT(4),
2535     HID_UNIT_EXPONENT(0x0E),
2536     HID_INPUT(Data_Arr_Abs),
2537 
2538     //include this if the values are calculated in firmware
2539     //otherwise, the driver will calculate these values from the Quaternion
2540     HID_USAGE_SENSOR_DATA_ORIENTATION_ROTATION_MATRIX,
2541     HID_LOGICAL_MIN_16(0x01,0x80), //    LOGICAL_MINIMUM (-32767)
2542     HID_LOGICAL_MAX_16(0xFF,0x7F), //    LOGICAL_MAXIMUM (32767)
2543     HID_REPORT_SIZE(16),
2544     HID_REPORT_COUNT(9),
2545     HID_UNIT_EXPONENT(0x0F),
2546     HID_INPUT(Data_Arr_Abs),
2547 
2548     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY,
2549     HID_LOGICAL_MIN_8(0),
2550     HID_LOGICAL_MAX_8(2),
2551     HID_REPORT_SIZE(8),
2552     HID_REPORT_COUNT(1),
2553     HID_COLLECTION(Logical),
2554     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY_LOW,
2555     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY_MEDIUM,
2556     HID_USAGE_SENSOR_DATA_ORIENTATION_MAGNETOMETER_ACCURACY_HIGH,
2557     HID_INPUT(Data_Arr_Abs),
2558     HID_END_COLLECTION,
2559 
2560     HID_END_COLLECTION
2561 };
2562 } // annoymous namespace
2563 
2564 /**
2565  * Global test vector entry.
2566  */
2567 #define TEST_DESCRIPTOR(name) \
2568     { name ## _report_descriptor, sizeof(name ## _report_descriptor), #name }
2569 
2570 const TestHidDescriptor gDescriptorArray[] = {
2571     TEST_DESCRIPTOR(accel3),
2572     TEST_DESCRIPTOR(col1),
2573     TEST_DESCRIPTOR(col2),
2574     TEST_DESCRIPTOR(col3),
2575     TEST_DESCRIPTOR(cus1),
2576     TEST_DESCRIPTOR(cus2),
2577     TEST_DESCRIPTOR(cus3),
2578     TEST_DESCRIPTOR(cus4),
2579     TEST_DESCRIPTOR(pres),
2580     TEST_DESCRIPTOR(prox),
2581     TEST_DESCRIPTOR(bar),
2582     TEST_DESCRIPTOR(humi),
2583     TEST_DESCRIPTOR(temp),
2584     TEST_DESCRIPTOR(als),
2585     TEST_DESCRIPTOR(gyro3),
2586     TEST_DESCRIPTOR(comp3),
2587     TEST_DESCRIPTOR(inc3),
2588     TEST_DESCRIPTOR(devor),
2589     {nullptr, 0, nullptr} //sentinel
2590 };
2591 #undef TEST_DESCRIPTOR
2592 
findTestDescriptor(const char * name)2593 const TestHidDescriptor *findTestDescriptor(const char *name) {
2594     if (name == nullptr) {
2595         return nullptr;
2596     }
2597 
2598     for (const TestHidDescriptor *p = gDescriptorArray; ; ++p) {
2599         if (p->data == nullptr || p->len == 0) {
2600             break;
2601         }
2602         if (strcmp(p->name, name) == 0) {
2603             return p;
2604         }
2605     }
2606     return nullptr;
2607 }
2608