1.1 --- a/HidDevice.cs Sun Feb 15 10:50:09 2015 +0100
1.2 +++ b/HidDevice.cs Sun Feb 15 11:53:36 2015 +0100
1.3 @@ -19,9 +19,18 @@
1.4 public ushort VendorId { get; private set; }
1.5 public ushort ProductId { get; private set; }
1.6 public ushort Version { get; private set; }
1.7 + //Pre-parsed HID descriptor
1.8 public IntPtr PreParsedData {get; private set;}
1.9 + //Info
1.10 public RID_DEVICE_INFO Info { get {return iInfo;} }
1.11 private RID_DEVICE_INFO iInfo;
1.12 + //Capabilities
1.13 + public HIDP_CAPS Capabilities { get { return iCapabilities; } }
1.14 + private HIDP_CAPS iCapabilities;
1.15 + //Input Button Capabilities
1.16 + public HIDP_BUTTON_CAPS[] InputButtonCapabilities { get { return iInputButtonCapabilities; } }
1.17 + private HIDP_BUTTON_CAPS[] iInputButtonCapabilities;
1.18 +
1.19
1.20 /// <summary>
1.21 /// Class constructor will fetch this object properties from HID sub system.
1.22 @@ -115,6 +124,24 @@
1.23 }
1.24
1.25 handle.Close();
1.26 +
1.27 + //Get capabilities
1.28 + HidStatus status = Win32.Function.HidP_GetCaps(PreParsedData, ref iCapabilities);
1.29 + if (status != HidStatus.HIDP_STATUS_SUCCESS)
1.30 + {
1.31 + throw new Exception("HidDevice: HidP_GetCaps failed: " + status.ToString());
1.32 + }
1.33 +
1.34 + //Get input button caps
1.35 + iInputButtonCapabilities = new HIDP_BUTTON_CAPS[Capabilities.NumberInputButtonCaps];
1.36 + ushort buttonCapabilitiesLength = Capabilities.NumberInputButtonCaps;
1.37 + status = Win32.Function.HidP_GetButtonCaps(HIDP_REPORT_TYPE.HidP_Input, iInputButtonCapabilities, ref buttonCapabilitiesLength, PreParsedData);
1.38 + if (status != HidStatus.HIDP_STATUS_SUCCESS || buttonCapabilitiesLength != Capabilities.NumberInputButtonCaps)
1.39 + {
1.40 + throw new Exception("HidDevice: HidP_GetButtonCaps failed: " + status.ToString());
1.41 + }
1.42 +
1.43 +
1.44 }
1.45
1.46 /// <summary>