Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1236 lines
58 KiB

  1. typedef int POOL_TYPE;
  2. #include <stdio.h>
  3. #include <nt.h>
  4. #include <ntrtl.h>
  5. #include <nturtl.h>
  6. #include <windows.h>
  7. #include <wtypes.h>
  8. #include <hidpddi.h>
  9. #include <hidparse.h>
  10. #undef ASSERT
  11. #define ASSERT( exp ) \
  12. if (!(exp)) \
  13. { printf ("Assert Failed: %s \n %s \n %d \n", #exp, __FILE__, __LINE__ ); }
  14. NTSTATUS __stdcall
  15. HidP_SetUnsetOneUsage (
  16. struct _CHANNEL_REPORT_HEADER *,
  17. USAGE,
  18. USHORT,
  19. USAGE,
  20. PHIDP_PREPARSED_DATA,
  21. PCHAR,
  22. BOOLEAN);
  23. typedef union _HID_PPD_FLAGS {
  24. struct {
  25. ULONG InputChannels : 1;
  26. ULONG OutputChannels : 1;
  27. ULONG FeatureChannels : 1;
  28. ULONG LinkCollections : 1;
  29. ULONG FullChannelListing : 1;
  30. ULONG ReportLocation : 1;
  31. ULONG Reserved : 25;
  32. ULONG IgnoreSignature : 1;
  33. };
  34. ULONG Flags;
  35. } HID_PPD_FLAGS;
  36. VOID HID_DumpPpd (PHIDP_PREPARSED_DATA Ppd, HID_PPD_FLAGS Flags);
  37. void __cdecl main ()
  38. {
  39. HID_PPD_FLAGS flags;
  40. ULONG i;
  41. UCHAR desc[] = {0x05, 0x0C, 0x09, 0x01,
  42. 0xA1, 0x01, 0x85, 0x01,
  43. 0x09, 0x36, 0xA1, 0x02,
  44. 0x05, 0x09, 0x19, 0x01,
  45. 0x29, 0x10, 0x15, 0x00,
  46. 0x25, 0x01, 0x35, 0x00,
  47. 0x45, 0x01, 0x75, 0x01,
  48. 0x95, 0x10, 0x81, 0x02,
  49. 0xC0, 0x15, 0x01,
  50. 0x25, 0x03, 0x75, 0x02,
  51. 0x95, 0x01, 0x05, 0x0C,
  52. 0x09, 0xB0, 0xA1, 0x02,
  53. 0x05, 0x08, 0x09, 0x3C,
  54. 0xA1, 0x02, 0x09, 0x3D,
  55. 0x09, 0x3F, 0x09, 0x41,
  56. 0x91, 0x00, 0xC0,
  57. 0x09, 0x47, 0xA1, 0x02,
  58. 0x09, 0x48, 0x09, 0x49,
  59. 0x09, 0x4A, 0x91, 0x00,
  60. 0x91, 0x01, 0x91, 0x01,
  61. 0xC0, 0xC0,
  62. 0x05, 0x14, 0x15, 0x00,
  63. 0x09, 0x20, 0xA1, 0x02,
  64. 0x09, 0x35, 0x25, 0x03,
  65. 0x75, 0x03, 0x95, 0x01,
  66. 0xB1, 0x03, 0x09, 0x36,
  67. 0x25, 0x1F, 0x75, 0x05,
  68. 0xB1, 0x03, 0xC0,
  69. 0x09, 0x32, 0xA1, 0x02,
  70. 0x85, 0x02, 0x09, 0x33,
  71. 0x75, 0x03, 0x95, 0x01,
  72. 0x25, 0x07, 0xB1, 0x22,
  73. 0x09, 0x34, 0x75, 0x05,
  74. 0x25, 0x1F, 0xB1, 0x22,
  75. 0xC0, 0x09, 0x2B,
  76. 0xA1, 0x02, 0x09, 0x33,
  77. 0x75, 0x03, 0x95, 0x01,
  78. 0x25, 0x07, 0xB1, 0x22,
  79. 0x09, 0x34, 0x75, 0x05,
  80. 0x25, 0x1F, 0xB1, 0x22,
  81. 0x75, 0x08, 0x95, 0x04,
  82. 0x15, 0x20, 0x26, 0xFE, 0x00,
  83. 0x09, 0x2C, 0xB1, 0x02,
  84. 0xC0, 0xC0
  85. };
  86. unsigned char PwrReportDescriptor[] = {
  87. 0x05, 0x84, // USAGE_PAGE (Power Device)
  88. 0x09, 0x04, // USAGE (UPS)
  89. 0xa1, 0x01, // COLLECTION (Application)
  90. 0x85, 0x01, // REPORT_ID (1)
  91. 0x09, 0x1e, // USAGE (Flow)
  92. 0xa1, 0x02, // COLLECTION (Logical)
  93. 0x09, 0x1f, // USAGE (FlowID)
  94. 0x75, 0x04, // REPORT_SIZE (4)
  95. 0x95, 0x01, // REPORT_COUNT (1)
  96. 0x15, 0x00, // LOGICAL_MINIMUM (0)
  97. 0x25, 0x0f, // LOGICAL_MAXIMUM (15)
  98. 0x65, 0x00, // UNIT (None)
  99. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  100. 0x09, 0x00, // USAGE (Undefined)
  101. 0x95, 0x01, // REPORT_COUNT (1)
  102. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  103. 0x09, 0x01, // USAGE (iName)
  104. 0x75, 0x08, // REPORT_SIZE (8)
  105. 0x95, 0x01, // REPORT_COUNT (1)
  106. 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
  107. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  108. 0x09, 0x40, // USAGE (ConfigVoltage)
  109. 0x75, 0x08, // REPORT_SIZE (8)
  110. 0x95, 0x01, // REPORT_COUNT (1)
  111. 0x67, 0x21, 0xd1, 0xf0, 0x00, // UNIT (SI Lin:Volts)
  112. 0x55, 0x07, // UNIT_EXPONENT (7)
  113. 0x26, 0xfe, 0x00, // LOGICAL_MAXIMUM (254)
  114. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  115. 0x09, 0x42, // USAGE (ConfigFrequency)
  116. 0x95, 0x01, // REPORT_COUNT (1)
  117. 0x66, 0x01, 0xf0, // UNIT (SI Lin:Hertz)
  118. 0x55, 0x00, // UNIT_EXPONENT (0)
  119. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  120. 0x09, 0x43, // USAGE (ConfigApparentPower)
  121. 0x75, 0x10, // REPORT_SIZE (16)
  122. 0x95, 0x01, // REPORT_COUNT (1)
  123. 0x66, 0x21, 0xd1, // UNIT (SI Lin:Power)
  124. 0x55, 0x07, // UNIT_EXPONENT (7)
  125. 0x27, 0xfe, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65534)
  126. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  127. 0x65, 0x00, // UNIT (None)
  128. 0xc0, // END_COLLECTION
  129. 0x09, 0x24, // USAGE (PowerSummary)
  130. 0xa1, 0x00, // COLLECTION (Physical)
  131. 0x85, 0x02, // REPORT_ID (2)
  132. 0x09, 0x25, // USAGE (PowerSummaryID)
  133. 0x09, 0x1f, // USAGE (FlowID)
  134. 0x75, 0x04, // REPORT_SIZE (4)
  135. 0x95, 0x02, // REPORT_COUNT (2)
  136. 0x25, 0x0f, // LOGICAL_MAXIMUM (15)
  137. 0x65, 0x00, // UNIT (None)
  138. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  139. 0x09, 0x01, // USAGE (iName)
  140. 0x75, 0x08, // REPORT_SIZE (8)
  141. 0x95, 0x01, // REPORT_COUNT (1)
  142. 0x25, 0x0f, // LOGICAL_MAXIMUM (15)
  143. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  144. 0x0b, 0x2c, 0x00, 0x85, 0x00, // USAGE (Battery System:CapacityMode)
  145. 0x0b, 0x8b, 0x00, 0x85, 0x00, // USAGE (Battery System:Rechargable)
  146. 0x75, 0x01, // REPORT_SIZE (1)
  147. 0x95, 0x02, // REPORT_COUNT (2)
  148. 0x25, 0x01, // LOGICAL_MAXIMUM (1)
  149. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  150. 0x09, 0x00, // USAGE (Undefined)
  151. 0x75, 0x06, // REPORT_SIZE (6)
  152. 0x95, 0x01, // REPORT_COUNT (1)
  153. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  154. 0x0b, 0x83, 0x00, 0x85, 0x00, // USAGE (Battery System:DesignCapacity)
  155. 0x0b, 0x67, 0x00, 0x85, 0x00, // USAGE (Battery System:FullChargeCapacity)
  156. 0x75, 0x18, // REPORT_SIZE (24)
  157. 0x95, 0x02, // REPORT_COUNT (2)
  158. 0x67, 0x01, 0x10, 0x10, 0x00, // UNIT (SI Lin:Battery Capacity)
  159. 0x27, 0xfe, 0xff, 0xff, 0x00, // LOGICAL_MAXIMUM (16777214)
  160. 0xb1, 0x02, // FEATURE (Data,Var,Abs)
  161. 0x09, 0x40, // USAGE (ConfigVoltage)
  162. 0x75, 0x10, // REPORT_SIZE (16)
  163. 0x95, 0x01, // REPORT_COUNT (1)
  164. 0x67, 0x21, 0xd1, 0xf0, 0x00, // UNIT (SI Lin:Volts)
  165. 0x55, 0x05, // UNIT_EXPONENT (5)
  166. 0x27, 0xfe, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65534)
  167. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  168. 0x0b, 0x8c, 0x00, 0x85, 0x00, // USAGE (Battery System:WarningCapacityLimit)
  169. 0x0b, 0x29, 0x00, 0x85, 0x00, // USAGE (Battery System:RemainingCapacityLimit)
  170. 0x0b, 0x8d, 0x00, 0x85, 0x00, // USAGE (Battery System:CapacityGranularity1)
  171. 0x0b, 0x8e, 0x00, 0x85, 0x00, // USAGE (Battery System:CapacityGranularity2)
  172. 0x75, 0x18, // REPORT_SIZE (24)
  173. 0x95, 0x04, // REPORT_COUNT (4)
  174. 0x67, 0x01, 0x10, 0x10, 0x00, // UNIT (SI Lin:Battery Capacity)
  175. 0x55, 0x00, // UNIT_EXPONENT (0)
  176. 0x27, 0xfe, 0xff, 0xff, 0x00, // LOGICAL_MAXIMUM (16777214)
  177. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  178. 0x09, 0xfe, // USAGE (iProduct)
  179. 0x09, 0xff, // USAGE (iSerialNumber)
  180. 0x0b, 0x89, 0x00, 0x85, 0x00, // USAGE (Battery System:iDeviceChemistery)
  181. 0x0b, 0x87, 0x00, 0x85, 0x00, // USAGE (Battery System:iManufacturerName)
  182. 0x75, 0x08, // REPORT_SIZE (8)
  183. 0x95, 0x04, // REPORT_COUNT (4)
  184. 0x25, 0x0f, // LOGICAL_MAXIMUM (15)
  185. 0x65, 0x00, // UNIT (None)
  186. 0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
  187. 0x09, 0x30, // USAGE (Voltage)
  188. 0x75, 0x10, // REPORT_SIZE (16)
  189. 0x95, 0x01, // REPORT_COUNT (1)
  190. 0x67, 0x21, 0xd1, 0xf0, 0x00, // UNIT (SI Lin:Volts)
  191. 0x55, 0x05, // UNIT_EXPONENT (5)
  192. 0x27, 0xfe, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65534)
  193. 0xb1, 0x02, // FEATURE (Data,Var,Abs)
  194. 0x09, 0x31, // USAGE (Current)
  195. 0x95, 0x01, // REPORT_COUNT (1)
  196. 0x67, 0x01, 0x00, 0x10, 0x00, // UNIT (SI Lin:Amps)
  197. 0x55, 0x0e, // UNIT_EXPONENT (-2)
  198. 0xb1, 0x02, // FEATURE (Data,Var,Abs)
  199. 0x0b, 0x66, 0x00, 0x85, 0x00, // USAGE (Battery System:RemainingCapacity)
  200. 0x75, 0x18, // REPORT_SIZE (24)
  201. 0x95, 0x01, // REPORT_COUNT (1)
  202. 0x67, 0x01, 0x10, 0x10, 0x00, // UNIT (SI Lin:Battery Capacity)
  203. 0x55, 0x00, // UNIT_EXPONENT (0)
  204. 0x27, 0xfe, 0xff, 0xff, 0x00, // LOGICAL_MAXIMUM (16777214)
  205. 0x81, 0x02, // INPUT (Data,Var,Abs)
  206. 0x0b, 0x68, 0x00, 0x85, 0x00, // USAGE (Battery System:RunTimeToEmpty)
  207. 0x75, 0x10, // REPORT_SIZE (16)
  208. 0x95, 0x01, // REPORT_COUNT (1)
  209. 0x66, 0x01, 0x10, // UNIT (SI Lin:Time)
  210. 0x55, 0x00, // UNIT_EXPONENT (0)
  211. 0x27, 0xfe, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65534)
  212. 0x81, 0x02, // INPUT (Data,Var,Abs)
  213. 0x09, 0x35, // USAGE (PercentLoad)
  214. 0x75, 0x08, // REPORT_SIZE (8)
  215. 0x95, 0x01, // REPORT_COUNT (1)
  216. 0x26, 0xfe, 0x00, // LOGICAL_MAXIMUM (254)
  217. 0x65, 0x00, // UNIT (None)
  218. 0x81, 0x02, // INPUT (Data,Var,Abs)
  219. 0x09, 0x02, // USAGE (PresentStatus)
  220. 0xa1, 0x02, // COLLECTION (Logical)
  221. 0x05, 0x85, // USAGE_PAGE (Battery System)
  222. 0x09, 0xd0, // USAGE (ACPresent)
  223. 0x09, 0x42, // USAGE (BelowRemainingCapacityLimit)
  224. 0x09, 0x44, // USAGE (Charging)
  225. 0x09, 0x45, // USAGE (Discharging)
  226. 0x0b, 0x69, 0x00, 0x84, 0x00, // USAGE (Power Device:ShutdownImminent)
  227. 0x0b, 0x65, 0x00, 0x84, 0x00, // USAGE (Power Device:Overload)
  228. 0x09, 0x00, // USAGE (Undefined)
  229. 0x09, 0x00, // USAGE (Undefined)
  230. 0x75, 0x01, // REPORT_SIZE (1)
  231. 0x95, 0x08, // REPORT_COUNT (8)
  232. 0x25, 0x01, // LOGICAL_MAXIMUM (1)
  233. 0x81, 0x02, // INPUT (Data,Var,Abs)
  234. 0xc0, // END_COLLECTION
  235. 0xc0, // END_COLLECTION
  236. 0xc0 // END_COLLECTION
  237. };
  238. UCHAR rawDesc[] = {
  239. 0x05, 0x80, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x01,
  240. 0x75, 0x08, 0x95, 0x80, 0x15, 0x00, 0x26, 0xFF,
  241. 0x00, 0x09, 0x02, 0xB2, 0x02, 0x01, 0x85, 0x02,
  242. 0x75, 0x10, 0x95, 0x01, 0x15, 0x00, 0x27, 0xFF,
  243. 0xFF, 0x00, 0x00, 0x09, 0x04, 0xB1, 0x02, 0x85,
  244. 0x03, 0x09, 0x09, 0xA1, 0x02, 0x05, 0x81, 0x09,
  245. 0x01, 0x25, 0x01, 0x75, 0x08, 0x95, 0x01, 0xB1,
  246. 0x40, 0xC0, 0x05, 0x82, 0x85, 0x04, 0x09, 0x20,
  247. 0x09, 0x22, 0x09, 0x30, 0x09, 0x32, 0x09, 0x24,
  248. 0x75, 0x08, 0x95, 0x05, 0x26, 0xFF, 0x00, 0xB1,
  249. 0x62, 0x09, 0x20, 0x09, 0x22, 0x09, 0x30, 0x09,
  250. 0x32, 0x09, 0x24, 0x81, 0x62, 0x85, 0x05, 0x09,
  251. 0x26, 0x09, 0x3A, 0x09, 0x40, 0x09, 0x42, 0x09,
  252. 0x44, 0x95, 0x05, 0xB1, 0x62, 0x09, 0x26, 0x09,
  253. 0x3A, 0x09, 0x40, 0x09, 0x42, 0x09, 0x44, 0x81,
  254. 0x62, 0x85, 0x06, 0x09, 0x10, 0x09, 0x12, 0x09,
  255. 0x16, 0x09, 0x18, 0x09, 0x1A, 0x95, 0x05, 0xB1,
  256. 0x62, 0x09, 0x10, 0x09, 0x12, 0x09, 0x16, 0x09,
  257. 0x18, 0x09, 0x1A, 0x81, 0x62, 0x85, 0x07, 0x09,
  258. 0x6C, 0x09, 0x6E, 0x09, 0x70, 0x95, 0x03, 0xB1,
  259. 0x62, 0x09, 0x6C, 0x09, 0x6E, 0x09, 0x70, 0x81,
  260. 0x62, 0x85, 0x08, 0x09, 0x5E, 0xA1, 0x02, 0x05,
  261. 0x81, 0x09, 0x03, 0x75, 0x08, 0x95, 0x01, 0x25,
  262. 0x01, 0xB1, 0x40, 0xC0, 0x05, 0x82, 0x09, 0x60,
  263. 0xA1, 0x02, 0x05, 0x81, 0x09, 0x01, 0x75, 0x08,
  264. 0x25, 0x01, 0xB1, 0x40, 0xC0, 0x05, 0x83, 0x85,
  265. 0x09, 0x09, 0x02, 0x75, 0x08, 0x25, 0x01, 0xB1,
  266. 0x02, 0x09, 0x01, 0xA1, 0x02, 0x05, 0x81, 0x09,
  267. 0x02, 0x09, 0x04, 0x75, 0x08, 0x25, 0x02, 0xB1, 0x40, 0xC0, 0xC0
  268. };
  269. UCHAR anotherRawDesc[] = {
  270. 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 05 01
  271. 0x09, 0x02, // USAGE (Mouse) 09 02
  272. 0xA1, 0x01, // COLLECTION (Application) A1 01
  273. 0x05, 0x09, // USAGE_PAGE (Button) 05 09
  274. 0x19, 0x01, // USAGE_MINIMUM (Button 1) 19 01
  275. 0x29, 0x02, // USAGE_MAXIMUM (Button 2) 29 02
  276. 0x09, 0x0C, // USAGE (Button 12) 09 0C
  277. 0x15, 0x81, // LOGICAL_MINIMUM (-127) 15 81
  278. 0x25, 0x7F, // LOGICAL_MAXIMUM (127) 25 7F
  279. 0x75, 0x08, // REPORT_SIZE (8) 75 08
  280. 0x95, 0x03, // REPORT_COUNT (3) 95 03
  281. 0x81, 0x02, // INPUT (Data,Var,Abs) 81 02
  282. 0xC0 // END_COLLECTION C0
  283. };
  284. UCHAR yetAnotherRawDesc[] = {
  285. 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 05 01
  286. 0x09, 0x02, // USAGE (Mouse) 09 02
  287. 0xA1, 0x01, // COLLECTION (Application) A1 01
  288. 0x05, 0x09, // USAGE_PAGE (Button) 05 09
  289. 0x19, 0x01, // USAGE_MINIMUM (Button 1) 19 01
  290. 0x29, 0x08, // USAGE_MAXIMUM (Button 8)
  291. 0x09, 0x0C, // USAGE (Button 12) 09 0C
  292. 0x19, 0x30, // USAGE_MINIMUM (Button 30) 19 30
  293. 0x29, 0x32, // USAGE_MAXIMUM (Button 32)
  294. 0x15, 0x81, // LOGICAL_MINIMUM (-127) 15 81
  295. 0x25, 0x7F, // LOGICAL_MAXIMUM (127) 25 7F
  296. 0x75, 0x04, // REPORT_SIZE (4)
  297. 0x95, 0x10, // REPORT_COUNT (10) 95 10
  298. 0x81, 0x00, // INPUT (Data,Var,Array) 81 00
  299. 0xC0 // END_COLLECTION C0
  300. };
  301. UCHAR yard[] = {
  302. 0x05, 0x01, 0x09, 0x05, 0x95, 0x00, 0xa1, 0x01,
  303. 0x05, 0x01, 0x09, 0x01, 0xa1, 0x00, 0x09, 0x30,
  304. 0x09, 0x31, 0x15, 0x81, 0x25, 0x7f, 0x35, 0x00,
  305. 0x45, 0xff, 0x66, 0x00, 0x00, 0x75, 0x08, 0x95,
  306. 0x02, 0x81, 0x02, 0xc0, 0x05, 0x09, 0x15, 0x00,
  307. 0x25, 0x01, 0x35, 0x00, 0x45, 0x01, 0x66, 0x00,
  308. 0x00, 0x75, 0x01, 0x95, 0x0a, 0x19, 0x01, 0x29,
  309. 0x0a, 0x81, 0x02, 0x06, 0x00, 0xff, 0x15, 0x00,
  310. 0x25, 0x01, 0x35, 0x00, 0x45, 0x01, 0x66, 0x00,
  311. 0x00, 0x75, 0x01, 0x95, 0x04, 0x19, 0x01, 0x29,
  312. 0x04, 0x81, 0x02, 0x75, 0x01, 0x95, 0x02, 0x81,
  313. 0x01, 0xc0
  314. };
  315. UCHAR yard2[236] = {
  316. 0x05, 0x80, // USAGE_PAGE (Monitor)
  317. 0x09, 0x01, // USAGE (Monitor Control)
  318. 0xa1, 0x01, // COLLECTION (Application)
  319. 0x85, 0x01, // REPORT_ID (1)
  320. 0x75, 0x08, // REPORT_SIZE (8)
  321. 0x95, 0x80, // REPORT_COUNT (128)
  322. 0x15, 0x00, // LOGICAL_MINIMUM (0)
  323. 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
  324. 0x09, 0x02, // USAGE (EDID Information)
  325. 0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
  326. 0x85, 0x02, // REPORT_ID (2)
  327. 0x75, 0x10, // REPORT_SIZE (16)
  328. 0x95, 0x01, // REPORT_COUNT (1)
  329. 0x27, 0xff, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65535)
  330. 0x09, 0x04, // USAGE (VESA Version)
  331. 0xb1, 0x02, // FEATURE (Data,Var,Abs)
  332. 0x85, 0x03, // REPORT_ID (3)
  333. 0x09, 0x09, // USAGE (Sync Type)
  334. 0xa1, 0x02, // COLLECTION (Logical)
  335. 0x05, 0x81, // USAGE_PAGE (Monitor Enumerated Values)
  336. 0x09, 0x01, // USAGE (ENUM 0)
  337. 0x09, 0x02, // USAGE (ENUM 1)
  338. 0x09, 0x03, // USAGE (ENUM 2)
  339. 0x75, 0x08, // REPORT_SIZE (8)
  340. 0x95, 0x01, // REPORT_COUNT (1)
  341. 0x25, 0x02, // LOGICAL_MAXIMUM (2)
  342. 0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
  343. 0xc0, // END_COLLECTION
  344. 0x85, 0x04, // REPORT_ID (4)
  345. 0x05, 0x82, // USAGE_PAGE (VESA Virtual Controls)
  346. 0x09, 0x20, // USAGE (Horizontal Position )
  347. 0x09, 0x22, // USAGE (Horizontal Size )
  348. 0x09, 0x30, // USAGE (Vertical Position )
  349. 0x09, 0x32, // USAGE (Vertical Size )
  350. 0x09, 0x24, // USAGE (Horizontal Pincushion )
  351. 0x75, 0x08, // REPORT_SIZE (8)
  352. 0x95, 0x05, // REPORT_COUNT (5)
  353. 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
  354. 0xb1, 0x22, // FEATURE (Data,Var,Abs,NPrf)
  355. 0x09, 0x20, // USAGE (Horizontal Position )
  356. 0x09, 0x22, // USAGE (Horizontal Size )
  357. 0x09, 0x30, // USAGE (Vertical Position )
  358. 0x09, 0x32, // USAGE (Vertical Size )
  359. 0x09, 0x24, // USAGE (Horizontal Pincushion )
  360. 0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
  361. 0x85, 0x05, // REPORT_ID (5)
  362. 0x09, 0x26, // USAGE (Horizontal Pincushion Balance )
  363. 0x09, 0x3a, // USAGE (Vertical Linearity )
  364. 0x09, 0x40, // USAGE (Parallelogram Distortion)
  365. 0x09, 0x42, // USAGE (Trapezoidal Distortion)
  366. 0x09, 0x44, // USAGE (Tilt)
  367. 0x95, 0x05, // REPORT_COUNT (5)
  368. 0xb1, 0x22, // FEATURE (Data,Var,Abs,NPrf)
  369. 0x09, 0x26, // USAGE (Horizontal Pincushion Balance )
  370. 0x09, 0x3a, // USAGE (Vertical Linearity )
  371. 0x09, 0x40, // USAGE (Parallelogram Distortion)
  372. 0x09, 0x42, // USAGE (Trapezoidal Distortion)
  373. 0x09, 0x44, // USAGE (Tilt)
  374. 0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
  375. 0x85, 0x06, // REPORT_ID (6)
  376. 0x09, 0x10, // USAGE (Brightness)
  377. 0x09, 0x12, // USAGE (Contrast)
  378. 0x09, 0x16, // USAGE (Video Gain Red)
  379. 0x09, 0x18, // USAGE (Video Gain Green)
  380. 0x09, 0x1a, // USAGE (Video Gain Blue)
  381. 0x95, 0x05, // REPORT_COUNT (5)
  382. 0xb1, 0x22, // FEATURE (Data,Var,Abs,NPrf)
  383. 0x09, 0x10, // USAGE (Brightness)
  384. 0x09, 0x12, // USAGE (Contrast)
  385. 0x09, 0x16, // USAGE (Video Gain Red)
  386. 0x09, 0x18, // USAGE (Video Gain Green)
  387. 0x09, 0x1a, // USAGE (Video Gain Blue)
  388. 0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
  389. 0x85, 0x07, // REPORT_ID (7)
  390. 0x09, 0x6c, // USAGE (Video Black Level Red)
  391. 0x09, 0x6e, // USAGE (Video Black Level Green)
  392. 0x09, 0x70, // USAGE (Video Black Level Blue)
  393. 0x95, 0x03, // REPORT_COUNT (3)
  394. 0xb1, 0x22, // FEATURE (Data,Var,Abs,NPrf)
  395. 0x09, 0x6c, // USAGE (Video Black Level Red)
  396. 0x09, 0x6e, // USAGE (Video Black Level Green)
  397. 0x09, 0x70, // USAGE (Video Black Level Blue)
  398. 0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
  399. 0x85, 0x08, // REPORT_ID (8)
  400. 0x09, 0x5e, // USAGE (Input Level Select)
  401. 0xa1, 0x02, // COLLECTION (Logical)
  402. 0x05, 0x81, // USAGE_PAGE (Monitor Enumerated Values)
  403. 0x09, 0x02, // USAGE (ENUM 1)
  404. 0x09, 0x03, // USAGE (ENUM 2)
  405. 0x09, 0x04, // USAGE (ENUM 3)
  406. 0x09, 0x05, // USAGE (ENUM 4)
  407. 0x75, 0x08, // REPORT_SIZE (8)
  408. 0x95, 0x01, // REPORT_COUNT (1)
  409. 0x25, 0x04, // LOGICAL_MAXIMUM (4)
  410. 0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
  411. 0xc0, // END_COLLECTION
  412. 0x09, 0x60, // USAGE (ENUM 95)
  413. 0xa1, 0x02, // COLLECTION (Logical)
  414. 0x05, 0x81, // USAGE_PAGE (Monitor Enumerated Values)
  415. 0x09, 0x01, // USAGE (ENUM 0)
  416. 0x09, 0x02, // USAGE (ENUM 1)
  417. 0x09, 0x04, // USAGE (ENUM 3)
  418. 0x75, 0x08, // REPORT_SIZE (8)
  419. 0x25, 0x06, // LOGICAL_MAXIMUM (6)
  420. 0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
  421. 0xc0, // END_COLLECTION
  422. 0x85, 0x09, // REPORT_ID (9)
  423. 0x05, 0x83, // USAGE_PAGE (VESA Command)
  424. 0x09, 0x00, // USAGE (Undefined)
  425. 0x75, 0x08, // REPORT_SIZE (8)
  426. 0x25, 0x01, // LOGICAL_MAXIMUM (1)
  427. 0x91, 0x02, // OUTPUT (Data,Var,Abs)
  428. 0x09, 0x01, // USAGE (Settings)
  429. 0x75, 0x08, // REPORT_SIZE (8)
  430. 0x25, 0x03, // LOGICAL_MAXIMUM (3)
  431. 0x91, 0x02, // OUTPUT (Data,Var,Abs)
  432. 0xc0 // END_COLLECTION
  433. };
  434. UCHAR anotherDescriptorWhichBreaksTheParser [] = {
  435. 0x09, 0x02, // USAGE (PresentStatus)
  436. 0xa1, 0x02, // COLLECTION (Logical)
  437. 0x05, 0x85, // USAGE_PAGE (Battery System)
  438. 0x09, 0xd0, // USAGE (ACPresent)
  439. 0x09, 0x42, // USAGE (BelowRemainingCapacityLimit)
  440. 0x09, 0x44, // USAGE (Charging)
  441. 0x09, 0x45, // USAGE (Discharging)
  442. 0x0b, 0x69, 0x00, 0x84, 0x00, // USAGE (Power Device:ShutdownImminent)
  443. 0x0b, 0x65, 0x00, 0x84, 0x00, // USAGE (Power Device:Overload)
  444. 0x0b, 0x00, 0x00, 0x84, 0x00, // USAGE (Power Device:Undefined)
  445. 0x0b, 0x00, 0x00, 0x84, 0x00, // USAGE (Power Device:Undefined)
  446. 0x75, 0x01, // REPORT_SIZE (1)
  447. 0x95, 0x08, // REPORT_COUNT (8)
  448. 0x25, 0x01, // LOGICAL_MAXIMUM (1)
  449. 0x81, 0x83, // INPUT (Cnst,Var,Abs,Vol)
  450. 0xc0
  451. };
  452. UCHAR afd [] = {
  453. 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
  454. 0x09, 0x02, // USAGE (Mouse)
  455. 0xa1, 0x01, // COLLECTION (Application)
  456. 0x09, 0x01, // USAGE (Pointer)
  457. 0xa1, 0x00, // COLLECTION (Physical)
  458. 0x05, 0x09, // USAGE_PAGE (Button)
  459. 0x19, 0x01, // USAGE_MINIMUM (Button 1)
  460. 0x29, 0x03, // USAGE_MAXIMUM (Button 3)
  461. 0x15, 0x00, // LOGICAL_MINIMUM (0)
  462. 0x25, 0x01, // LOGICAL_MAXIMUM (1)
  463. 0x95, 0x03, // REPORT_COUNT (3)
  464. 0x75, 0x01, // REPORT_SIZE (1)
  465. 0x81, 0x02, // INPUT (Data,Var,Abs)
  466. 0x95, 0x01, // REPORT_COUNT (1)
  467. 0x75, 0x05, // REPORT_SIZE (5)
  468. 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
  469. 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
  470. 0x09, 0x30, // USAGE (X)
  471. 0x09, 0x31, // USAGE (Y)
  472. 0x15, 0x81, // LOGICAL_MINIMUM (-127)
  473. 0x25, 0x7f, // LOGICAL_MAXIMUM (127)
  474. 0x75, 0x08, // REPORT_SIZE (8)
  475. 0x95, 0x02, // REPORT_COUNT (2)
  476. 0x81, 0x06, // INPUT (Data,Var,Rel)
  477. 0xc0, // END_COLLECTION
  478. 0xc0 // END_COLLECTION
  479. };
  480. UCHAR afd2 [] = {
  481. 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
  482. 0x09, 0x01, // USAGE (Pointer)
  483. 0xa1, 0x01, // COLLECTION (Application)
  484. 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
  485. 0x09, 0x01, // USAGE (Pointer)
  486. 0xa1, 0x00, // COLLECTION (Physical)
  487. 0x09, 0x00, // USAGE (Undefined)
  488. 0x75, 0x08, // REPORT_SIZE (8)
  489. 0x95, 0x01, // REPORT_COUNT (1)
  490. 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
  491. 0x05, 0x09, // USAGE_PAGE (Button)
  492. 0x19, 0x01, // USAGE_MINIMUM (Button 1)
  493. 0x29, 0x01, // USAGE_MAXIMUM (Button 1)
  494. 0x15, 0x00, // LOGICAL_MINIMUM (0)
  495. 0x25, 0x01, // LOGICAL_MAXIMUM (1)
  496. 0x35, 0x00, // PHYSICAL_MINIMUM (0)
  497. 0x45, 0x01, // PHYSICAL_MAXIMUM (1)
  498. 0x66, 0x00, 0x00, // UNIT (None)
  499. 0x75, 0x01, // REPORT_SIZE (1)
  500. 0x95, 0x01, // REPORT_COUNT (1)
  501. 0x81, 0x62, // INPUT (Data,Var,Abs,NPrf,Null)
  502. 0x75, 0x01, // REPORT_SIZE (1)
  503. 0x95, 0x07, // REPORT_COUNT (7)
  504. 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
  505. 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
  506. 0x09, 0x30, // USAGE (X)
  507. 0x09, 0x31, // USAGE (Y)
  508. 0x16, 0x00, 0x00, // LOGICAL_MINIMUM (0)
  509. 0x26, 0x00, 0x10, // LOGICAL_MAXIMUM (4096)
  510. 0x36, 0x00, 0x00, // PHYSICAL_MINIMUM (0)
  511. 0x46, 0xff, 0x7f, // PHYSICAL_MAXIMUM (32767)
  512. 0x66, 0x00, 0x00, // UNIT (None)
  513. 0x75, 0x10, // REPORT_SIZE (16)
  514. 0x95, 0x02, // REPORT_COUNT (2)
  515. 0x81, 0x62, // INPUT (Data,Var,Abs,NPrf,Null)
  516. 0x09, 0x3b, // USAGE (Byte Count)
  517. 0x16, 0x00, 0x00, // LOGICAL_MINIMUM (0)
  518. 0x26, 0x00, 0x01, // LOGICAL_MAXIMUM (256)
  519. 0x36, 0x00, 0x00, // PHYSICAL_MINIMUM (0)
  520. 0x46, 0x00, 0x01, // PHYSICAL_MAXIMUM (256)
  521. 0x66, 0x00, 0x00, // UNIT (None)
  522. 0x75, 0x10, // REPORT_SIZE (16)
  523. 0x95, 0x01, // REPORT_COUNT (1)
  524. 0x81, 0x62, // INPUT (Data,Var,Abs,NPrf,Null)
  525. 0xc0, // END_COLLECTION
  526. 0xc0 // END_COLLECTION
  527. };
  528. UCHAR adwbtp2 [] = {
  529. 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
  530. 0x09, 0x06, // USAGE (Keyboard)
  531. 0xa1, 0x01, // COLLECTION (Application)
  532. 0x05, 0x07, // USAGE_PAGE (Keyboard)
  533. 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
  534. 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
  535. 0x15, 0x00, // LOGICAL_MINIMUM (0)
  536. 0x25, 0x01, // LOGICAL_MAXIMUM (1)
  537. 0x75, 0x01, // REPORT_SIZE (1)
  538. 0x95, 0x08, // REPORT_COUNT (8)
  539. 0x81, 0x02, // INPUT (Data,Var,Abs)
  540. 0x75, 0x08, // REPORT_SIZE (8)
  541. 0x95, 0x01, // REPORT_COUNT (1)
  542. 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
  543. 0x95, 0x05, // REPORT_COUNT (5)
  544. 0x75, 0x01, // REPORT_SIZE (1)
  545. 0x05, 0x08, // USAGE_PAGE (LEDs)
  546. 0x19, 0x01, // USAGE_MINIMUM (Num Lock)
  547. 0x29, 0x03, // USAGE_MAXIMUM (Scroll Lock)
  548. 0x29, 0x03, // USAGE_MAXIMUM (Scroll Lock)
  549. 0x91, 0x02, // OUTPUT (Data,Var,Abs)
  550. 0x95, 0x01, // REPORT_COUNT (1)
  551. 0x75, 0x03, // REPORT_SIZE (3)
  552. 0x75, 0x03, // REPORT_SIZE (3)
  553. 0x91, 0x01, // OUTPUT (Cnst,Ary,Abs)
  554. 0x95, 0x06, // REPORT_COUNT (6)
  555. 0x75, 0x08, // REPORT_SIZE (8)
  556. 0x15, 0x00, // LOGICAL_MINIMUM (0)
  557. 0x25, 0x65, // LOGICAL_MAXIMUM (101)
  558. 0x05, 0x07, // USAGE_PAGE (Keyboard)
  559. 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
  560. 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
  561. 0x81, 0x00, // INPUT (Data,Ary,Abs)
  562. 0x05, 0x07, // USAGE_PAGE (Keyboard)
  563. 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
  564. 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
  565. 0xc0 // END_COLLECTION
  566. };
  567. UCHAR vendorDescriptorsSometimeRequireSpecialCode[] = {
  568. 0x05, 0x01, 0x09, 0x04,
  569. 0xA1, 0x01, 0x85, 0x01,
  570. 0x09, 0x01, 0xA1, 0x00,
  571. 0x95, 0x01, 0x75, 0x04,
  572. 0x15, 0x00, 0x25, 0x07,
  573. 0x35, 0x00, 0x46, 0x3B,
  574. 0x01, 0x66, 0x14, 0x00,
  575. 0x09, 0x39, 0x81, 0x42,
  576. 0x95, 0x04, 0x75, 0x01,
  577. 0x15, 0x00, 0x25, 0x01,
  578. 0x35, 0x00, 0x45, 0x01,
  579. 0x66, 0x00, 0x00, 0x05,
  580. 0x09, 0x19, 0x01, 0x29,
  581. 0x04, 0xA4, 0x81, 0x02,
  582. 0x95, 0x02, 0x75, 0x0A,
  583. 0x16, 0x00, 0xFE, 0x26,
  584. 0xFF, 0x01, 0x35, 0x00,
  585. 0x46, 0xFF, 0x03, 0x05,
  586. 0x01, 0x09, 0x30, 0x09,
  587. 0x31, 0x81, 0x02, 0x95,
  588. 0x04, 0x75, 0x01, 0x81,
  589. 0x01, 0xC0, 0xB4, 0x05,
  590. 0x09, 0x95, 0x07, 0x19,
  591. 0x05, 0x29, 0x0B, 0x81,
  592. 0x02, 0x95, 0x01, 0x81,
  593. 0x01, 0x75, 0x06, 0x15,
  594. 0xE0, 0x25, 0x1F, 0x35,
  595. 0x00, 0x45, 0x3F, 0x05,
  596. 0x01, 0x09, 0x36, 0x81,
  597. 0x02, 0x06, 0x01, 0xFF,
  598. 0x0A, 0x01, 0x00, 0x75,
  599. 0x02, 0x81, 0x02, 0xC0
  600. };
  601. UCHAR ReportDescriptor[] = {
  602. 0x05, 0x84, // USAGE_PAGE (Power Device)
  603. 0x09, 0x04, // USAGE (UPS)
  604. 0xa1, 0x01, // COLLECTION (Application)
  605. 0x05, 0x84, // USAGE_PAGE (Power Device)
  606. 0x09, 0x24, // USAGE (PowerSummary)
  607. 0xa1, 0x00, // COLLECTION (Physical)
  608. 0x05, 0x85, // USAGE_PAGE (Battery System)
  609. 0x85, 0x01, // REPORT_ID (1)
  610. 0x67, 0x01, 0x10, 0x10, 0x00, // UNIT (SI Lin:Battery Capacity)
  611. 0x95, 0x03, // REPORT_COUNT (1)
  612. 0x75, 0x03, // REPORT_SIZE (1)
  613. 0x09, 0x65, // USAGE
  614. 0xb1, 0x02, // FEATURE (Data,Var,Abs)
  615. 0x09, 0x66, // USAGE (RemainingCapacity)
  616. 0x95, 0x01, // REPORT_COUNT (1)
  617. 0x75, 0x18, // REPORT_SIZE (24)
  618. 0xb1, 0x02, // FEATURE (Data,Var,Abs)
  619. 0x09, 0x67, // USAGE
  620. 0x75, 0x07, // REPORT_SIZE (7)
  621. 0xb1, 0x02, // FEATURE (Data,Var,Abs)
  622. 0x09, 0x68, // USAGE
  623. 0x75, 0x18, // REPORT_SIZE (24)
  624. 0xb1, 0x02, // FEATURE (Data,Var,Abs)
  625. 0xc0, // END_COLLECTION
  626. 0xc0 // END_COLLECTION
  627. };
  628. UCHAR Rd[] = {
  629. 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 05 01
  630. 0x09, 0x06, // USAGE (Keyboard)
  631. 0xA1, 0x01, // COLLECTION (Application)
  632. 0x09, 0x30, // USAGE (X)
  633. 0x75, 0x08, // REPORT_SIZE (8)
  634. 0x95, 0x01, // REPORT_COUNT (1)
  635. 0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
  636. 0x09, 0x31, // USAGE (Y)
  637. 0x95, 0x02, // REPORT_COUNT (2)
  638. 0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
  639. 0x09, 0x32, // USAGE (Z)
  640. 0x09, 0x38, // USAGE (Wheel)
  641. 0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
  642. 0x19, 0x33, // USAGE Min (Rx)
  643. 0x29, 0x34, // USAGE Max (Ry)
  644. 0x95, 0x04, // REPORT_COUNT (4)
  645. 0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
  646. 0x09, 0x35, // USAGE (Rz)
  647. 0x09, 0x36, // USAGE (Slider)
  648. 0x75, 0x07, // REPORT_SIZE (7)
  649. 0x95, 0x04, // REPORT_COUNT (4)
  650. 0x81, 0x02, // INPUT (Data,Var,Abs)
  651. 0x95, 0x01, // REPORT_COUNT (1)
  652. 0x75, 0x04, // REPORT_SIZE (4)
  653. 0x81, 0x01, // INPUT (Cnst,Ary,Abs)
  654. 0xC0 // END_COLLECTION
  655. };
  656. UCHAR Rd2 [50] = {
  657. 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
  658. 0x09, 0x02, // USAGE (Mouse)
  659. 0xa1, 0x01, // COLLECTION (Application)
  660. 0x85, 0x01, // REPORT_ID (1)
  661. 0x75, 0x0F, // REPORT_SIZE (16)
  662. 0x95, 0x01, // REPORT_COUNT (1)
  663. 0x15, 0x0b, // LOGICAL_MINIMUM (11)
  664. 0x25, 0x1c, // LOGICAL_MAXIMUM (28)
  665. 0x09, 0x30, // USAGE (X)
  666. 0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
  667. 0x85, 0x02, // REPORT_ID (2)
  668. 0x09, 0x32, // USAGE (Z)
  669. 0x75, 0x08, // REPORT_SIZE (8)
  670. 0x95, 0x01, // REPORT_COUNT (1)
  671. 0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
  672. 0x15, 0x00, // LOGICAL_MINIMUM (0)
  673. 0x81, 0x02, // INPUT (Data,Var,Abs)
  674. 0x85, 0x01, // REPORT_ID (1)
  675. 0x75, 0x09, // REPORT_SIZE (8)
  676. 0x95, 0x01, // REPORT_COUNT (1)
  677. 0x15, 0x00, // LOGICAL_MINIMUM (0)
  678. 0x25, 0x03, // LOGICAL_MAXIMUM (3)
  679. 0x09, 0x31, // USAGE (Y)
  680. 0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
  681. 0xc0 // END_COLLECTION
  682. };
  683. UCHAR Rd3[40] = {
  684. 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
  685. 0x09, 0x02, // USAGE (Mouse)
  686. 0xa1, 0x01, // COLLECTION (Application)
  687. 0x85, 0x01, // REPORT_ID (1)
  688. 0x75, 0x10, // REPORT_SIZE (16)
  689. 0x95, 0x01, // REPORT_COUNT (1)
  690. 0x15, 0x0b, // LOGICAL_MINIMUM (11)
  691. 0x25, 0x1c, // LOGICAL_MAXIMUM (28)
  692. 0x09, 0x30, // USAGE (X)
  693. 0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
  694. 0xc0, // END_COLLECTION
  695. 0x09, 0x06, // USAGE (Keyboard)
  696. 0xa1, 0x01, // COLLECTION (Application)
  697. 0x85, 0x01, // REPORT_ID (1)
  698. 0x75, 0x08, // REPORT_SIZE (8)
  699. 0x95, 0x01, // REPORT_COUNT (1)
  700. 0x15, 0x00, // LOGICAL_MINIMUM (0)
  701. 0x25, 0x40, // LOGICAL_MAXIMUM (64)
  702. 0x09, 0x31, // USAGE (Y)
  703. 0x81, 0x02, // INPUT (Data,Var,Abs)
  704. 0xc0 // END_COLLECTION
  705. };
  706. UCHAR Rd4[] = {
  707. 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x01,
  708. 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01,
  709. 0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03,
  710. 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05,
  711. 0x81, 0x01, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31,
  712. 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 0x95, 0x02,
  713. 0x81, 0x06, 0xc0, 0xc0, 0x05, 0x01, 0x09, 0x80,
  714. 0xa1, 0x01, 0x85, 0x02, 0x19, 0x81, 0x29, 0x83,
  715. 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x03,
  716. 0x81, 0x06, 0x95, 0x05, 0x81, 0x01, 0x75, 0x08,
  717. 0x95, 0x02, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09,
  718. 0x01, 0xa1, 0x01, 0x85, 0x03, 0x09, 0xcd, 0x09,
  719. 0xb7, 0x09, 0xb5, 0x09, 0xb6, 0x0a, 0x23, 0x02,
  720. 0x0a, 0x8a, 0x01, 0x15, 0x00, 0x25, 0x01, 0x75,
  721. 0x01, 0x95, 0x06, 0x81, 0x06, 0x75, 0x01, 0x95,
  722. 0x02, 0x81, 0x01, 0x09, 0xe2, 0x09, 0xe9, 0x09,
  723. 0xea, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95,
  724. 0x03, 0x81, 0x06, 0x75, 0x01, 0x95, 0x05, 0x81,
  725. 0x01, 0x75, 0x08, 0x95, 0x01, 0x81, 0x01, 0xc0,
  726. 0x06, 0x46, 0xff, 0x09, 0x04, 0xa1, 0x01, 0x85,
  727. 0x04,
  728. 0x09, 0xcd, // here we have 6 usages in a row.
  729. 0x09, 0xb7,
  730. 0x09, 0xb5,
  731. 0x09, 0xb6,
  732. 0x0a, 0x23, 0x02,
  733. 0x0a, 0x8a, 0x01,
  734. 0x15, 0x00, 0x25, 0x01,
  735. 0x75, 0x01, 0x95, 0x06,
  736. 0x81, 0x06, // here we have a main item of count 6 that uses them all up.
  737. 0x75, 0x01, 0x95, 0x02, 0x81, 0x01, // here we have a constant input item with no usages.
  738. 0x75, 0x08, 0x95, 0x02, 0x81, 0x01, // here we have another constant input item with no usages; then usage min 0, max FF,
  739. 0x19, 0x00, 0x29, 0xff, // usage Min 00, Max FF
  740. 0x15, 0x81, 0x25, 0x7f, // logical min -127, max 127
  741. 0x75, 0x08, 0x95, 0x01, // size 8, count 1
  742. 0xb1, 0x02, 0xc0 // finally a feature item.
  743. };
  744. UCHAR Rd5[] = {
  745. 0x05, 0x01, 0x09, 0x06, 0xA1, 0x01, // Top level collection
  746. 0x05, 0x07, 0x19, 0xE0, 0x29, 0xE7, // Page 5, Min e0, max e7
  747. 0x15, 0x00, 0x25, 0x01, // log min/max
  748. 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, // size 1, Count 8, MAIN
  749. 0x75, 0x08, 0x95, 0x01, 0x81, 0x01, // size 8, Count 1, MAIN Cnst.
  750. 0x95, 0x05, 0x75, 0x01, // Count 5, size 1
  751. 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x29, 0x03, // Page 5, Min 1, Max 3
  752. // max 3, A 2ND Mi/Ma!
  753. 0x91, 0x02, // Output
  754. 0x95, 0x01, 0x75, 0x03, 0x75, 0x03, // Count 1, Size 3
  755. 0x91, 0x01, // Output Cnst.
  756. 0x95, 0x06, 0x75, 0x08, // Count 6, Size 8
  757. 0x15, 0x00, 0x25, 0x65, // log min/max
  758. 0x05, 0x07, 0x19, 0x00, 0x29, 0x65, // Page 7, min 0, max 65
  759. 0x81, 0x00, // Array
  760. 0xC0
  761. };
  762. UCHAR Rd6[] = {
  763. 0x05, 0x01, 0x09, 0x06, 0xA1, 0x01, // Top level Collection
  764. 0x05, 0x07, 0x19, 0xE0, 0x29, 0xE7, // Page 5, Min e0, max e7
  765. 0x15, 0x00, 0x25, 0x01, // log min/max
  766. 0x75, 0x01, 0x95, 0x08, 0x81, 0x02, // size 1, Cnt 8, MAIN
  767. 0x95, 0x01, 0x75, 0x08, 0x81, 0x01, // size 8, Cnt 1, MAIN
  768. 0x95, 0x05, 0x75, 0x01, // Count 5, size 1
  769. 0x05, 0x08, 0x19, 0x01, 0x29, 0x03, // page 5, min 1, max 3, NO DOUBLE
  770. 0x91, 0x02, // output
  771. 0x95, 0x01, 0x75, 0x03, // Count 1, Size 3
  772. 0x91, 0x01, // output cnst.
  773. 0x95, 0x06, 0x75, 0x08, // Count 6, Size 8
  774. 0x15, 0x00, 0x25, 0x65, //log min/max
  775. 0x05, 0x07, 0x19, 0x00, 0x29, 0x65, // Page 7, min 0 max 65
  776. 0x81, 0x00, // Array
  777. 0xC0
  778. };
  779. UCHAR Rd7[] = {
  780. 0x05, 0x03, 0x09, 0x03, 0xa1, 0x01, 0x05, 0x01,
  781. 0x0a, 0xc8, 0x60, 0x05, 0x03, 0x0a, 0x6a, 0x32,
  782. 0x85, 0x2d, 0x16, 0xcb, 0x24, 0x26, 0xae, 0x2e,
  783. 0x75, 0x0e, 0x95, 0x05, 0x91, 0x22, 0x05, 0x02,
  784. 0x1a, 0xfe, 0x31, 0x2a, 0x01, 0x32, 0x85, 0x2d,
  785. 0x16, 0x6b, 0xff, 0x25, 0x62, 0x75, 0x09, 0x95,
  786. 0x05, 0x81, 0x22, 0x05, 0x01, 0x0a, 0x86, 0x2c,
  787. 0x85, 0x2d, 0x16, 0x5c, 0xfd, 0x26, 0xf5, 0x02,
  788. 0x75, 0x0c, 0x95, 0x07, 0x91, 0x22, 0x05, 0x03,
  789. 0x0a, 0xff, 0x52, 0x05, 0x02, 0x0a, 0x60, 0x62,
  790. 0x85, 0x2d, 0x15, 0xe9, 0x25, 0x16, 0x75, 0x06,
  791. 0x95, 0x10, 0xb1, 0x22, 0x05, 0x01, 0x0a, 0xf8,
  792. 0x5d, 0x05, 0x02, 0x1a, 0xc4, 0x69, 0x2a, 0xc7,
  793. 0x69, 0x05, 0x01, 0x0a, 0x65, 0x34, 0x05, 0x03,
  794. 0x0a, 0x22, 0x6d, 0x05, 0x01, 0x0a, 0x01, 0x3a,
  795. 0x05, 0x03, 0x0a, 0x04, 0x24, 0x05, 0x01, 0x0a,
  796. 0xa9, 0x69, 0x85, 0x2d, 0x16, 0x39, 0xf1, 0x26,
  797. 0x48, 0x04, 0x75, 0x0e, 0x95, 0x0d, 0x81, 0x22,
  798. 0x05, 0x01, 0x0a, 0xbc, 0x33, 0x05, 0x03, 0x1a,
  799. 0x35, 0x1e, 0x2a, 0x36, 0x1e, 0x85, 0x2d, 0x15,
  800. 0x03, 0x25, 0x07, 0x75, 0x03, 0x95, 0x0e, 0x81,
  801. 0x22, 0x75, 0x03, 0x95, 0x01, 0x85, 0x2d, 0x81,
  802. 0x01, 0x75, 0x06, 0x95, 0x01, 0x85, 0x2d, 0x91,
  803. 0x01, 0xc0, 0x05, 0x01, 0x09, 0x03, 0xa1, 0x01,
  804. 0x05, 0x01, 0x1a, 0xe6, 0x79, 0x2a, 0xe9, 0x79,
  805. 0x05, 0x01, 0x0a, 0x23, 0x67, 0x05, 0x03, 0x1a,
  806. 0x86, 0x03, 0x2a, 0x87, 0x03, 0x05, 0x03, 0x1a,
  807. 0x21, 0x25, 0x2a, 0x23, 0x25, 0x85, 0x75, 0x16,
  808. 0x09, 0x02, 0x26, 0x0b, 0x35, 0x75, 0x0e, 0x95,
  809. 0x0a, 0x81, 0x22, 0x05, 0x01, 0x0a, 0x80, 0x11,
  810. 0x05, 0x02, 0x0a, 0x32, 0x1b, 0x05, 0x02, 0x0a,
  811. 0x7f, 0x61, 0x85, 0x75, 0x16, 0x92, 0x0e, 0x26,
  812. 0x26, 0x0f, 0x75, 0x0c, 0x95, 0x03, 0xb1, 0x22,
  813. 0x05, 0x02, 0x0a, 0xe1, 0x10, 0x05, 0x01, 0x0a,
  814. 0xce, 0x61, 0x05, 0x01, 0x0a, 0xf2, 0x20, 0x05,
  815. 0x03, 0x1a, 0x63, 0x6d, 0x2a, 0x65, 0x6d, 0x05,
  816. 0x01, 0x0a, 0x3b, 0x17, 0x85, 0x75, 0x16, 0x66,
  817. 0x02, 0x26, 0x00, 0x04, 0x75, 0x0b, 0x95, 0x0b,
  818. 0x91, 0x22, 0x05, 0x03, 0x1a, 0xd1, 0x74, 0x2a,
  819. 0xd5, 0x74, 0x05, 0x02, 0x0a, 0xbd, 0x5e, 0x05,
  820. 0x02, 0x0a, 0x1a, 0x4f, 0x05, 0x02, 0x0a, 0x43,
  821. 0x31, 0x85, 0x75, 0x16, 0xfc, 0x14, 0x26, 0xc9,
  822. 0x33, 0x75, 0x0f, 0x95, 0x0f, 0x81, 0x22, 0x05,
  823. 0x03, 0x1a, 0x18, 0x0b, 0x2a, 0x19, 0x0b, 0x05,
  824. 0x03, 0x0a, 0xb6, 0x5b, 0x05, 0x01, 0x0a, 0x3f,
  825. 0x4b, 0x05, 0x02, 0x0a, 0xa5, 0x21, 0x05, 0x02,
  826. 0x0a, 0x3b, 0x55, 0x05, 0x02, 0x1a, 0x2f, 0x0b,
  827. 0x2a, 0x31, 0x0b, 0x05, 0x03, 0x1a, 0x9a, 0x0a,
  828. 0x2a, 0x9d, 0x0a, 0x85, 0x75, 0x16, 0xb6, 0x01,
  829. 0x26, 0x12, 0x02, 0x75, 0x0d, 0x95, 0x0d, 0x81,
  830. 0x22, 0x05, 0x01, 0x1a, 0xcb, 0x7a, 0x2a, 0xcc,
  831. 0x7a, 0x85, 0x75, 0x15, 0x07, 0x25, 0x08, 0x75,
  832. 0x05, 0x95, 0x03, 0x81, 0x22, 0x05, 0x03, 0x0a,
  833. 0x24, 0x6e, 0x05, 0x03, 0x1a, 0xb0, 0x77, 0x2a,
  834. 0xb2, 0x77, 0x85, 0x75, 0x16, 0xc5, 0xed, 0x26,
  835. 0x7b, 0x5d, 0x75, 0x10, 0x95, 0x0f, 0x91, 0x22,
  836. 0x05, 0x02, 0x1a, 0x6e, 0x1e, 0x2a, 0x71, 0x1e,
  837. 0x05, 0x03, 0x1a, 0x83, 0x3d, 0x2a, 0x84, 0x3d,
  838. 0x05, 0x02, 0x1a, 0x13, 0x5d, 0x2a, 0x14, 0x5d,
  839. 0x85, 0x75, 0x15, 0x13, 0x25, 0x17, 0x75, 0x06,
  840. 0x95, 0x0d, 0x91, 0x22, 0x05, 0x02, 0x1a, 0x68,
  841. 0x5d, 0x2a, 0x6a, 0x5d, 0x05, 0x03, 0x1a, 0x2f,
  842. 0x21, 0x2a, 0x30, 0x21, 0x05, 0x02, 0x0a, 0xbd,
  843. 0x04, 0x85, 0x75, 0x16, 0x5c, 0x14, 0x26, 0x43,
  844. 0x19, 0x75, 0x0d, 0x95, 0x08, 0xb1, 0x22, 0x05,
  845. 0x01, 0x0a, 0xf1, 0x57, 0x05, 0x02, 0x1a, 0x00,
  846. 0x64, 0x2a, 0x09, 0x64, 0x05, 0x03, 0x1a, 0x43,
  847. 0x30, 0x2a, 0x46, 0x30, 0x85, 0x75, 0x15, 0xd4,
  848. 0x25, 0x37, 0x75, 0x07, 0x95, 0x10, 0x81, 0x22,
  849. 0x75, 0x03, 0x95, 0x01, 0x85, 0x75, 0x81, 0x01,
  850. 0x75, 0x01, 0x95, 0x01, 0x85, 0x75, 0x91, 0x01,
  851. 0x75, 0x04, 0x95, 0x01, 0x85, 0x75, 0xb1, 0x01,
  852. 0xc0, 0x05, 0x02, 0x09, 0x03, 0xa1, 0x01, 0x05,
  853. 0x03, 0x1a, 0xbc, 0x47, 0x2a, 0xc0, 0x47, 0x85,
  854. 0x86, 0x16, 0x69, 0xfd, 0x26, 0xc0, 0x02, 0x75,
  855. 0x0b, 0x95, 0x06, 0xb1, 0x22, 0x75, 0x06, 0x95,
  856. 0x01, 0x85, 0x86, 0xb1, 0x01, 0xc0, 0x05, 0x01,
  857. 0x09, 0x01, 0xa1, 0x01, 0x05, 0x01, 0x1a, 0x57,
  858. 0x52, 0x2a, 0x58, 0x52, 0x85, 0x6c, 0x16, 0x46,
  859. 0x1c, 0x26, 0xbd, 0x1c, 0x75, 0x0e, 0x95, 0x03,
  860. 0xb1, 0x22, 0x05, 0x02, 0x0a, 0xbd, 0x43, 0x05,
  861. 0x02, 0x0a, 0x3c, 0x4e, 0x05, 0x03, 0x1a, 0x2a,
  862. 0x20, 0x2a, 0x2b, 0x20, 0x05, 0x02, 0x1a, 0xd7,
  863. 0x0b, 0x2a, 0xd9, 0x0b, 0x85, 0x6c, 0x15, 0x05,
  864. 0x25, 0x07, 0x75, 0x03, 0x95, 0x07, 0x91, 0x22,
  865. 0x05, 0x01, 0x0a, 0x1f, 0x77, 0x05, 0x03, 0x0a,
  866. 0x20, 0x30, 0x85, 0x6c, 0x15, 0x08, 0x25, 0x0c,
  867. 0x75, 0x05, 0x95, 0x04, 0xb1, 0x22, 0x05, 0x01,
  868. 0x1a, 0xa8, 0x53, 0x2a, 0xa9, 0x53, 0x05, 0x01,
  869. 0x0a, 0x7c, 0x5d, 0x05, 0x02, 0x0a, 0x7b, 0x4c,
  870. 0x85, 0x6c, 0x15, 0x67, 0x25, 0x6f, 0x75, 0x08,
  871. 0x95, 0x0f, 0x81, 0x22, 0x05, 0x03, 0x0a, 0xde,
  872. 0x64, 0x85, 0x6c, 0x15, 0xbe, 0x25, 0xfb, 0x75,
  873. 0x08, 0x95, 0x05, 0x91, 0x22, 0x05, 0x03, 0x1a,
  874. 0xf5, 0x69, 0x2a, 0xf6, 0x69, 0x85, 0x6c, 0x15,
  875. 0xee, 0x25, 0xf4, 0x75, 0x08, 0x95, 0x04, 0x91,
  876. 0x22, 0x05, 0x02, 0x0a, 0x60, 0x24, 0x05, 0x03,
  877. 0x1a, 0xcc, 0x6e, 0x2a, 0xcd, 0x6e, 0x85, 0x6c,
  878. 0x16, 0xbf, 0xfd, 0x26, 0xa1, 0x0f, 0x75, 0x0d,
  879. 0x95, 0x06, 0xb1, 0x22, 0x05, 0x01, 0x0a, 0x17,
  880. 0x78, 0x05, 0x02, 0x0a, 0x66, 0x72, 0x85, 0x6c,
  881. 0x16, 0x34, 0x02, 0x26, 0x4c, 0x02, 0x75, 0x0a,
  882. 0x95, 0x02, 0x91, 0x22, 0x05, 0x01, 0x0a, 0xf7,
  883. 0x41, 0x05, 0x03, 0x1a, 0xf2, 0x55, 0x2a, 0xf3,
  884. 0x55, 0x05, 0x02, 0x0a, 0x4e, 0x5e, 0x85, 0x6c,
  885. 0x16, 0x27, 0x2b, 0x26, 0x1c, 0x3e, 0x75, 0x0f,
  886. 0x95, 0x0a, 0x81, 0x22, 0x05, 0x01, 0x1a, 0xa0,
  887. 0x6c, 0x2a, 0xa1, 0x6c, 0x85, 0x6c, 0x16, 0x06,
  888. 0x01, 0x26, 0xe3, 0x02, 0x75, 0x0b, 0x95, 0x0e,
  889. 0x91, 0x22, 0x75, 0x02, 0x95, 0x01, 0x85, 0x6c,
  890. 0x81, 0x01, 0x75, 0x05, 0x95, 0x01, 0x85, 0x6c,
  891. 0x91, 0x01, 0x75, 0x04, 0x95, 0x01, 0x85, 0x6c,
  892. 0xb1, 0x01, 0xc0
  893. };
  894. UCHAR Rd8 [] = {
  895. 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x01,
  896. 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01,
  897. 0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03,
  898. 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05,
  899. 0x81, 0x03, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31,
  900. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  901. 0xcd, 0xef, 0x08, 0x1d, 0x00, 0x06, 0x80, 0x01,
  902. 0x55, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
  903. 0x00, 0x00, 0x00, 0x03, 0xa0, 0x00, 0x00, 0x00,
  904. 0x00, 0x00, 0x00, 0x00, 0x44, 0x03, 0xff, 0x01,
  905. 0x00, 0x00, 0x00, 0x00, 0x00
  906. };
  907. UCHAR Rd9 [] = {
  908. 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x01,
  909. 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01,
  910. 0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03,
  911. 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05,
  912. 0x81, 0x03, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31,
  913. 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08,
  914. 0x95, 0x03, 0x81, 0x06, 0xc0, 0xc0, 0x05, 0x01,
  915. 0x09, 0x80, 0xa1, 0x01, 0x85, 0x02, 0x09, 0x83,
  916. 0x09, 0x82, 0x09, 0x81, 0x25, 0x01, 0x15, 0x00,
  917. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  918. 0xcd, 0xef, 0x05, 0x00, 0x00
  919. };
  920. HIDP_DATA data [] = { {2,0,1},
  921. {2,0,0},
  922. };
  923. ULONG status, colLen, repLen;
  924. HIDP_DEVICE_DESC devDesc;
  925. USAGE usages [] = { 0x4, 0x2, 0x30, 0x32, 0x32, 0x07 };
  926. UCHAR report [0x8];
  927. ULONG usagesLength = sizeof usages / sizeof (USAGE);
  928. memset (report, 0, sizeof report);
  929. status = HidP_GetCollectionDescription (Rd9,
  930. sizeof Rd9,
  931. 0,
  932. &devDesc);
  933. for (i=0; i<devDesc.CollectionDescLength; i++) {
  934. printf("______________Collection %d___________\n", i);
  935. printf("----------------VV %d VV---------------\n", i);
  936. flags.Flags = 0xF;
  937. HID_DumpPpd (devDesc.CollectionDesc[i].PreparsedData, flags);
  938. printf("----------------- %d ------------------\n", i);
  939. flags.Flags = 0xFF;
  940. HID_DumpPpd (devDesc.CollectionDesc[i].PreparsedData, flags);
  941. printf("---------------^^ %d ^^----------------\n", i);
  942. }
  943. #if 0
  944. HidP_SetUsageValue (HidP_Feature,
  945. (USAGE) 0x85,
  946. 0,
  947. 0x66,
  948. 0xFFFFFFFF,
  949. devDesc.CollectionDesc[i].PreparsedData,
  950. report,
  951. sizeof report);
  952. HidP_GetUsageValue (HidP_Feature,
  953. (USAGE) 0x85,
  954. 0,
  955. 0x66,
  956. &i,
  957. devDesc.CollectionDesc[i].PreparsedData,
  958. report,
  959. sizeof report);
  960. i = 0;
  961. HidP_SetUsageValue (HidP_Feature,
  962. (USAGE) 0x85,
  963. 0,
  964. 0x67,
  965. 0xFFFFFFFF,
  966. devDesc.CollectionDesc[i].PreparsedData,
  967. report,
  968. sizeof report);
  969. HidP_GetUsageValue (HidP_Feature,
  970. (USAGE) 0x85,
  971. 0,
  972. 0x67,
  973. &i,
  974. devDesc.CollectionDesc[i].PreparsedData,
  975. report,
  976. sizeof report);
  977. i = 0;
  978. HidP_SetUsageValue (HidP_Feature,
  979. (USAGE) 0x85,
  980. 0,
  981. 0x68,
  982. 0xFFFFFFFF,
  983. devDesc.CollectionDesc[i].PreparsedData,
  984. report,
  985. sizeof report);
  986. HidP_GetUsageValue (HidP_Feature,
  987. (USAGE) 0x85,
  988. 0,
  989. 0x68,
  990. &i,
  991. devDesc.CollectionDesc[i].PreparsedData,
  992. report,
  993. sizeof report);
  994. HidP_UnsetUsages (HidP_Input,
  995. (USHORT) 0x09,
  996. 0,
  997. usages,
  998. &usagesLength,
  999. devDesc.CollectionDesc[i].PreparsedData,
  1000. report,
  1001. sizeof report);
  1002. usagesLength = 2;
  1003. HidP_SetData (HidP_Feature,
  1004. data,
  1005. &usagesLength,
  1006. devDesc.CollectionDesc[i].PreparsedData,
  1007. report,
  1008. sizeof report);
  1009. #endif
  1010. printf("Hello world\n");
  1011. }
  1012. VOID
  1013. HID_DumpChannel (
  1014. PHIDP_CHANNEL_DESC Channel,
  1015. HID_PPD_FLAGS Flags
  1016. )
  1017. {
  1018. printf ("-------CHANNEL---------\n");
  1019. printf ("P %x ID %x Col %x Sz %x Cnt %x UMin %x UMax %x ",
  1020. Channel->UsagePage,
  1021. Channel->ReportID,
  1022. Channel->LinkCollection,
  1023. Channel->ReportSize,
  1024. Channel->ReportCount,
  1025. Channel->Range.UsageMin,
  1026. Channel->Range.UsageMax);
  1027. if (Channel->MoreChannels) {
  1028. printf ("MoreChannels ");
  1029. }
  1030. if (Channel->IsConst) {
  1031. printf ("Const ");
  1032. }
  1033. if (Channel->IsButton) {
  1034. printf ("Button ");
  1035. } else {
  1036. printf ("Value ");
  1037. }
  1038. if (Channel->IsAbsolute) {
  1039. printf ("Absolute ");
  1040. }
  1041. if (Channel->IsAlias) {
  1042. printf ("ALIAS! ");
  1043. }
  1044. printf ("\n");
  1045. if (Flags.FullChannelListing) {
  1046. printf ("LinkUP %x LinkU %x SMin %x SMax %x "
  1047. "DMin %x DMax %x IndexMin %x IndexMax %x\n",
  1048. Channel->LinkUsagePage,
  1049. Channel->LinkUsage,
  1050. Channel->Range.StringMin,
  1051. Channel->Range.StringMax,
  1052. Channel->Range.DesignatorMin,
  1053. Channel->Range.DesignatorMax,
  1054. Channel->Range.DataIndexMin,
  1055. Channel->Range.DataIndexMax);
  1056. if (!Channel->IsButton) {
  1057. if (Channel->Data.HasNull) {
  1058. printf ("Has Null ");
  1059. }
  1060. printf ("LMin %x LMax %x PMin %x PMax %x \n",
  1061. Channel->Data.LogicalMin,
  1062. Channel->Data.LogicalMax,
  1063. Channel->Data.PhysicalMin,
  1064. Channel->Data.PhysicalMax);
  1065. }
  1066. }
  1067. if (Flags.ReportLocation) {
  1068. printf ("ByteOffset %x BitOffset %x BitLength %x ByteEnd %x\n",
  1069. Channel->ByteOffset,
  1070. Channel->BitOffset,
  1071. Channel->BitLength,
  1072. Channel->ByteEnd);
  1073. }
  1074. }
  1075. VOID
  1076. HID_DumpLink (
  1077. ULONG LinkNo,
  1078. PHIDP_LINK_COLLECTION_NODE Node
  1079. )
  1080. {
  1081. printf ("Link %x: U %x P %x Par %x #C %x NxSib %x 1stC %x ",
  1082. LinkNo,
  1083. Node->LinkUsage,
  1084. Node->LinkUsagePage,
  1085. Node->Parent,
  1086. Node->NumberOfChildren,
  1087. Node->NextSibling,
  1088. Node->FirstChild);
  1089. if (Node->IsAlias) {
  1090. printf (" ALIAS\n");
  1091. } else {
  1092. printf ("\n");
  1093. }
  1094. }
  1095. VOID
  1096. HID_DumpPpd (
  1097. PHIDP_PREPARSED_DATA Ppd,
  1098. HID_PPD_FLAGS Flags
  1099. )
  1100. {
  1101. ULONG i;
  1102. PHIDP_CHANNEL_DESC channel;
  1103. PHIDP_LINK_COLLECTION_NODE node;
  1104. if (!Flags.IgnoreSignature) {
  1105. if ((HIDP_PREPARSED_DATA_SIGNATURE1 != Ppd->Signature1) ||
  1106. (HIDP_PREPARSED_DATA_SIGNATURE2 != Ppd->Signature2)) {
  1107. printf("Preparsed Data signature does not match, probably aint\n");
  1108. return;
  1109. }
  1110. }
  1111. if (Flags.InputChannels) {
  1112. printf ("\n========== Input Channels =========\n");
  1113. for (i = Ppd->Input.Offset; i < Ppd->Input.Index; i++) {
  1114. channel = &Ppd->Data [i];
  1115. HID_DumpChannel (channel, Flags);
  1116. }
  1117. } else {
  1118. printf ("Input channels: off %x sz %x indx %x bytelen %x\n",
  1119. Ppd->Input.Offset,
  1120. Ppd->Input.Size,
  1121. Ppd->Input.Index,
  1122. Ppd->Input.ByteLen);
  1123. }
  1124. if (Flags.OutputChannels) {
  1125. printf ("\n========== Output Channels =========\n");
  1126. for (i = Ppd->Output.Offset; i < Ppd->Output.Index; i++) {
  1127. channel = &Ppd->Data [i];
  1128. HID_DumpChannel (channel, Flags);
  1129. }
  1130. } else {
  1131. printf ("Output channels: off %x sz %x indx %x bytelen %x\n",
  1132. Ppd->Output.Offset,
  1133. Ppd->Output.Size,
  1134. Ppd->Output.Index,
  1135. Ppd->Output.ByteLen);
  1136. }
  1137. if (Flags.FeatureChannels) {
  1138. printf ("\n========== Feature Channels =========\n");
  1139. for (i = Ppd->Feature.Offset; i < Ppd->Feature.Index; i++) {
  1140. channel = &Ppd->Data [i];
  1141. HID_DumpChannel (channel, Flags);
  1142. }
  1143. } else {
  1144. printf ("Feature channels: off %x sz %x indx %x bytelen %x\n",
  1145. Ppd->Feature.Offset,
  1146. Ppd->Feature.Size,
  1147. Ppd->Feature.Index,
  1148. Ppd->Feature.ByteLen);
  1149. }
  1150. if (Flags.LinkCollections) {
  1151. printf ("\n========== Link Collections =========\n");
  1152. node = (PHIDP_LINK_COLLECTION_NODE)
  1153. (Ppd->RawBytes + Ppd->LinkCollectionArrayOffset);
  1154. for (i = 0; i < Ppd->LinkCollectionArrayLength; i++, node++) {
  1155. HID_DumpLink (i, node);
  1156. }
  1157. } else {
  1158. printf ("Link Collections: %x \n",
  1159. Ppd->LinkCollectionArrayLength);
  1160. }
  1161. printf ("\n");
  1162. }