UsbDeviceFinder Class

LibUsbDotNet

LibUsbDotNet 2.2.8 UsbDeviceFinder Class
Library ReferenceLibUsbDotNet.MainUsbDeviceFinder
LibUsbDotNet on SourceForge
Finds and identifies usb devices. Used for easily locating
Declaration Syntax
C# Visual Basic Visual C++
public class UsbDeviceFinder : ISerializable
Public Class UsbDeviceFinder _
	Implements ISerializable
public ref class UsbDeviceFinder : ISerializable
Members
All Members Constructors Methods Properties Fields



Icon Member Description
UsbDeviceFinder(Int32, Int32, Int32, String, Guid)
Creates a UsbDeviceFinder class for locating and identifying usb devices.

UsbDeviceFinder(Int32, Int32, String)
Creates a UsbDeviceFinder class for locating usb devices by VendorID, ProductID, and Serial number.

UsbDeviceFinder(Int32, Int32, Int32)
Creates a UsbDeviceFinder class for locating usb devices by VendorID, ProuctID, and Revision code.

UsbDeviceFinder(Int32, Int32)
Creates a UsbDeviceFinder class for locating usb devices vendor and product ID.

UsbDeviceFinder(Int32)
Creates a UsbDeviceFinder class for locating usb devices.

UsbDeviceFinder(String)
Creates a UsbDeviceFinder class for locating usb devices by a serial number.

UsbDeviceFinder(Guid)
Creates a UsbDeviceFinder class for locating usb devices by a unique Guid string.

Check(UsbRegistry)
Dynamic predicate find function. Pass this function into any method that has a Predicate<(Of <(<'T>)>)> parameter.

Check(UsbDevice)
Dynamic predicate find function. Pass this function into any method that has a Predicate<(Of <(<'T>)>)> parameter.

DeviceInterfaceGuid
The device interface guid string to find, or Empty to ignore.

GetObjectData(SerializationInfo, StreamingContext)
Store this class as a binary serializtion object.

Load(Stream)
Load usb device finder properties from a binary stream.

NO_GUID
The "exclude from search" value for DeviceInterfaceGuid.

NO_PID
The "exclude from search" value for Pid.

NO_REV
The "exclude from search" value for Revision.

NO_SERIAL
The "exclude from search" value for SerialNumber.

NO_VID
The "exclude from search" value for Vid.

Pid
The product id of the device to find.

Revision
The revision number of the device to find.

Save(UsbDeviceFinder, Stream)
Saves a UsbDeviceFinder instance to a stream.

SerialNumber
The serial number of the device to find.

Vid
The vendor id of the device to find.

Remarks
Examples
CopyC#
using System;
using LibUsbDotNet;
using LibUsbDotNet.Info;
using LibUsbDotNet.Main;
using System.Collections.ObjectModel;

namespace Examples
{
    internal class ShowInfo
    {
        public static UsbDevice MyUsbDevice;

        public static void Main(string[] args)
        {
            // Dump all devices and descriptor information to console output.
            UsbRegDeviceList allDevices = UsbDevice.AllDevices;
            foreach (UsbRegistry usbRegistry in allDevices)
            {
                if (usbRegistry.Open(out MyUsbDevice))
                {
                    Console.WriteLine(MyUsbDevice.Info.ToString());
                    for (int iConfig = 0; iConfig < MyUsbDevice.Configs.Count; iConfig++)
                    {
                        UsbConfigInfo configInfo = MyUsbDevice.Configs[iConfig];
                        Console.WriteLine(configInfo.ToString());

                        ReadOnlyCollection<UsbInterfaceInfo> interfaceList = configInfo.InterfaceInfoList;
                        for (int iInterface = 0; iInterface < interfaceList.Count; iInterface++)
                        {
                            UsbInterfaceInfo interfaceInfo = interfaceList[iInterface];
                            Console.WriteLine(interfaceInfo.ToString());

                            ReadOnlyCollection<UsbEndpointInfo> endpointList = interfaceInfo.EndpointInfoList;
                            for (int iEndpoint = 0; iEndpoint < endpointList.Count; iEndpoint++)
                            {
                                Console.WriteLine(endpointList[iEndpoint].ToString());
                            }
                        }
                    }
                }
            }


            // Free usb resources.
            // This is necessary for libusb-1.0 and Linux compatibility.
            UsbDevice.Exit();

            // Wait for user input..
            Console.ReadKey();
        }
    }
}
Inheritance Hierarchy
Object
UsbDeviceFinder

Assembly: LibUsbDotNet (Module: LibUsbDotNet) Version: 2.2.8.104 (2.2.8.104)