title: LibUsbDotNet open device -> Device not found
body: <p>I have usbasp programmer for AVR microcontrollers. This programmer uses libusb library. I've managed to connect it to pc, system detected new device and I managed to install driver for this device. It works well since I'm able to program AVR chips with it. So hardware part is 100% OK.</p>
  
  <p>Now software part:
  Using simple iterating over my libusb-win32 devices using LibUsbDotNet I find 2 devices. Both of them are named the same (and have same VID and PID) so I think this is composite device. Second one has some data in it. This is well shown on screenshots bellow.</p>
  
  <p><img src="https://i.stack.imgur.com/FhTzG.jpg" alt="USB1"></p>
  
  <p><img src="https://i.stack.imgur.com/817bV.jpg" alt="USB2"></p>
  
  <p><img src="https://i.stack.imgur.com/KQ6PL.jpg" alt="USB3"></p>
  
  <p>And the code (it is just copy pasted from the examples)</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using LibUsbDotNet;
  using LibUsbDotNet.Info;
  using LibUsbDotNet.Main;
  
  
  namespace USB_Test_CLI_CS {
      class Program {
  
          public static readonly int VendorID = 0x16C0;
          public static readonly int ProductID = 0x05DC;
  
          public static void Main(string[] args) {
              UsbDevice usbDevice = null;
  
              UsbRegDeviceList allDevices = UsbDevice.AllDevices;
  
              Console.WriteLine("Found {0} devices", allDevices.Count);
  
              foreach (UsbRegistry usbRegistry in allDevices) {
                  Console.WriteLine("Got device: {0}\r\n", usbRegistry.FullName);
  
                  if (usbRegistry.Open(out usbDevice)) {
                      Console.WriteLine("Device Information\r\n------------------");
  
                      Console.WriteLine("{0}", usbDevice.Info.ToString());
  
                      Console.WriteLine("VID &amp; PID: {0} {1}", usbDevice.Info.Descriptor.VendorID, usbDevice.Info.Descriptor.ProductID);
  
                      Console.WriteLine("\r\nDevice configuration\r\n--------------------");
                      foreach (UsbConfigInfo usbConfigInfo in usbDevice.Configs) {
                          Console.WriteLine("{0}", usbConfigInfo.ToString());
  
                          Console.WriteLine("\r\nDevice interface list\r\n---------------------");
                          IReadOnlyCollection&lt;UsbInterfaceInfo&gt; interfaceList = usbConfigInfo.InterfaceInfoList;
                          foreach (UsbInterfaceInfo usbInterfaceInfo in interfaceList) {
                              Console.WriteLine("{0}", usbInterfaceInfo.ToString());
  
                              Console.WriteLine("\r\nDevice endpoint list\r\n--------------------");
                              IReadOnlyCollection&lt;UsbEndpointInfo&gt; endpointList = usbInterfaceInfo.EndpointInfoList;
                              foreach (UsbEndpointInfo usbEndpointInfo in endpointList) {
                                  Console.WriteLine("{0}", usbEndpointInfo.ToString());
                              }
                          }
                      }
                      usbDevice.Close();
                  }
                  Console.WriteLine("\r\n----- Device information finished -----\r\n");
              }
  
  
  
              Console.WriteLine("Trying to find our device: {0} {1}", VendorID, ProductID);
              UsbDeviceFinder usbDeviceFinder = new UsbDeviceFinder(VendorID, ProductID);
  
              // This does not work !!! WHY ?
              usbDevice = UsbDevice.OpenUsbDevice(usbDeviceFinder);
  
              if (usbDevice != null) {
                  Console.WriteLine("OK");
              } else {
                  Console.WriteLine("FAIL");
              }
  
              UsbDevice.Exit();
  
              Console.Write("Press anything to close");
              Console.ReadKey();
          }
  
      }
  }
  </code></pre>
  
  <p>Here's output of this program</p>
  
  <pre><code>Found 2 devices
  Got device: Van Ooijen Technische Informatica - USBasp
  
  
  ----- Device information finished -----
  
  Got device: Van Ooijen Technische Informatica - USBasp
  
  Device Information
  ------------------
  Length:18
  DescriptorType:Device
  BcdUsb:0x0110
  Class:VendorSpec
  SubClass:0x00
  Protocol:0x00
  MaxPacketSize0:8
  VendorID:0x16C0
  ProductID:0x05DC
  BcdDevice:0x0103
  ManufacturerStringIndex:1
  ProductStringIndex:2
  SerialStringIndex:0
  ConfigurationCount:1
  ManufacturerString:www.fischl.de
  ProductString:USBasp
  SerialString:
  
  VID &amp; PID: 5824 1500
  
  Device configuration
  --------------------
  Length:9
  DescriptorType:Configuration
  TotalLength:18
  InterfaceCount:1
  ConfigID:1
  StringIndex:0
  Attributes:0x80
  MaxPower:25
  ConfigString:
  
  
  Device interface list
  ---------------------
  Length:9
  DescriptorType:Interface
  InterfaceID:0
  AlternateID:0
  EndpointCount:0
  Class:PerInterface
  SubClass:0x00
  Protocol:0x00
  StringIndex:0
  InterfaceString:
  
  
  Device endpoint list
  --------------------
  
  ----- Device information finished -----
  
  Trying to find our device: 5824 1500
  FAIL
  Press anything to close
  </code></pre>
  
  <p>What I'd like to get is this simple code to detect this device which IS present (since simple iteration over all devices finds it and other tool "USB Cfg Interrogator" find it too).
  This has been asked before but there were no constructive answer.</p>
  
  <p>I also could use libusb-win32 c++ library and create some C# wrappers for it but if it is not needed and I can use LibUsbDotNet library I'd like to use it instead of creating wrappers myself.</p>