Esempio n. 1
0
        public bool GetInput(int rptID)
        {
            if (_Inputs.RptByteLen == 0)
            {
                return(false);
            }
            if (!RwAccessible)
            {
                return(false);
            }

            _Inputs.Clear();
            _Inputs.DataBuf[0] = (byte)rptID;

            // ReadFile will hang if the device does not have an input report ready.
            //int bytesRead = 0;
            //return PInvoke.ReadFile(_hDevice, ref _Inputs.DataBuf[0], _Inputs.RptByteLen, ref bytesRead, null);

            // GetInputReport always returns right away
            fixed(byte *buf = _Inputs.DataBuf)
            {
                return(PInvoke.HidD_GetInputReport(_hDevice, _Inputs.DataBuf, _Inputs.RptByteLen));
            }

            //return PInvoke.HidD_GetInputReport(_hDevice, ref _Inputs.DataBuf[0], _Inputs.RptByteLen);
        }