Skip to main content

RawDevice Class

Package: GHIElectronics.Endpoint.Devices.UsbHost
Namespace: GHIElectronics.Endpoint.Devices.UsbHost

Provides low level access functionalities for the connected USB device. This is useful if there is not already a predefined driver for that device.

public class RawDevice : BaseDevice

Remarks​

Open it with the DeviceName of an Unknown device from UsbHostController ("/dev/bus/usb/001/005"). An interface that a driver of the board has is taken from it while the program uses it, and given back when the device is disposed.

Nested Types​

TypeKindSummary
RawDevice.PipeClassA USB communication pipe.

Constructors​

RawDevice(string deviceName)​

public RawDevice(string deviceName)

Opens the device that UsbHostController reported ("/dev/bus/usb/001/005").

Properties​

SetupTimeout​

public int SetupTimeout { get; set; }

The timeout of SendSetupPacket in milliseconds (0: none). Defaults to 5000 ms.

Returns int

Methods​

GetConfigurationDescriptor(byte configurationIndex)​

public Configuration GetConfigurationDescriptor(byte configurationIndex)

Gets the configuration descriptor.

ParameterTypeDescription
configurationIndexbyteThe configuration index.

Returns Configuration: The configuration descriptor.

GetDeviceDescriptor()​

public Device GetDeviceDescriptor()

Gets the device descriptor.

Returns Device: The device descriptor.

GetString(byte index)​

public string GetString(byte index)

Gets a string descriptor (the product's name...): its text, empty if the device has none.

ParameterTypeDescription
indexbyteThe string's index (Descriptors.Device.ProductIndex...).

Returns string

OpenPipe(Endpoint endpoint)​

public Pipe OpenPipe(Endpoint endpoint)

Opens a new communication pipe.

ParameterTypeDescription
endpointEndpointThe descriptor for the communication endpoint (bulk or interrupt).

Returns Pipe: The new pipe.

SendSetupPacket(byte requestType, byte request, ushort value, ushort index)​

public void SendSetupPacket(byte requestType, byte request, ushort value, ushort index)

Sends a USB setup packet.

ParameterTypeDescription
requestTypebyteThe request type, recipient, and direction.
requestbyteThe request to make.
valueushortThe value of the request.
indexushortThe index of the request.

SendSetupPacket(byte requestType, byte request, ushort value, ushort index, byte[] data, int dataOffset, int dataCount)​

public int SendSetupPacket(byte requestType, byte request, ushort value, ushort index, byte[] data, int dataOffset, int dataCount)

Sends a USB setup packet.

ParameterTypeDescription
requestTypebyteThe request type, recipient, and direction.
requestbyteThe request to make.
valueushortThe value of the request.
indexushortThe index of the request.
databyte[]The data to send or receive.
dataOffsetintThe offset into data at which to send or receive the data.
dataCountintThe number of bytes to send or receive into data starting at offset.

Returns int: The number of bytes sent or received.