Esempio n. 1
0
 public bool QueryInterfaceSettings(IntPtr InterfaceHandle, byte AlternateInterfaceNumber,
                                    ref USB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor)
 {
     return(WinUsb_QueryInterfaceSettings(InterfaceHandle, AlternateInterfaceNumber,
                                          ref UsbAltInterfaceDescriptor));
 }
Esempio n. 2
0
 private static extern bool WinUsb_QueryInterfaceSettings(IntPtr InterfaceHandle, byte AlternateInterfaceNumber,
                                                          ref USB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor);
Esempio n. 3
0
 public static bool QueryInterfaceSettings(IntPtr InterfaceHandle, byte AlternateInterfaceNumber,
     ref USB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor)
 {
     return WinUsb_QueryInterfaceSettings(InterfaceHandle, AlternateInterfaceNumber,
         ref UsbAltInterfaceDescriptor);
 }
Esempio n. 4
0
        protected virtual bool InitializeDevice()
        {
            try
            {
                var ifaceDescriptor = new USB_INTERFACE_DESCRIPTOR();
                var pipeInfo = new WINUSB_PIPE_INFORMATION();

                if (Usb.QueryInterfaceSettings(_winUsbHandle, 0, ref ifaceDescriptor))
                {
                    for (var i = 0; i < ifaceDescriptor.bNumEndpoints; i++)
                    {
                        Usb.QueryPipe(_winUsbHandle, 0, Convert.ToByte(i), ref pipeInfo);

                        if (((pipeInfo.PipeType == USBD_PIPE_TYPE.UsbdPipeTypeBulk) &
                             UsbEndpointDirectionIn(pipeInfo.PipeId)))
                        {
                            BulkIn = pipeInfo.PipeId;
                            Usb.FlushPipe(_winUsbHandle, BulkIn);
                        }
                        else if (((pipeInfo.PipeType == USBD_PIPE_TYPE.UsbdPipeTypeBulk) &
                                  UsbEndpointDirectionOut(pipeInfo.PipeId)))
                        {
                            BulkOut = pipeInfo.PipeId;
                            Usb.FlushPipe(_winUsbHandle, BulkOut);
                        }
                        else if ((pipeInfo.PipeType == USBD_PIPE_TYPE.UsbdPipeTypeInterrupt) &
                                 UsbEndpointDirectionIn(pipeInfo.PipeId))
                        {
                            IntIn = pipeInfo.PipeId;
                            Usb.FlushPipe(_winUsbHandle, IntIn);
                        }
                        else if ((pipeInfo.PipeType == USBD_PIPE_TYPE.UsbdPipeTypeInterrupt) &
                                 UsbEndpointDirectionOut(pipeInfo.PipeId))
                        {
                            IntOut = pipeInfo.PipeId;
                            Usb.FlushPipe(_winUsbHandle, IntOut);
                        }
                    }

                    return true;
                }

                return false;
            }
            catch (Exception ex)
            {
                Log.ErrorFormat("{0} {1}", ex.HelpLink, ex.Message);
                throw;
            }
        }
Esempio n. 5
0
 private static extern bool WinUsb_QueryInterfaceSettings(IntPtr InterfaceHandle, byte AlternateInterfaceNumber,
     ref USB_INTERFACE_DESCRIPTOR UsbAltInterfaceDescriptor);