LibUsbDotNet 2.2.8
UsbErrorEvent Event
Library ReferenceLibUsbDotNetUsbDeviceUsbErrorEvent
LibUsbDotNet on SourceForge
Global static error event for all Usb errors.
Declaration Syntax
C#Visual BasicVisual C++
public static event EventHandler<UsbError> UsbErrorEvent
Public Shared Event UsbErrorEvent As EventHandler(Of UsbError)
static  event EventHandler<UsbError^>^ UsbErrorEvent {
	void add (EventHandler<UsbError^>^ value);
	void remove (EventHandler<UsbError^>^ value);
Sample code to reset an endpoint if a critical error occurs.
 // Hook the usb error handler function
 UsbGlobals.UsbErrorEvent += UsbErrorEvent;
private void UsbErrorEvent(object sender, UsbError e)
 // If the error is from a usb endpoint
 if (sender is UsbEndpointBase)
     // If the endpoint transfer failed
     if (e.Win32ErrorNumber == 31)
         // If the USB device is still open, connected, and valid
         if (usb.IsOpen)
             // Try to reset then endpoint
             if (((UsbEndpointBase) sender).Reset())
                 // Endpoint reset successful.
                 // Tell LibUsbDotNet to ignore this error and continue.
                 e.Handled = true;

Assembly: LibUsbDotNet (Module: LibUsbDotNet) Version: (