private static HidDeviceCapabilities GetDeviceCapabilities(IntPtr hidHandle) { NativeMethods.HIDP_CAPS capabilities = default(NativeMethods.HIDP_CAPS); IntPtr preparsedData = default(IntPtr); if (NativeMethods.HidD_GetPreparsedData(hidHandle, ref preparsedData)) { NativeMethods.HidP_GetCaps(preparsedData, ref capabilities); NativeMethods.HidD_FreePreparsedData(preparsedData); } return(new HidDeviceCapabilities(capabilities)); }
internal HidDeviceCapabilities(NativeMethods.HIDP_CAPS capabilities) { Usage = capabilities.Usage; UsagePage = capabilities.UsagePage; InputReportByteLength = capabilities.InputReportByteLength; OutputReportByteLength = capabilities.OutputReportByteLength; FeatureReportByteLength = capabilities.FeatureReportByteLength; Reserved = capabilities.Reserved; NumberLinkCollectionNodes = capabilities.NumberLinkCollectionNodes; NumberInputButtonCaps = capabilities.NumberInputButtonCaps; NumberInputValueCaps = capabilities.NumberInputValueCaps; NumberInputDataIndices = capabilities.NumberInputDataIndices; NumberOutputButtonCaps = capabilities.NumberOutputButtonCaps; NumberOutputValueCaps = capabilities.NumberOutputValueCaps; NumberOutputDataIndices = capabilities.NumberOutputDataIndices; NumberFeatureButtonCaps = capabilities.NumberFeatureButtonCaps; NumberFeatureValueCaps = capabilities.NumberFeatureValueCaps; NumberFeatureDataIndices = capabilities.NumberFeatureDataIndices; }