コード例 #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);
        }
コード例 #2
0
        public bool GetFeature(int rptID)
        {
            if (_Features.RptByteLen == 0)
            {
                return(false);
            }
            //if (!RwAccessible) return false;

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

            fixed(byte *buf = _Features.DataBuf)
            {
                return(PInvoke.HidD_GetFeature(_hDevice, _Features.DataBuf, _Features.RptByteLen));
            }

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