Squishy Device¶
Todo
Flesh this out
- class squishy.device.SquishyDevice(dev: USBDevice, serial: str, timeout: int = 2500)¶
Squishy Hardware Device
This class represents a Squishy hardware device that is attached to the host, it exposes a common and stable API for interacting with Squishy devices.
- Parameters:
- Variables:
- classmethod get_device(*, serial: str | None = None, first: bool = True) Self | None ¶
Returns an instance of the first
SquishyDevice
attached to the system, or ifserial
is specified the device with that serial number, if possible.If there are no Squishy devices attached to the host system, or one with
serial
is not found None is returned instead.- Parameters:
- Returns:
The requested Squishy device if found, otherwise None
- Return type:
SquishyDevice | None
- classmethod enumerate() list[tuple[str, tuple[int, int], USBDevice]] ¶
Collect all of the attached Squishy devices.
- Returns:
A collection of Squishy hardware devices attached to the system.
- Return type:
list[DeviceContainer]
- static generate_serial() str ¶
Generate a new serial number string for a Squishy device.
The current implementation uses the current datetime in an ISO 8601-like format.
- Returns:
The new serial number.
- Return type:
- can_dfu() bool ¶
Determine whether or not this device is DFU capable.
- Returns:
True if the given USB device is DFU capable, otherwise False
- Return type:
- get_altmodes() dict[int, str] ¶
Collect and return all of the DFU alt-modes and their name from the device.
- Returns:
A mapping of the alt-mode endpoint and it’s name.
- Return type:
- Raises:
RuntimeError – If the DFU interface is unknown, or the DFU control request times out.
AssertionError – If we lose the DFU configuration or interface somehow.
- reset() bool ¶
Invoke a DFU detach.
- Returns:
True if the detach was successful, otherwise False
- Return type:
- Raises:
RuntimeError – If the DFU interface is unknown, or the DFU control request times out.
- upload(data: bytes, altmode: int, progress: Progress | None = None) bool ¶
Push firmware/gateware to device.
- Parameters:
- Returns:
Upload was successful, otherwise False
- Return type:
- Raises:
RuntimeError – If the DFU interface is unknown, the DFU control request times out, or we can’t determine the transaction size
- get_platform() type[SquishyPlatform | Platform] | None ¶
Get the type Torii platform definition for the currently attached device.
- Returns:
The type Torii platform definition for this device if found, otherwise None
- Return type:
type[SquishyPlatformType] | None