예제 #1
0
        public bool ResetDevice(SafeHandle interfaceHandle)
        {
            LibUsbRequest req = new LibUsbRequest();

            int ret;

            req.Timeout = UsbConstants.DEFAULT_TIMEOUT;
            return(LibUsbDriverIO.UsbIOSync(interfaceHandle, LibUsbIoCtl.RESET_DEVICE, req, LibUsbRequest.Size, IntPtr.Zero, 0, out ret));
        }
예제 #2
0
        public override bool AbortPipe(SafeHandle interfaceHandle, byte pipeID)
        {
            LibUsbRequest req = new LibUsbRequest();

            int ret;

            req.Endpoint.ID = pipeID;
            req.Timeout     = UsbConstants.DEFAULT_TIMEOUT;
            return(LibUsbDriverIO.UsbIOSync(interfaceHandle, LibUsbIoCtl.ABORT_ENDPOINT, req, LibUsbRequest.Size, IntPtr.Zero, 0, out ret));
        }
예제 #3
0
        public override bool GetDescriptor(SafeHandle interfaceHandle,
                                           byte descriptorType,
                                           byte index,
                                           ushort languageID,
                                           IntPtr buffer,
                                           int bufferLength,
                                           out int lengthTransferred)
        {
            LibUsbRequest req = new LibUsbRequest();

            req.Descriptor.Index     = index;
            req.Descriptor.LangID    = languageID;
            req.Descriptor.Recipient = (byte)UsbEndpointDirection.EndpointIn & 0x1F;
            req.Descriptor.Type      = descriptorType;
            return(LibUsbDriverIO.UsbIOSync(interfaceHandle,
                                            LibUsbIoCtl.GET_DESCRIPTOR,
                                            req,
                                            LibUsbRequest.Size,
                                            buffer,
                                            bufferLength,
                                            out lengthTransferred));
        }