C# Class LibUsbDotNet.WinUsb.WinUsbDevice

Contains members specific to Microsofts WinUSB driver.
A WinUsbDevice should be thought of as a part of, or an interface of a USB device. The WinUsbDevice class does not have members for selecting configurations and intefaces. This is done at a lower level by the winusb driver depending on which interface the WinUsbDevice belongs to.
Inheritance: UsbDevice, IUsbInterface
Datei anzeigen Open project: arvydas/BlinkStickDotNet Class Usage Examples

Public Methods

Method Description
Close ( ) : bool

Closes the UsbDevice and disposes any UsbDevice.ActiveEndpoints.

EndpointPolicies ( ReadEndpointID epNum ) : PipePolicies

Gets endpoint policies for the specified endpoint id.

EndpointPolicies ( WriteEndpointID epNum ) : PipePolicies

Gets endpoint policies for the specified endpoint id.

GetAssociatedInterface ( byte associatedInterfaceIndex, WinUsbDevice &usbDevice ) : bool

Gets an interface associated with this WinUsbDevice.

GetCurrentAlternateSetting ( byte &settingNumber ) : bool

Gets the currently selected alternate settings number for the selected inteface.

GetDevicePathList ( System.Guid interfaceGuid, List &devicePathList ) : bool

Gets a list a valid, connected WinUSB device inteface paths for the a given WinUSB device interface guid.

Open ( ) : bool

Opens the USB device handle.

Open ( string devicePath, WinUsbDevice &usbDevice ) : bool

Opens a WinUsb directly from the user supplied device path.

QueryDeviceSpeed ( DeviceSpeedTypes &deviceSpeed ) : bool

Gets the device speed.

QueryInterfaceSettings ( byte alternateInterfaceNumber, UsbInterfaceDescriptor &usbAltInterfaceDescriptor ) : bool

Gets a UsbInterfaceDescriptor for the specified AlternateInterfaceNumber,

Private Methods

Method Description
GetPowerPolicy ( PowerPolicyType policyType, int &valueLength, IntPtr pBuffer ) : bool
SetPowerPolicy ( PowerPolicyType policyType, int valueLength, IntPtr pBuffer ) : bool
WinUsbDevice ( UsbApiBase usbApi, SafeFileHandle usbHandle, SafeHandle handle, string devicePath ) : System

Method Details

Close() public method

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

EndpointPolicies() public method

Gets endpoint policies for the specified endpoint id.
public EndpointPolicies ( ReadEndpointID epNum ) : PipePolicies
epNum ReadEndpointID The endpoint ID to retrieve for.
return PipePolicies

EndpointPolicies() public method

Gets endpoint policies for the specified endpoint id.
public EndpointPolicies ( WriteEndpointID epNum ) : PipePolicies
epNum WriteEndpointID The endpoint ID to retrieve for.
return PipePolicies

GetAssociatedInterface() public method

Gets an interface associated with this WinUsbDevice.
public GetAssociatedInterface ( byte associatedInterfaceIndex, WinUsbDevice &usbDevice ) : bool
associatedInterfaceIndex byte The index to retrieve. (0 = next interface, 1= interface after next, etc.).
usbDevice WinUsbDevice A new class for the specified AssociatedInterfaceIndex.
return bool

GetCurrentAlternateSetting() public method

Gets the currently selected alternate settings number for the selected inteface.
public GetCurrentAlternateSetting ( byte &settingNumber ) : bool
settingNumber byte The selected AlternateSetting number.
return bool

GetDevicePathList() public static method

Gets a list a valid, connected WinUSB device inteface paths for the a given WinUSB device interface guid.
public static GetDevicePathList ( System.Guid interfaceGuid, List &devicePathList ) : bool
interfaceGuid System.Guid A WinUSB DeviceInterfaceGUID. This is set in the usb devices inf file when the drivers for it are installed.
devicePathList List A list of connected WinUSB device inteface paths.
return bool

Open() public method

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

Open() public static method

Opens a WinUsb directly from the user supplied device path.
public static Open ( string devicePath, WinUsbDevice &usbDevice ) : bool
devicePath string Device path (symbolic link) of the WinUsb device to open.
usbDevice WinUsbDevice Returns an opened WinUsb device on success, null on failure.
return bool

QueryDeviceSpeed() public method

Gets the device speed.
public QueryDeviceSpeed ( DeviceSpeedTypes &deviceSpeed ) : bool
deviceSpeed DeviceSpeedTypes The device speed.
return bool

QueryInterfaceSettings() public method

Gets a UsbInterfaceDescriptor for the specified AlternateInterfaceNumber,
public QueryInterfaceSettings ( byte alternateInterfaceNumber, UsbInterfaceDescriptor &usbAltInterfaceDescriptor ) : bool
alternateInterfaceNumber byte The alternate interface index for the to retrieve.
usbAltInterfaceDescriptor LibUsbDotNet.Descriptors.UsbInterfaceDescriptor The for the specified AlternateInterfaceNumber.
return bool