itchcraft.backend

USB backend management

Classes

BulkTransferDevice

Abstract base class for USB devices with two bulk transfer

UsbBulkTransferDevice

USB device with two bulk transfer endpoints.

Module Contents

class itchcraft.backend.BulkTransferDevice

Bases: abc.ABC

Abstract base class for USB devices with two bulk transfer endpoints.

abstract bulk_transfer(request)

Sends a payload via USB bulk transfer and waits for a response from the device.

Parameters:

request (itchcraft.types.SizedPayload) – the request payload from the host.

Returns:

the response received from the device.

Return type:

bytes

property product_name: str | None
Abstractmethod:

Return type:

Optional[str]

Product name of the device that this backend represents.

property serial_number: str | None
Abstractmethod:

Return type:

Optional[str]

Serial number of the device that this backend represents.

class itchcraft.backend.UsbBulkTransferDevice(device)

Bases: BulkTransferDevice

USB device with two bulk transfer endpoints.

Parameters:

device (usb.core.Device) – the PyUSB device with which to initiate the bulk transfer.

MAX_RESPONSE_LENGTH = 12
device: usb.core.Device
endpoint_out: usb.core.Endpoint
endpoint_in: usb.core.Endpoint
bulk_transfer(request)

Sends a payload via USB bulk transfer and waits for a response from the device.

Parameters:

request (itchcraft.types.SizedPayload) – the request payload from the host.

Returns:

the response received from the device.

Return type:

bytes

property product_name: str | None

Product name of the device that this backend represents.

Return type:

Optional[str]

property serial_number: str | None

Serial number of the device that this backend represents.

Return type:

Optional[str]