When I run it, the allDevices list is empty.
I started a new VB.NET console project, and installed Nuget LibUsbDotNet.
My code is this:
Imports System
Imports LibUsbDotNet
Imports LibUsbDotNet.Info
Imports LibUsbDotNet.Main
Imports System.Collections.ObjectModel
Module Module1
Public MyUsbDevice As UsbDevice
Public Sub Main(args As String())
' Dump all devices and descriptor information to console output.
Dim allDevices As UsbRegDeviceList = UsbDevice.AllDevices
For Each usbRegistry As UsbRegistry In allDevices
If usbRegistry.Open(MyUsbDevice) Then
Console.WriteLine(MyUsbDevice.Info.ToString())
For iConfig As Integer = 0 To MyUsbDevice.Configs.Count - 1
Dim configInfo As UsbConfigInfo = MyUsbDevice.Configs(iConfig)
Console.WriteLine(configInfo.ToString())
Dim interfaceList As ReadOnlyCollection(Of UsbInterfaceInfo) = configInfo.InterfaceInfoList
For iInterface As Integer = 0 To interfaceList.Count - 1
Dim interfaceInfo As UsbInterfaceInfo = interfaceList(iInterface)
Console.WriteLine(interfaceInfo.ToString())
Dim endpointList As ReadOnlyCollection(Of UsbEndpointInfo) = interfaceInfo.EndpointInfoList
For iEndpoint As Integer = 0 To endpointList.Count - 1
Console.WriteLine(endpointList(iEndpoint).ToString())
Next
Next
Next
End If
Next
' Free usb resources.
' This is necessary for libusb-1.0 and Linux compatibility.
UsbDevice.[Exit]()
' Wait for user input..
Console.ReadKey()
End Sub
End Module
MY DESKTOP USB DEVICES...
I believe my desktop that I was doing this on is too old, though I recently upgraded to Win 10. So solve problem, I used new Win 10 laptop, installed and ran filter (sub-)driver and selected my laptop's webcam (as a test VID&PID), installed libUsb-Win32, created a .NET console project (I did both VB and C#), did VS > proj > Refs > NUGET > browsed LibUsbDotNet, installed it, pasted the 1st example from Sourceforge's libUsbDotNet, and it worked great: It connected to the webcam driver (selected by the filter sub-driver), and read the correct VID&PID. (example reported error because webcam driver did not respond to polling, but this is expected).