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.

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)​

def __init__(self, deviceName: str):

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

Properties​

SetupTimeout​

SetupTimeout: int # @property / @setter

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

Returns int

Methods​

GetConfigurationDescriptor(byte configurationIndex)​

def GetConfigurationDescriptor(self, configurationIndex: int) -> Configuration:

Gets the configuration descriptor.

ParameterTypeDescription
configurationIndexbyteThe configuration index.

Returns Configuration: The configuration descriptor.

GetDeviceDescriptor()​

def GetDeviceDescriptor(self) -> Device:

Gets the device descriptor.

Returns Device: The device descriptor.

GetString(byte index)​

def GetString(self, index: int) -> str:

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)​

def OpenPipe(self, endpoint: Endpoint) -> Pipe:

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)​

def SendSetupPacket(self, requestType: int, request: int, value: int, index: int) -> None:

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)​

def SendSetupPacket(self, requestType: int, request: int, value: int, index: int, data: list[int], dataOffset: int, dataCount: int) -> int:

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.