// public void read(byte[] into,IReadWriteListener listener, int timeout) public override void Read(HIDDevice.ReadCallback callback,int timeout) { if (IsReadInProgress) { callback.Invoke(__lastHIDReport); return; } //TODO: create fields (as read should be called after onRead) or better Object.pool _listener.ReadComplete = (bytes) => { this.__lastHIDReport.index=this.index; this.__lastHIDReport.Data=(byte[])bytes; this.__lastHIDReport.Status=HIDReport.ReadStatus.Success; callback.Invoke(this.__lastHIDReport); IsReadInProgress = false; }; IsReadInProgress = true; // UnityEngine.Debug.Log("GenericHIDDevice >>>>> try read"); _device.Call("read", new byte[_InputReportByteLength], _listener, 0); // UnityEngine.Debug.Log("GenericHIDDevice >>>>> read out"); }