|
|
typedef int POOL_TYPE;
#include <stdio.h>
#include <nt.h>
#include <ntrtl.h>
#include <nturtl.h>
#include <windows.h>
#include <wtypes.h>
#include <hidpddi.h>
#include <hidparse.h>
#undef ASSERT
#define ASSERT( exp ) \
if (!(exp)) \ { printf ("Assert Failed: %s \n %s \n %d \n", #exp, __FILE__, __LINE__ ); }
NTSTATUS __stdcall HidP_SetUnsetOneUsage ( struct _CHANNEL_REPORT_HEADER *, USAGE, USHORT, USAGE, PHIDP_PREPARSED_DATA, PCHAR, BOOLEAN);
typedef union _HID_PPD_FLAGS { struct { ULONG InputChannels : 1; ULONG OutputChannels : 1; ULONG FeatureChannels : 1; ULONG LinkCollections : 1; ULONG FullChannelListing : 1; ULONG ReportLocation : 1; ULONG Reserved : 25; ULONG IgnoreSignature : 1; }; ULONG Flags; } HID_PPD_FLAGS;
VOID HID_DumpPpd (PHIDP_PREPARSED_DATA Ppd, HID_PPD_FLAGS Flags);
void __cdecl main () { HID_PPD_FLAGS flags; ULONG i; UCHAR desc[] = {0x05, 0x0C, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x01, 0x09, 0x36, 0xA1, 0x02, 0x05, 0x09, 0x19, 0x01, 0x29, 0x10, 0x15, 0x00, 0x25, 0x01, 0x35, 0x00, 0x45, 0x01, 0x75, 0x01, 0x95, 0x10, 0x81, 0x02, 0xC0, 0x15, 0x01, 0x25, 0x03, 0x75, 0x02, 0x95, 0x01, 0x05, 0x0C, 0x09, 0xB0, 0xA1, 0x02, 0x05, 0x08, 0x09, 0x3C, 0xA1, 0x02, 0x09, 0x3D, 0x09, 0x3F, 0x09, 0x41, 0x91, 0x00, 0xC0, 0x09, 0x47, 0xA1, 0x02, 0x09, 0x48, 0x09, 0x49, 0x09, 0x4A, 0x91, 0x00, 0x91, 0x01, 0x91, 0x01, 0xC0, 0xC0, 0x05, 0x14, 0x15, 0x00, 0x09, 0x20, 0xA1, 0x02, 0x09, 0x35, 0x25, 0x03, 0x75, 0x03, 0x95, 0x01, 0xB1, 0x03, 0x09, 0x36, 0x25, 0x1F, 0x75, 0x05, 0xB1, 0x03, 0xC0, 0x09, 0x32, 0xA1, 0x02, 0x85, 0x02, 0x09, 0x33, 0x75, 0x03, 0x95, 0x01, 0x25, 0x07, 0xB1, 0x22, 0x09, 0x34, 0x75, 0x05, 0x25, 0x1F, 0xB1, 0x22, 0xC0, 0x09, 0x2B, 0xA1, 0x02, 0x09, 0x33, 0x75, 0x03, 0x95, 0x01, 0x25, 0x07, 0xB1, 0x22, 0x09, 0x34, 0x75, 0x05, 0x25, 0x1F, 0xB1, 0x22, 0x75, 0x08, 0x95, 0x04, 0x15, 0x20, 0x26, 0xFE, 0x00, 0x09, 0x2C, 0xB1, 0x02, 0xC0, 0xC0 };
unsigned char PwrReportDescriptor[] = { 0x05, 0x84, // USAGE_PAGE (Power Device)
0x09, 0x04, // USAGE (UPS)
0xa1, 0x01, // COLLECTION (Application)
0x85, 0x01, // REPORT_ID (1)
0x09, 0x1e, // USAGE (Flow)
0xa1, 0x02, // COLLECTION (Logical)
0x09, 0x1f, // USAGE (FlowID)
0x75, 0x04, // REPORT_SIZE (4)
0x95, 0x01, // REPORT_COUNT (1)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x0f, // LOGICAL_MAXIMUM (15)
0x65, 0x00, // UNIT (None)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x09, 0x00, // USAGE (Undefined)
0x95, 0x01, // REPORT_COUNT (1)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x09, 0x01, // USAGE (iName)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x09, 0x40, // USAGE (ConfigVoltage)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x67, 0x21, 0xd1, 0xf0, 0x00, // UNIT (SI Lin:Volts)
0x55, 0x07, // UNIT_EXPONENT (7)
0x26, 0xfe, 0x00, // LOGICAL_MAXIMUM (254)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x09, 0x42, // USAGE (ConfigFrequency)
0x95, 0x01, // REPORT_COUNT (1)
0x66, 0x01, 0xf0, // UNIT (SI Lin:Hertz)
0x55, 0x00, // UNIT_EXPONENT (0)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x09, 0x43, // USAGE (ConfigApparentPower)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x66, 0x21, 0xd1, // UNIT (SI Lin:Power)
0x55, 0x07, // UNIT_EXPONENT (7)
0x27, 0xfe, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65534)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x65, 0x00, // UNIT (None)
0xc0, // END_COLLECTION
0x09, 0x24, // USAGE (PowerSummary)
0xa1, 0x00, // COLLECTION (Physical)
0x85, 0x02, // REPORT_ID (2)
0x09, 0x25, // USAGE (PowerSummaryID)
0x09, 0x1f, // USAGE (FlowID)
0x75, 0x04, // REPORT_SIZE (4)
0x95, 0x02, // REPORT_COUNT (2)
0x25, 0x0f, // LOGICAL_MAXIMUM (15)
0x65, 0x00, // UNIT (None)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x09, 0x01, // USAGE (iName)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x25, 0x0f, // LOGICAL_MAXIMUM (15)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x0b, 0x2c, 0x00, 0x85, 0x00, // USAGE (Battery System:CapacityMode)
0x0b, 0x8b, 0x00, 0x85, 0x00, // USAGE (Battery System:Rechargable)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x02, // REPORT_COUNT (2)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x09, 0x00, // USAGE (Undefined)
0x75, 0x06, // REPORT_SIZE (6)
0x95, 0x01, // REPORT_COUNT (1)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x0b, 0x83, 0x00, 0x85, 0x00, // USAGE (Battery System:DesignCapacity)
0x0b, 0x67, 0x00, 0x85, 0x00, // USAGE (Battery System:FullChargeCapacity)
0x75, 0x18, // REPORT_SIZE (24)
0x95, 0x02, // REPORT_COUNT (2)
0x67, 0x01, 0x10, 0x10, 0x00, // UNIT (SI Lin:Battery Capacity)
0x27, 0xfe, 0xff, 0xff, 0x00, // LOGICAL_MAXIMUM (16777214)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0x09, 0x40, // USAGE (ConfigVoltage)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x67, 0x21, 0xd1, 0xf0, 0x00, // UNIT (SI Lin:Volts)
0x55, 0x05, // UNIT_EXPONENT (5)
0x27, 0xfe, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65534)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x0b, 0x8c, 0x00, 0x85, 0x00, // USAGE (Battery System:WarningCapacityLimit)
0x0b, 0x29, 0x00, 0x85, 0x00, // USAGE (Battery System:RemainingCapacityLimit)
0x0b, 0x8d, 0x00, 0x85, 0x00, // USAGE (Battery System:CapacityGranularity1)
0x0b, 0x8e, 0x00, 0x85, 0x00, // USAGE (Battery System:CapacityGranularity2)
0x75, 0x18, // REPORT_SIZE (24)
0x95, 0x04, // REPORT_COUNT (4)
0x67, 0x01, 0x10, 0x10, 0x00, // UNIT (SI Lin:Battery Capacity)
0x55, 0x00, // UNIT_EXPONENT (0)
0x27, 0xfe, 0xff, 0xff, 0x00, // LOGICAL_MAXIMUM (16777214)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x09, 0xfe, // USAGE (iProduct)
0x09, 0xff, // USAGE (iSerialNumber)
0x0b, 0x89, 0x00, 0x85, 0x00, // USAGE (Battery System:iDeviceChemistery)
0x0b, 0x87, 0x00, 0x85, 0x00, // USAGE (Battery System:iManufacturerName)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x04, // REPORT_COUNT (4)
0x25, 0x0f, // LOGICAL_MAXIMUM (15)
0x65, 0x00, // UNIT (None)
0xb1, 0x03, // FEATURE (Cnst,Var,Abs)
0x09, 0x30, // USAGE (Voltage)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x67, 0x21, 0xd1, 0xf0, 0x00, // UNIT (SI Lin:Volts)
0x55, 0x05, // UNIT_EXPONENT (5)
0x27, 0xfe, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65534)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0x09, 0x31, // USAGE (Current)
0x95, 0x01, // REPORT_COUNT (1)
0x67, 0x01, 0x00, 0x10, 0x00, // UNIT (SI Lin:Amps)
0x55, 0x0e, // UNIT_EXPONENT (-2)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0x0b, 0x66, 0x00, 0x85, 0x00, // USAGE (Battery System:RemainingCapacity)
0x75, 0x18, // REPORT_SIZE (24)
0x95, 0x01, // REPORT_COUNT (1)
0x67, 0x01, 0x10, 0x10, 0x00, // UNIT (SI Lin:Battery Capacity)
0x55, 0x00, // UNIT_EXPONENT (0)
0x27, 0xfe, 0xff, 0xff, 0x00, // LOGICAL_MAXIMUM (16777214)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x0b, 0x68, 0x00, 0x85, 0x00, // USAGE (Battery System:RunTimeToEmpty)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x66, 0x01, 0x10, // UNIT (SI Lin:Time)
0x55, 0x00, // UNIT_EXPONENT (0)
0x27, 0xfe, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65534)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x35, // USAGE (PercentLoad)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x26, 0xfe, 0x00, // LOGICAL_MAXIMUM (254)
0x65, 0x00, // UNIT (None)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x02, // USAGE (PresentStatus)
0xa1, 0x02, // COLLECTION (Logical)
0x05, 0x85, // USAGE_PAGE (Battery System)
0x09, 0xd0, // USAGE (ACPresent)
0x09, 0x42, // USAGE (BelowRemainingCapacityLimit)
0x09, 0x44, // USAGE (Charging)
0x09, 0x45, // USAGE (Discharging)
0x0b, 0x69, 0x00, 0x84, 0x00, // USAGE (Power Device:ShutdownImminent)
0x0b, 0x65, 0x00, 0x84, 0x00, // USAGE (Power Device:Overload)
0x09, 0x00, // USAGE (Undefined)
0x09, 0x00, // USAGE (Undefined)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x08, // REPORT_COUNT (8)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
0xc0, // END_COLLECTION
0xc0 // END_COLLECTION
};
UCHAR rawDesc[] = { 0x05, 0x80, 0x09, 0x01, 0xA1, 0x01, 0x85, 0x01, 0x75, 0x08, 0x95, 0x80, 0x15, 0x00, 0x26, 0xFF, 0x00, 0x09, 0x02, 0xB2, 0x02, 0x01, 0x85, 0x02, 0x75, 0x10, 0x95, 0x01, 0x15, 0x00, 0x27, 0xFF, 0xFF, 0x00, 0x00, 0x09, 0x04, 0xB1, 0x02, 0x85, 0x03, 0x09, 0x09, 0xA1, 0x02, 0x05, 0x81, 0x09, 0x01, 0x25, 0x01, 0x75, 0x08, 0x95, 0x01, 0xB1, 0x40, 0xC0, 0x05, 0x82, 0x85, 0x04, 0x09, 0x20, 0x09, 0x22, 0x09, 0x30, 0x09, 0x32, 0x09, 0x24, 0x75, 0x08, 0x95, 0x05, 0x26, 0xFF, 0x00, 0xB1, 0x62, 0x09, 0x20, 0x09, 0x22, 0x09, 0x30, 0x09, 0x32, 0x09, 0x24, 0x81, 0x62, 0x85, 0x05, 0x09, 0x26, 0x09, 0x3A, 0x09, 0x40, 0x09, 0x42, 0x09, 0x44, 0x95, 0x05, 0xB1, 0x62, 0x09, 0x26, 0x09, 0x3A, 0x09, 0x40, 0x09, 0x42, 0x09, 0x44, 0x81, 0x62, 0x85, 0x06, 0x09, 0x10, 0x09, 0x12, 0x09, 0x16, 0x09, 0x18, 0x09, 0x1A, 0x95, 0x05, 0xB1, 0x62, 0x09, 0x10, 0x09, 0x12, 0x09, 0x16, 0x09, 0x18, 0x09, 0x1A, 0x81, 0x62, 0x85, 0x07, 0x09, 0x6C, 0x09, 0x6E, 0x09, 0x70, 0x95, 0x03, 0xB1, 0x62, 0x09, 0x6C, 0x09, 0x6E, 0x09, 0x70, 0x81, 0x62, 0x85, 0x08, 0x09, 0x5E, 0xA1, 0x02, 0x05, 0x81, 0x09, 0x03, 0x75, 0x08, 0x95, 0x01, 0x25, 0x01, 0xB1, 0x40, 0xC0, 0x05, 0x82, 0x09, 0x60, 0xA1, 0x02, 0x05, 0x81, 0x09, 0x01, 0x75, 0x08, 0x25, 0x01, 0xB1, 0x40, 0xC0, 0x05, 0x83, 0x85, 0x09, 0x09, 0x02, 0x75, 0x08, 0x25, 0x01, 0xB1, 0x02, 0x09, 0x01, 0xA1, 0x02, 0x05, 0x81, 0x09, 0x02, 0x09, 0x04, 0x75, 0x08, 0x25, 0x02, 0xB1, 0x40, 0xC0, 0xC0 };
UCHAR anotherRawDesc[] = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop) 05 01
0x09, 0x02, // USAGE (Mouse) 09 02
0xA1, 0x01, // COLLECTION (Application) A1 01
0x05, 0x09, // USAGE_PAGE (Button) 05 09
0x19, 0x01, // USAGE_MINIMUM (Button 1) 19 01
0x29, 0x02, // USAGE_MAXIMUM (Button 2) 29 02
0x09, 0x0C, // USAGE (Button 12) 09 0C
0x15, 0x81, // LOGICAL_MINIMUM (-127) 15 81
0x25, 0x7F, // LOGICAL_MAXIMUM (127) 25 7F
0x75, 0x08, // REPORT_SIZE (8) 75 08
0x95, 0x03, // REPORT_COUNT (3) 95 03
0x81, 0x02, // INPUT (Data,Var,Abs) 81 02
0xC0 // END_COLLECTION C0
};
UCHAR yetAnotherRawDesc[] = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop) 05 01
0x09, 0x02, // USAGE (Mouse) 09 02
0xA1, 0x01, // COLLECTION (Application) A1 01
0x05, 0x09, // USAGE_PAGE (Button) 05 09
0x19, 0x01, // USAGE_MINIMUM (Button 1) 19 01
0x29, 0x08, // USAGE_MAXIMUM (Button 8)
0x09, 0x0C, // USAGE (Button 12) 09 0C
0x19, 0x30, // USAGE_MINIMUM (Button 30) 19 30
0x29, 0x32, // USAGE_MAXIMUM (Button 32)
0x15, 0x81, // LOGICAL_MINIMUM (-127) 15 81
0x25, 0x7F, // LOGICAL_MAXIMUM (127) 25 7F
0x75, 0x04, // REPORT_SIZE (4)
0x95, 0x10, // REPORT_COUNT (10) 95 10
0x81, 0x00, // INPUT (Data,Var,Array) 81 00
0xC0 // END_COLLECTION C0
};
UCHAR yard[] = { 0x05, 0x01, 0x09, 0x05, 0x95, 0x00, 0xa1, 0x01, 0x05, 0x01, 0x09, 0x01, 0xa1, 0x00, 0x09, 0x30, 0x09, 0x31, 0x15, 0x81, 0x25, 0x7f, 0x35, 0x00, 0x45, 0xff, 0x66, 0x00, 0x00, 0x75, 0x08, 0x95, 0x02, 0x81, 0x02, 0xc0, 0x05, 0x09, 0x15, 0x00, 0x25, 0x01, 0x35, 0x00, 0x45, 0x01, 0x66, 0x00, 0x00, 0x75, 0x01, 0x95, 0x0a, 0x19, 0x01, 0x29, 0x0a, 0x81, 0x02, 0x06, 0x00, 0xff, 0x15, 0x00, 0x25, 0x01, 0x35, 0x00, 0x45, 0x01, 0x66, 0x00, 0x00, 0x75, 0x01, 0x95, 0x04, 0x19, 0x01, 0x29, 0x04, 0x81, 0x02, 0x75, 0x01, 0x95, 0x02, 0x81, 0x01, 0xc0 };
UCHAR yard2[236] = { 0x05, 0x80, // USAGE_PAGE (Monitor)
0x09, 0x01, // USAGE (Monitor Control)
0xa1, 0x01, // COLLECTION (Application)
0x85, 0x01, // REPORT_ID (1)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x80, // REPORT_COUNT (128)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x09, 0x02, // USAGE (EDID Information)
0xb2, 0x02, 0x01, // FEATURE (Data,Var,Abs,Buf)
0x85, 0x02, // REPORT_ID (2)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x27, 0xff, 0xff, 0x00, 0x00, // LOGICAL_MAXIMUM (65535)
0x09, 0x04, // USAGE (VESA Version)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0x85, 0x03, // REPORT_ID (3)
0x09, 0x09, // USAGE (Sync Type)
0xa1, 0x02, // COLLECTION (Logical)
0x05, 0x81, // USAGE_PAGE (Monitor Enumerated Values)
0x09, 0x01, // USAGE (ENUM 0)
0x09, 0x02, // USAGE (ENUM 1)
0x09, 0x03, // USAGE (ENUM 2)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x25, 0x02, // LOGICAL_MAXIMUM (2)
0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
0xc0, // END_COLLECTION
0x85, 0x04, // REPORT_ID (4)
0x05, 0x82, // USAGE_PAGE (VESA Virtual Controls)
0x09, 0x20, // USAGE (Horizontal Position )
0x09, 0x22, // USAGE (Horizontal Size )
0x09, 0x30, // USAGE (Vertical Position )
0x09, 0x32, // USAGE (Vertical Size )
0x09, 0x24, // USAGE (Horizontal Pincushion )
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x05, // REPORT_COUNT (5)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0xb1, 0x22, // FEATURE (Data,Var,Abs,NPrf)
0x09, 0x20, // USAGE (Horizontal Position )
0x09, 0x22, // USAGE (Horizontal Size )
0x09, 0x30, // USAGE (Vertical Position )
0x09, 0x32, // USAGE (Vertical Size )
0x09, 0x24, // USAGE (Horizontal Pincushion )
0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
0x85, 0x05, // REPORT_ID (5)
0x09, 0x26, // USAGE (Horizontal Pincushion Balance )
0x09, 0x3a, // USAGE (Vertical Linearity )
0x09, 0x40, // USAGE (Parallelogram Distortion)
0x09, 0x42, // USAGE (Trapezoidal Distortion)
0x09, 0x44, // USAGE (Tilt)
0x95, 0x05, // REPORT_COUNT (5)
0xb1, 0x22, // FEATURE (Data,Var,Abs,NPrf)
0x09, 0x26, // USAGE (Horizontal Pincushion Balance )
0x09, 0x3a, // USAGE (Vertical Linearity )
0x09, 0x40, // USAGE (Parallelogram Distortion)
0x09, 0x42, // USAGE (Trapezoidal Distortion)
0x09, 0x44, // USAGE (Tilt)
0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
0x85, 0x06, // REPORT_ID (6)
0x09, 0x10, // USAGE (Brightness)
0x09, 0x12, // USAGE (Contrast)
0x09, 0x16, // USAGE (Video Gain Red)
0x09, 0x18, // USAGE (Video Gain Green)
0x09, 0x1a, // USAGE (Video Gain Blue)
0x95, 0x05, // REPORT_COUNT (5)
0xb1, 0x22, // FEATURE (Data,Var,Abs,NPrf)
0x09, 0x10, // USAGE (Brightness)
0x09, 0x12, // USAGE (Contrast)
0x09, 0x16, // USAGE (Video Gain Red)
0x09, 0x18, // USAGE (Video Gain Green)
0x09, 0x1a, // USAGE (Video Gain Blue)
0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
0x85, 0x07, // REPORT_ID (7)
0x09, 0x6c, // USAGE (Video Black Level Red)
0x09, 0x6e, // USAGE (Video Black Level Green)
0x09, 0x70, // USAGE (Video Black Level Blue)
0x95, 0x03, // REPORT_COUNT (3)
0xb1, 0x22, // FEATURE (Data,Var,Abs,NPrf)
0x09, 0x6c, // USAGE (Video Black Level Red)
0x09, 0x6e, // USAGE (Video Black Level Green)
0x09, 0x70, // USAGE (Video Black Level Blue)
0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
0x85, 0x08, // REPORT_ID (8)
0x09, 0x5e, // USAGE (Input Level Select)
0xa1, 0x02, // COLLECTION (Logical)
0x05, 0x81, // USAGE_PAGE (Monitor Enumerated Values)
0x09, 0x02, // USAGE (ENUM 1)
0x09, 0x03, // USAGE (ENUM 2)
0x09, 0x04, // USAGE (ENUM 3)
0x09, 0x05, // USAGE (ENUM 4)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x25, 0x04, // LOGICAL_MAXIMUM (4)
0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
0xc0, // END_COLLECTION
0x09, 0x60, // USAGE (ENUM 95)
0xa1, 0x02, // COLLECTION (Logical)
0x05, 0x81, // USAGE_PAGE (Monitor Enumerated Values)
0x09, 0x01, // USAGE (ENUM 0)
0x09, 0x02, // USAGE (ENUM 1)
0x09, 0x04, // USAGE (ENUM 3)
0x75, 0x08, // REPORT_SIZE (8)
0x25, 0x06, // LOGICAL_MAXIMUM (6)
0xb1, 0x40, // FEATURE (Data,Ary,Abs,Null)
0xc0, // END_COLLECTION
0x85, 0x09, // REPORT_ID (9)
0x05, 0x83, // USAGE_PAGE (VESA Command)
0x09, 0x00, // USAGE (Undefined)
0x75, 0x08, // REPORT_SIZE (8)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x91, 0x02, // OUTPUT (Data,Var,Abs)
0x09, 0x01, // USAGE (Settings)
0x75, 0x08, // REPORT_SIZE (8)
0x25, 0x03, // LOGICAL_MAXIMUM (3)
0x91, 0x02, // OUTPUT (Data,Var,Abs)
0xc0 // END_COLLECTION
};
UCHAR anotherDescriptorWhichBreaksTheParser [] = { 0x09, 0x02, // USAGE (PresentStatus)
0xa1, 0x02, // COLLECTION (Logical)
0x05, 0x85, // USAGE_PAGE (Battery System)
0x09, 0xd0, // USAGE (ACPresent)
0x09, 0x42, // USAGE (BelowRemainingCapacityLimit)
0x09, 0x44, // USAGE (Charging)
0x09, 0x45, // USAGE (Discharging)
0x0b, 0x69, 0x00, 0x84, 0x00, // USAGE (Power Device:ShutdownImminent)
0x0b, 0x65, 0x00, 0x84, 0x00, // USAGE (Power Device:Overload)
0x0b, 0x00, 0x00, 0x84, 0x00, // USAGE (Power Device:Undefined)
0x0b, 0x00, 0x00, 0x84, 0x00, // USAGE (Power Device:Undefined)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x08, // REPORT_COUNT (8)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x81, 0x83, // INPUT (Cnst,Var,Abs,Vol)
0xc0 };
UCHAR afd [] = { 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x02, // USAGE (Mouse)
0xa1, 0x01, // COLLECTION (Application)
0x09, 0x01, // USAGE (Pointer)
0xa1, 0x00, // COLLECTION (Physical)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x03, // USAGE_MAXIMUM (Button 3)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x95, 0x03, // REPORT_COUNT (3)
0x75, 0x01, // REPORT_SIZE (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x05, // REPORT_SIZE (5)
0x81, 0x01, // INPUT (Cnst,Ary,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x15, 0x81, // LOGICAL_MINIMUM (-127)
0x25, 0x7f, // LOGICAL_MAXIMUM (127)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x02, // REPORT_COUNT (2)
0x81, 0x06, // INPUT (Data,Var,Rel)
0xc0, // END_COLLECTION
0xc0 // END_COLLECTION
};
UCHAR afd2 [] = { 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Pointer)
0xa1, 0x01, // COLLECTION (Application)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Pointer)
0xa1, 0x00, // COLLECTION (Physical)
0x09, 0x00, // USAGE (Undefined)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x01, // INPUT (Cnst,Ary,Abs)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x01, // USAGE_MAXIMUM (Button 1)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x45, 0x01, // PHYSICAL_MAXIMUM (1)
0x66, 0x00, 0x00, // UNIT (None)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x62, // INPUT (Data,Var,Abs,NPrf,Null)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x07, // REPORT_COUNT (7)
0x81, 0x01, // INPUT (Cnst,Ary,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x16, 0x00, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0x00, 0x10, // LOGICAL_MAXIMUM (4096)
0x36, 0x00, 0x00, // PHYSICAL_MINIMUM (0)
0x46, 0xff, 0x7f, // PHYSICAL_MAXIMUM (32767)
0x66, 0x00, 0x00, // UNIT (None)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x02, // REPORT_COUNT (2)
0x81, 0x62, // INPUT (Data,Var,Abs,NPrf,Null)
0x09, 0x3b, // USAGE (Byte Count)
0x16, 0x00, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0x00, 0x01, // LOGICAL_MAXIMUM (256)
0x36, 0x00, 0x00, // PHYSICAL_MINIMUM (0)
0x46, 0x00, 0x01, // PHYSICAL_MAXIMUM (256)
0x66, 0x00, 0x00, // UNIT (None)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x62, // INPUT (Data,Var,Abs,NPrf,Null)
0xc0, // END_COLLECTION
0xc0 // END_COLLECTION
};
UCHAR adwbtp2 [] = { 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x06, // USAGE (Keyboard)
0xa1, 0x01, // COLLECTION (Application)
0x05, 0x07, // USAGE_PAGE (Keyboard)
0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x08, // REPORT_COUNT (8)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x01, // INPUT (Cnst,Ary,Abs)
0x95, 0x05, // REPORT_COUNT (5)
0x75, 0x01, // REPORT_SIZE (1)
0x05, 0x08, // USAGE_PAGE (LEDs)
0x19, 0x01, // USAGE_MINIMUM (Num Lock)
0x29, 0x03, // USAGE_MAXIMUM (Scroll Lock)
0x29, 0x03, // USAGE_MAXIMUM (Scroll Lock)
0x91, 0x02, // OUTPUT (Data,Var,Abs)
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x03, // REPORT_SIZE (3)
0x75, 0x03, // REPORT_SIZE (3)
0x91, 0x01, // OUTPUT (Cnst,Ary,Abs)
0x95, 0x06, // REPORT_COUNT (6)
0x75, 0x08, // REPORT_SIZE (8)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x65, // LOGICAL_MAXIMUM (101)
0x05, 0x07, // USAGE_PAGE (Keyboard)
0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
0x81, 0x00, // INPUT (Data,Ary,Abs)
0x05, 0x07, // USAGE_PAGE (Keyboard)
0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
0xc0 // END_COLLECTION
};
UCHAR vendorDescriptorsSometimeRequireSpecialCode[] = { 0x05, 0x01, 0x09, 0x04, 0xA1, 0x01, 0x85, 0x01, 0x09, 0x01, 0xA1, 0x00, 0x95, 0x01, 0x75, 0x04, 0x15, 0x00, 0x25, 0x07, 0x35, 0x00, 0x46, 0x3B, 0x01, 0x66, 0x14, 0x00, 0x09, 0x39, 0x81, 0x42, 0x95, 0x04, 0x75, 0x01, 0x15, 0x00, 0x25, 0x01, 0x35, 0x00, 0x45, 0x01, 0x66, 0x00, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x04, 0xA4, 0x81, 0x02, 0x95, 0x02, 0x75, 0x0A, 0x16, 0x00, 0xFE, 0x26, 0xFF, 0x01, 0x35, 0x00, 0x46, 0xFF, 0x03, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x81, 0x02, 0x95, 0x04, 0x75, 0x01, 0x81, 0x01, 0xC0, 0xB4, 0x05, 0x09, 0x95, 0x07, 0x19, 0x05, 0x29, 0x0B, 0x81, 0x02, 0x95, 0x01, 0x81, 0x01, 0x75, 0x06, 0x15, 0xE0, 0x25, 0x1F, 0x35, 0x00, 0x45, 0x3F, 0x05, 0x01, 0x09, 0x36, 0x81, 0x02, 0x06, 0x01, 0xFF, 0x0A, 0x01, 0x00, 0x75, 0x02, 0x81, 0x02, 0xC0 };
UCHAR ReportDescriptor[] = { 0x05, 0x84, // USAGE_PAGE (Power Device)
0x09, 0x04, // USAGE (UPS)
0xa1, 0x01, // COLLECTION (Application)
0x05, 0x84, // USAGE_PAGE (Power Device)
0x09, 0x24, // USAGE (PowerSummary)
0xa1, 0x00, // COLLECTION (Physical)
0x05, 0x85, // USAGE_PAGE (Battery System)
0x85, 0x01, // REPORT_ID (1)
0x67, 0x01, 0x10, 0x10, 0x00, // UNIT (SI Lin:Battery Capacity)
0x95, 0x03, // REPORT_COUNT (1)
0x75, 0x03, // REPORT_SIZE (1)
0x09, 0x65, // USAGE
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0x09, 0x66, // USAGE (RemainingCapacity)
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x18, // REPORT_SIZE (24)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0x09, 0x67, // USAGE
0x75, 0x07, // REPORT_SIZE (7)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0x09, 0x68, // USAGE
0x75, 0x18, // REPORT_SIZE (24)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0xc0, // END_COLLECTION
0xc0 // END_COLLECTION
};
UCHAR Rd[] = { 0x05, 0x01, // USAGE_PAGE (Generic Desktop) 05 01
0x09, 0x06, // USAGE (Keyboard)
0xA1, 0x01, // COLLECTION (Application)
0x09, 0x30, // USAGE (X)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
0x09, 0x31, // USAGE (Y)
0x95, 0x02, // REPORT_COUNT (2)
0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
0x09, 0x32, // USAGE (Z)
0x09, 0x38, // USAGE (Wheel)
0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
0x19, 0x33, // USAGE Min (Rx)
0x29, 0x34, // USAGE Max (Ry)
0x95, 0x04, // REPORT_COUNT (4)
0x82, 0x02, 0x01, // INPUT (Data,Var,Abs,Buf)
0x09, 0x35, // USAGE (Rz)
0x09, 0x36, // USAGE (Slider)
0x75, 0x07, // REPORT_SIZE (7)
0x95, 0x04, // REPORT_COUNT (4)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x04, // REPORT_SIZE (4)
0x81, 0x01, // INPUT (Cnst,Ary,Abs)
0xC0 // END_COLLECTION
};
UCHAR Rd2 [50] = { 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x02, // USAGE (Mouse)
0xa1, 0x01, // COLLECTION (Application)
0x85, 0x01, // REPORT_ID (1)
0x75, 0x0F, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x15, 0x0b, // LOGICAL_MINIMUM (11)
0x25, 0x1c, // LOGICAL_MAXIMUM (28)
0x09, 0x30, // USAGE (X)
0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
0x85, 0x02, // REPORT_ID (2)
0x09, 0x32, // USAGE (Z)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x85, 0x01, // REPORT_ID (1)
0x75, 0x09, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x03, // LOGICAL_MAXIMUM (3)
0x09, 0x31, // USAGE (Y)
0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
0xc0 // END_COLLECTION
};
UCHAR Rd3[40] = { 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x02, // USAGE (Mouse)
0xa1, 0x01, // COLLECTION (Application)
0x85, 0x01, // REPORT_ID (1)
0x75, 0x10, // REPORT_SIZE (16)
0x95, 0x01, // REPORT_COUNT (1)
0x15, 0x0b, // LOGICAL_MINIMUM (11)
0x25, 0x1c, // LOGICAL_MAXIMUM (28)
0x09, 0x30, // USAGE (X)
0x81, 0x22, // INPUT (Data,Var,Abs,NPrf)
0xc0, // END_COLLECTION
0x09, 0x06, // USAGE (Keyboard)
0xa1, 0x01, // COLLECTION (Application)
0x85, 0x01, // REPORT_ID (1)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x40, // LOGICAL_MAXIMUM (64)
0x09, 0x31, // USAGE (Y)
0x81, 0x02, // INPUT (Data,Var,Abs)
0xc0 // END_COLLECTION
};
UCHAR Rd4[] = { 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x01, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x01, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 0x95, 0x02, 0x81, 0x06, 0xc0, 0xc0, 0x05, 0x01, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x02, 0x19, 0x81, 0x29, 0x83, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x03, 0x81, 0x06, 0x95, 0x05, 0x81, 0x01, 0x75, 0x08, 0x95, 0x02, 0x81, 0x01, 0xc0, 0x05, 0x0c, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x03, 0x09, 0xcd, 0x09, 0xb7, 0x09, 0xb5, 0x09, 0xb6, 0x0a, 0x23, 0x02, 0x0a, 0x8a, 0x01, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x06, 0x81, 0x06, 0x75, 0x01, 0x95, 0x02, 0x81, 0x01, 0x09, 0xe2, 0x09, 0xe9, 0x09, 0xea, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x03, 0x81, 0x06, 0x75, 0x01, 0x95, 0x05, 0x81, 0x01, 0x75, 0x08, 0x95, 0x01, 0x81, 0x01, 0xc0, 0x06, 0x46, 0xff, 0x09, 0x04, 0xa1, 0x01, 0x85, 0x04, 0x09, 0xcd, // here we have 6 usages in a row.
0x09, 0xb7, 0x09, 0xb5, 0x09, 0xb6, 0x0a, 0x23, 0x02, 0x0a, 0x8a, 0x01, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x06, 0x81, 0x06, // here we have a main item of count 6 that uses them all up.
0x75, 0x01, 0x95, 0x02, 0x81, 0x01, // here we have a constant input item with no usages.
0x75, 0x08, 0x95, 0x02, 0x81, 0x01, // here we have another constant input item with no usages; then usage min 0, max FF,
0x19, 0x00, 0x29, 0xff, // usage Min 00, Max FF
0x15, 0x81, 0x25, 0x7f, // logical min -127, max 127
0x75, 0x08, 0x95, 0x01, // size 8, count 1
0xb1, 0x02, 0xc0 // finally a feature item.
};
UCHAR Rd5[] = { 0x05, 0x01, 0x09, 0x06, 0xA1, 0x01, // Top level collection
0x05, 0x07, 0x19, 0xE0, 0x29, 0xE7, // Page 5, Min e0, max e7
0x15, 0x00, 0x25, 0x01, // log min/max
0x75, 0x01, 0x95, 0x08, 0x81, 0x02, // size 1, Count 8, MAIN
0x75, 0x08, 0x95, 0x01, 0x81, 0x01, // size 8, Count 1, MAIN Cnst.
0x95, 0x05, 0x75, 0x01, // Count 5, size 1
0x05, 0x08, 0x19, 0x01, 0x29, 0x03, 0x29, 0x03, // Page 5, Min 1, Max 3
// max 3, A 2ND Mi/Ma!
0x91, 0x02, // Output
0x95, 0x01, 0x75, 0x03, 0x75, 0x03, // Count 1, Size 3
0x91, 0x01, // Output Cnst.
0x95, 0x06, 0x75, 0x08, // Count 6, Size 8
0x15, 0x00, 0x25, 0x65, // log min/max
0x05, 0x07, 0x19, 0x00, 0x29, 0x65, // Page 7, min 0, max 65
0x81, 0x00, // Array
0xC0 };
UCHAR Rd6[] = { 0x05, 0x01, 0x09, 0x06, 0xA1, 0x01, // Top level Collection
0x05, 0x07, 0x19, 0xE0, 0x29, 0xE7, // Page 5, Min e0, max e7
0x15, 0x00, 0x25, 0x01, // log min/max
0x75, 0x01, 0x95, 0x08, 0x81, 0x02, // size 1, Cnt 8, MAIN
0x95, 0x01, 0x75, 0x08, 0x81, 0x01, // size 8, Cnt 1, MAIN
0x95, 0x05, 0x75, 0x01, // Count 5, size 1
0x05, 0x08, 0x19, 0x01, 0x29, 0x03, // page 5, min 1, max 3, NO DOUBLE
0x91, 0x02, // output
0x95, 0x01, 0x75, 0x03, // Count 1, Size 3
0x91, 0x01, // output cnst.
0x95, 0x06, 0x75, 0x08, // Count 6, Size 8
0x15, 0x00, 0x25, 0x65, //log min/max
0x05, 0x07, 0x19, 0x00, 0x29, 0x65, // Page 7, min 0 max 65
0x81, 0x00, // Array
0xC0 };
UCHAR Rd7[] = { 0x05, 0x03, 0x09, 0x03, 0xa1, 0x01, 0x05, 0x01, 0x0a, 0xc8, 0x60, 0x05, 0x03, 0x0a, 0x6a, 0x32, 0x85, 0x2d, 0x16, 0xcb, 0x24, 0x26, 0xae, 0x2e, 0x75, 0x0e, 0x95, 0x05, 0x91, 0x22, 0x05, 0x02, 0x1a, 0xfe, 0x31, 0x2a, 0x01, 0x32, 0x85, 0x2d, 0x16, 0x6b, 0xff, 0x25, 0x62, 0x75, 0x09, 0x95, 0x05, 0x81, 0x22, 0x05, 0x01, 0x0a, 0x86, 0x2c, 0x85, 0x2d, 0x16, 0x5c, 0xfd, 0x26, 0xf5, 0x02, 0x75, 0x0c, 0x95, 0x07, 0x91, 0x22, 0x05, 0x03, 0x0a, 0xff, 0x52, 0x05, 0x02, 0x0a, 0x60, 0x62, 0x85, 0x2d, 0x15, 0xe9, 0x25, 0x16, 0x75, 0x06, 0x95, 0x10, 0xb1, 0x22, 0x05, 0x01, 0x0a, 0xf8, 0x5d, 0x05, 0x02, 0x1a, 0xc4, 0x69, 0x2a, 0xc7, 0x69, 0x05, 0x01, 0x0a, 0x65, 0x34, 0x05, 0x03, 0x0a, 0x22, 0x6d, 0x05, 0x01, 0x0a, 0x01, 0x3a, 0x05, 0x03, 0x0a, 0x04, 0x24, 0x05, 0x01, 0x0a, 0xa9, 0x69, 0x85, 0x2d, 0x16, 0x39, 0xf1, 0x26, 0x48, 0x04, 0x75, 0x0e, 0x95, 0x0d, 0x81, 0x22, 0x05, 0x01, 0x0a, 0xbc, 0x33, 0x05, 0x03, 0x1a, 0x35, 0x1e, 0x2a, 0x36, 0x1e, 0x85, 0x2d, 0x15, 0x03, 0x25, 0x07, 0x75, 0x03, 0x95, 0x0e, 0x81, 0x22, 0x75, 0x03, 0x95, 0x01, 0x85, 0x2d, 0x81, 0x01, 0x75, 0x06, 0x95, 0x01, 0x85, 0x2d, 0x91, 0x01, 0xc0, 0x05, 0x01, 0x09, 0x03, 0xa1, 0x01, 0x05, 0x01, 0x1a, 0xe6, 0x79, 0x2a, 0xe9, 0x79, 0x05, 0x01, 0x0a, 0x23, 0x67, 0x05, 0x03, 0x1a, 0x86, 0x03, 0x2a, 0x87, 0x03, 0x05, 0x03, 0x1a, 0x21, 0x25, 0x2a, 0x23, 0x25, 0x85, 0x75, 0x16, 0x09, 0x02, 0x26, 0x0b, 0x35, 0x75, 0x0e, 0x95, 0x0a, 0x81, 0x22, 0x05, 0x01, 0x0a, 0x80, 0x11, 0x05, 0x02, 0x0a, 0x32, 0x1b, 0x05, 0x02, 0x0a, 0x7f, 0x61, 0x85, 0x75, 0x16, 0x92, 0x0e, 0x26, 0x26, 0x0f, 0x75, 0x0c, 0x95, 0x03, 0xb1, 0x22, 0x05, 0x02, 0x0a, 0xe1, 0x10, 0x05, 0x01, 0x0a, 0xce, 0x61, 0x05, 0x01, 0x0a, 0xf2, 0x20, 0x05, 0x03, 0x1a, 0x63, 0x6d, 0x2a, 0x65, 0x6d, 0x05, 0x01, 0x0a, 0x3b, 0x17, 0x85, 0x75, 0x16, 0x66, 0x02, 0x26, 0x00, 0x04, 0x75, 0x0b, 0x95, 0x0b, 0x91, 0x22, 0x05, 0x03, 0x1a, 0xd1, 0x74, 0x2a, 0xd5, 0x74, 0x05, 0x02, 0x0a, 0xbd, 0x5e, 0x05, 0x02, 0x0a, 0x1a, 0x4f, 0x05, 0x02, 0x0a, 0x43, 0x31, 0x85, 0x75, 0x16, 0xfc, 0x14, 0x26, 0xc9, 0x33, 0x75, 0x0f, 0x95, 0x0f, 0x81, 0x22, 0x05, 0x03, 0x1a, 0x18, 0x0b, 0x2a, 0x19, 0x0b, 0x05, 0x03, 0x0a, 0xb6, 0x5b, 0x05, 0x01, 0x0a, 0x3f, 0x4b, 0x05, 0x02, 0x0a, 0xa5, 0x21, 0x05, 0x02, 0x0a, 0x3b, 0x55, 0x05, 0x02, 0x1a, 0x2f, 0x0b, 0x2a, 0x31, 0x0b, 0x05, 0x03, 0x1a, 0x9a, 0x0a, 0x2a, 0x9d, 0x0a, 0x85, 0x75, 0x16, 0xb6, 0x01, 0x26, 0x12, 0x02, 0x75, 0x0d, 0x95, 0x0d, 0x81, 0x22, 0x05, 0x01, 0x1a, 0xcb, 0x7a, 0x2a, 0xcc, 0x7a, 0x85, 0x75, 0x15, 0x07, 0x25, 0x08, 0x75, 0x05, 0x95, 0x03, 0x81, 0x22, 0x05, 0x03, 0x0a, 0x24, 0x6e, 0x05, 0x03, 0x1a, 0xb0, 0x77, 0x2a, 0xb2, 0x77, 0x85, 0x75, 0x16, 0xc5, 0xed, 0x26, 0x7b, 0x5d, 0x75, 0x10, 0x95, 0x0f, 0x91, 0x22, 0x05, 0x02, 0x1a, 0x6e, 0x1e, 0x2a, 0x71, 0x1e, 0x05, 0x03, 0x1a, 0x83, 0x3d, 0x2a, 0x84, 0x3d, 0x05, 0x02, 0x1a, 0x13, 0x5d, 0x2a, 0x14, 0x5d, 0x85, 0x75, 0x15, 0x13, 0x25, 0x17, 0x75, 0x06, 0x95, 0x0d, 0x91, 0x22, 0x05, 0x02, 0x1a, 0x68, 0x5d, 0x2a, 0x6a, 0x5d, 0x05, 0x03, 0x1a, 0x2f, 0x21, 0x2a, 0x30, 0x21, 0x05, 0x02, 0x0a, 0xbd, 0x04, 0x85, 0x75, 0x16, 0x5c, 0x14, 0x26, 0x43, 0x19, 0x75, 0x0d, 0x95, 0x08, 0xb1, 0x22, 0x05, 0x01, 0x0a, 0xf1, 0x57, 0x05, 0x02, 0x1a, 0x00, 0x64, 0x2a, 0x09, 0x64, 0x05, 0x03, 0x1a, 0x43, 0x30, 0x2a, 0x46, 0x30, 0x85, 0x75, 0x15, 0xd4, 0x25, 0x37, 0x75, 0x07, 0x95, 0x10, 0x81, 0x22, 0x75, 0x03, 0x95, 0x01, 0x85, 0x75, 0x81, 0x01, 0x75, 0x01, 0x95, 0x01, 0x85, 0x75, 0x91, 0x01, 0x75, 0x04, 0x95, 0x01, 0x85, 0x75, 0xb1, 0x01, 0xc0, 0x05, 0x02, 0x09, 0x03, 0xa1, 0x01, 0x05, 0x03, 0x1a, 0xbc, 0x47, 0x2a, 0xc0, 0x47, 0x85, 0x86, 0x16, 0x69, 0xfd, 0x26, 0xc0, 0x02, 0x75, 0x0b, 0x95, 0x06, 0xb1, 0x22, 0x75, 0x06, 0x95, 0x01, 0x85, 0x86, 0xb1, 0x01, 0xc0, 0x05, 0x01, 0x09, 0x01, 0xa1, 0x01, 0x05, 0x01, 0x1a, 0x57, 0x52, 0x2a, 0x58, 0x52, 0x85, 0x6c, 0x16, 0x46, 0x1c, 0x26, 0xbd, 0x1c, 0x75, 0x0e, 0x95, 0x03, 0xb1, 0x22, 0x05, 0x02, 0x0a, 0xbd, 0x43, 0x05, 0x02, 0x0a, 0x3c, 0x4e, 0x05, 0x03, 0x1a, 0x2a, 0x20, 0x2a, 0x2b, 0x20, 0x05, 0x02, 0x1a, 0xd7, 0x0b, 0x2a, 0xd9, 0x0b, 0x85, 0x6c, 0x15, 0x05, 0x25, 0x07, 0x75, 0x03, 0x95, 0x07, 0x91, 0x22, 0x05, 0x01, 0x0a, 0x1f, 0x77, 0x05, 0x03, 0x0a, 0x20, 0x30, 0x85, 0x6c, 0x15, 0x08, 0x25, 0x0c, 0x75, 0x05, 0x95, 0x04, 0xb1, 0x22, 0x05, 0x01, 0x1a, 0xa8, 0x53, 0x2a, 0xa9, 0x53, 0x05, 0x01, 0x0a, 0x7c, 0x5d, 0x05, 0x02, 0x0a, 0x7b, 0x4c, 0x85, 0x6c, 0x15, 0x67, 0x25, 0x6f, 0x75, 0x08, 0x95, 0x0f, 0x81, 0x22, 0x05, 0x03, 0x0a, 0xde, 0x64, 0x85, 0x6c, 0x15, 0xbe, 0x25, 0xfb, 0x75, 0x08, 0x95, 0x05, 0x91, 0x22, 0x05, 0x03, 0x1a, 0xf5, 0x69, 0x2a, 0xf6, 0x69, 0x85, 0x6c, 0x15, 0xee, 0x25, 0xf4, 0x75, 0x08, 0x95, 0x04, 0x91, 0x22, 0x05, 0x02, 0x0a, 0x60, 0x24, 0x05, 0x03, 0x1a, 0xcc, 0x6e, 0x2a, 0xcd, 0x6e, 0x85, 0x6c, 0x16, 0xbf, 0xfd, 0x26, 0xa1, 0x0f, 0x75, 0x0d, 0x95, 0x06, 0xb1, 0x22, 0x05, 0x01, 0x0a, 0x17, 0x78, 0x05, 0x02, 0x0a, 0x66, 0x72, 0x85, 0x6c, 0x16, 0x34, 0x02, 0x26, 0x4c, 0x02, 0x75, 0x0a, 0x95, 0x02, 0x91, 0x22, 0x05, 0x01, 0x0a, 0xf7, 0x41, 0x05, 0x03, 0x1a, 0xf2, 0x55, 0x2a, 0xf3, 0x55, 0x05, 0x02, 0x0a, 0x4e, 0x5e, 0x85, 0x6c, 0x16, 0x27, 0x2b, 0x26, 0x1c, 0x3e, 0x75, 0x0f, 0x95, 0x0a, 0x81, 0x22, 0x05, 0x01, 0x1a, 0xa0, 0x6c, 0x2a, 0xa1, 0x6c, 0x85, 0x6c, 0x16, 0x06, 0x01, 0x26, 0xe3, 0x02, 0x75, 0x0b, 0x95, 0x0e, 0x91, 0x22, 0x75, 0x02, 0x95, 0x01, 0x85, 0x6c, 0x81, 0x01, 0x75, 0x05, 0x95, 0x01, 0x85, 0x6c, 0x91, 0x01, 0x75, 0x04, 0x95, 0x01, 0x85, 0x6c, 0xb1, 0x01, 0xc0 };
UCHAR Rd8 [] = { 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x01, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x03, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xef, 0x08, 0x1d, 0x00, 0x06, 0x80, 0x01, 0x55, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x03, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
UCHAR Rd9 [] = { 0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x01, 0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03, 0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05, 0x81, 0x03, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x09, 0x38, 0x15, 0x81, 0x25, 0x7f, 0x75, 0x08, 0x95, 0x03, 0x81, 0x06, 0xc0, 0xc0, 0x05, 0x01, 0x09, 0x80, 0xa1, 0x01, 0x85, 0x02, 0x09, 0x83, 0x09, 0x82, 0x09, 0x81, 0x25, 0x01, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xef, 0x05, 0x00, 0x00 };
HIDP_DATA data [] = { {2,0,1}, {2,0,0}, };
ULONG status, colLen, repLen; HIDP_DEVICE_DESC devDesc; USAGE usages [] = { 0x4, 0x2, 0x30, 0x32, 0x32, 0x07 }; UCHAR report [0x8]; ULONG usagesLength = sizeof usages / sizeof (USAGE);
memset (report, 0, sizeof report);
status = HidP_GetCollectionDescription (Rd9, sizeof Rd9, 0, &devDesc);
for (i=0; i<devDesc.CollectionDescLength; i++) { printf("______________Collection %d___________\n", i); printf("----------------VV %d VV---------------\n", i); flags.Flags = 0xF; HID_DumpPpd (devDesc.CollectionDesc[i].PreparsedData, flags); printf("----------------- %d ------------------\n", i); flags.Flags = 0xFF; HID_DumpPpd (devDesc.CollectionDesc[i].PreparsedData, flags); printf("---------------^^ %d ^^----------------\n", i);
}
#if 0
HidP_SetUsageValue (HidP_Feature, (USAGE) 0x85, 0, 0x66, 0xFFFFFFFF, devDesc.CollectionDesc[i].PreparsedData, report, sizeof report);
HidP_GetUsageValue (HidP_Feature, (USAGE) 0x85, 0, 0x66, &i, devDesc.CollectionDesc[i].PreparsedData, report, sizeof report);
i = 0; HidP_SetUsageValue (HidP_Feature, (USAGE) 0x85, 0, 0x67, 0xFFFFFFFF, devDesc.CollectionDesc[i].PreparsedData, report, sizeof report);
HidP_GetUsageValue (HidP_Feature, (USAGE) 0x85, 0, 0x67, &i, devDesc.CollectionDesc[i].PreparsedData, report, sizeof report);
i = 0; HidP_SetUsageValue (HidP_Feature, (USAGE) 0x85, 0, 0x68, 0xFFFFFFFF, devDesc.CollectionDesc[i].PreparsedData, report, sizeof report);
HidP_GetUsageValue (HidP_Feature, (USAGE) 0x85, 0, 0x68, &i, devDesc.CollectionDesc[i].PreparsedData, report, sizeof report);
HidP_UnsetUsages (HidP_Input, (USHORT) 0x09, 0, usages, &usagesLength, devDesc.CollectionDesc[i].PreparsedData, report, sizeof report);
usagesLength = 2; HidP_SetData (HidP_Feature, data, &usagesLength, devDesc.CollectionDesc[i].PreparsedData, report, sizeof report);
#endif
printf("Hello world\n"); }
VOID HID_DumpChannel ( PHIDP_CHANNEL_DESC Channel, HID_PPD_FLAGS Flags ) { printf ("-------CHANNEL---------\n"); printf ("P %x ID %x Col %x Sz %x Cnt %x UMin %x UMax %x ", Channel->UsagePage, Channel->ReportID, Channel->LinkCollection, Channel->ReportSize, Channel->ReportCount, Channel->Range.UsageMin, Channel->Range.UsageMax);
if (Channel->MoreChannels) { printf ("MoreChannels "); } if (Channel->IsConst) { printf ("Const "); } if (Channel->IsButton) { printf ("Button "); } else { printf ("Value "); } if (Channel->IsAbsolute) { printf ("Absolute "); } if (Channel->IsAlias) { printf ("ALIAS! "); }
printf ("\n");
if (Flags.FullChannelListing) { printf ("LinkUP %x LinkU %x SMin %x SMax %x " "DMin %x DMax %x IndexMin %x IndexMax %x\n", Channel->LinkUsagePage, Channel->LinkUsage, Channel->Range.StringMin, Channel->Range.StringMax, Channel->Range.DesignatorMin, Channel->Range.DesignatorMax, Channel->Range.DataIndexMin, Channel->Range.DataIndexMax);
if (!Channel->IsButton) { if (Channel->Data.HasNull) { printf ("Has Null "); } printf ("LMin %x LMax %x PMin %x PMax %x \n", Channel->Data.LogicalMin, Channel->Data.LogicalMax, Channel->Data.PhysicalMin, Channel->Data.PhysicalMax); } }
if (Flags.ReportLocation) { printf ("ByteOffset %x BitOffset %x BitLength %x ByteEnd %x\n", Channel->ByteOffset, Channel->BitOffset, Channel->BitLength, Channel->ByteEnd); } }
VOID HID_DumpLink ( ULONG LinkNo, PHIDP_LINK_COLLECTION_NODE Node ) { printf ("Link %x: U %x P %x Par %x #C %x NxSib %x 1stC %x ", LinkNo, Node->LinkUsage, Node->LinkUsagePage, Node->Parent, Node->NumberOfChildren, Node->NextSibling, Node->FirstChild);
if (Node->IsAlias) { printf (" ALIAS\n"); } else { printf ("\n"); } }
VOID HID_DumpPpd ( PHIDP_PREPARSED_DATA Ppd, HID_PPD_FLAGS Flags ) { ULONG i; PHIDP_CHANNEL_DESC channel; PHIDP_LINK_COLLECTION_NODE node;
if (!Flags.IgnoreSignature) { if ((HIDP_PREPARSED_DATA_SIGNATURE1 != Ppd->Signature1) || (HIDP_PREPARSED_DATA_SIGNATURE2 != Ppd->Signature2)) {
printf("Preparsed Data signature does not match, probably aint\n"); return; } }
if (Flags.InputChannels) { printf ("\n========== Input Channels =========\n"); for (i = Ppd->Input.Offset; i < Ppd->Input.Index; i++) { channel = &Ppd->Data [i]; HID_DumpChannel (channel, Flags); } } else { printf ("Input channels: off %x sz %x indx %x bytelen %x\n", Ppd->Input.Offset, Ppd->Input.Size, Ppd->Input.Index, Ppd->Input.ByteLen); }
if (Flags.OutputChannels) { printf ("\n========== Output Channels =========\n"); for (i = Ppd->Output.Offset; i < Ppd->Output.Index; i++) { channel = &Ppd->Data [i]; HID_DumpChannel (channel, Flags); }
} else { printf ("Output channels: off %x sz %x indx %x bytelen %x\n", Ppd->Output.Offset, Ppd->Output.Size, Ppd->Output.Index, Ppd->Output.ByteLen); }
if (Flags.FeatureChannels) { printf ("\n========== Feature Channels =========\n"); for (i = Ppd->Feature.Offset; i < Ppd->Feature.Index; i++) { channel = &Ppd->Data [i]; HID_DumpChannel (channel, Flags); }
} else { printf ("Feature channels: off %x sz %x indx %x bytelen %x\n", Ppd->Feature.Offset, Ppd->Feature.Size, Ppd->Feature.Index, Ppd->Feature.ByteLen); }
if (Flags.LinkCollections) { printf ("\n========== Link Collections =========\n"); node = (PHIDP_LINK_COLLECTION_NODE) (Ppd->RawBytes + Ppd->LinkCollectionArrayOffset);
for (i = 0; i < Ppd->LinkCollectionArrayLength; i++, node++) { HID_DumpLink (i, node); }
} else { printf ("Link Collections: %x \n", Ppd->LinkCollectionArrayLength); } printf ("\n"); }
|