LibUsbDotNet 2.2.8
UsbDeviceFinder Class
Library Reference ► LibUsbDotNet.Main ► UsbDeviceFinder
|
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
- Instances of this class can optionally be passed directly into OpenUsbDevice(UsbDeviceFinder) to quickly find and open a specific usb device in one step.
- Pass instances of this class into the Find(UsbDeviceFinder), FindAll(UsbDeviceFinder), or FindLast(UsbDeviceFinder) functions of a UsbRegDeviceList instance to find connected usb devices without opening devices or interrogating the bus. After locating the required UsbRegistry instance, call the Open(UsbDevice%) method to start using the UsbDevice instance.
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 |