C# Class LibUsbDotNet.LibUsb.LibUsbDevice

Contains members that are specific to the LibUsb-Win32 driver.
Use the T:LibUsbDotNet.UsbDevice class instead to allow your code to work with either LibUsb or WinUsb.
Inheritance: UsbDevice, IUsbDevice
Show file Open project: arvydas/BlinkStickDotNet Class Usage Examples

Public Methods

Method Description
ClaimInterface ( int interfaceID ) : bool

Claims the specified interface of the device.

Close ( ) : bool

Closes the UsbDevice and disposes any UsbDevice.ActiveEndpoints.

Open ( ) : bool

Opens the USB device handle.

Open ( string deviceFilename, LibUsbDevice &usbDevice ) : bool

Opens the USB device for communucation.

ReleaseAllInterfaces ( ) : int

Releases all interface claimed by ClaimInterface.

ReleaseInterface ( ) : bool

Releases the last interface claimed by ClaimInterface.

ReleaseInterface ( int interfaceID ) : bool

Releases an interface that was previously claimed with ClaimInterface.

ResetDevice ( ) : bool

Sends a usb device reset command.

After calling ResetDevice, the LibUsbDevice instance is disposed and no longer usable. A new LibUsbDevice instance must be obtained from the device list.

SetAltInterface ( int alternateID ) : bool

Sets an alternate interface for the most recent claimed interface.

SetAltInterface ( int interfaceID, int alternateID ) : bool

Sets an alternate interface for the specified interface.

SetConfiguration ( byte config ) : bool

Sets the USB devices active configuration value.

A USB device can have several different configurations, but only one active configuration.

Private Methods

Method Description
ControlTransferEx ( UsbSetupPacket setupPacket, IntPtr buffer, int bufferLength, int &lengthTransferred, int timeout ) : bool
LibUsbDevice ( UsbApiBase api, SafeHandle usbHandle, string deviceFilename ) : System
UsbIoSync ( int controlCode, Object inBuffer, int inSize, IntPtr outBuffer, int outSize, int &ret ) : bool

Method Details

ClaimInterface() public method

Claims the specified interface of the device.
public ClaimInterface ( int interfaceID ) : bool
interfaceID int The interface to claim.
return bool

Close() public method

Closes the UsbDevice and disposes any UsbDevice.ActiveEndpoints.
public Close ( ) : bool
return bool

Open() public method

Opens the USB device handle.
public Open ( ) : bool
return bool

Open() public static method

Opens the USB device for communucation.
public static Open ( string deviceFilename, LibUsbDevice &usbDevice ) : bool
deviceFilename string The LibUsb device filename to open.
usbDevice LibUsbDevice The newly created UsbDevice.
return bool

ReleaseAllInterfaces() public method

Releases all interface claimed by ClaimInterface.
public ReleaseAllInterfaces ( ) : int
return int

ReleaseInterface() public method

Releases the last interface claimed by ClaimInterface.
public ReleaseInterface ( ) : bool
return bool

ReleaseInterface() public method

Releases an interface that was previously claimed with ClaimInterface.
public ReleaseInterface ( int interfaceID ) : bool
interfaceID int The interface to release.
return bool

ResetDevice() public method

Sends a usb device reset command.
After calling ResetDevice, the LibUsbDevice instance is disposed and no longer usable. A new LibUsbDevice instance must be obtained from the device list.
public ResetDevice ( ) : bool
return bool

SetAltInterface() public method

Sets an alternate interface for the most recent claimed interface.
public SetAltInterface ( int alternateID ) : bool
alternateID int The alternate interface to select for the most recent claimed interface See .
return bool

SetAltInterface() public method

Sets an alternate interface for the specified interface.
public SetAltInterface ( int interfaceID, int alternateID ) : bool
interfaceID int The interface index to specify an alternate setting for.
alternateID int The alternate interface setting.
return bool

SetConfiguration() public method

Sets the USB devices active configuration value.
A USB device can have several different configurations, but only one active configuration.
public SetConfiguration ( byte config ) : bool
config byte The active configuration value. A zero value means the device is not configured and a non-zero value indicates the device is configured.
return bool