private HidD_GetInputReport ( |
||
HidDeviceObject | ||
lpReportBuffer | Byte | |
ReportBufferLength | ||
return | System.Boolean |
public bool ReadInputReport(byte[] data) { if (safeReadHandle == null) { safeReadHandle = OpenHandle(_devicePath, true); } return(NativeMethods.HidD_GetInputReport(safeReadHandle, data, data.Length)); }
/// <summary> /// Reads an input report from the Control channel. This method provides access to report data for devices that /// do not use the interrupt channel to communicate for specific usages. /// </summary> /// <param name="reportId">The report ID to read from the device</param> /// <returns>The HID report that is read. The report will contain the success status of the read request</returns> /// public HidReport ReadReportSync(byte reportId) { byte[] cmdBuffer = new byte[Capabilities.InputReportByteLength]; cmdBuffer[0] = reportId; bool bSuccess = NativeMethods.HidD_GetInputReport(ReadHandle, cmdBuffer, cmdBuffer.Length); HidDeviceData deviceData = new HidDeviceData(cmdBuffer, bSuccess ? HidDeviceData.ReadStatus.Success : HidDeviceData.ReadStatus.NoDataRead); return(new HidReport(Capabilities.InputReportByteLength, deviceData)); }