Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions contrib/drivers/dutlink/jumpstarter_driver_dutlink/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ def control(self, direction, ty, actions, action, value):
return str_value


@dataclass(kw_only=True)
class DutlinkSerial(DutlinkConfig, PySerial):
url: str | None = field(init=False, default=None)
Comment thread
NickCao marked this conversation as resolved.

def __post_init__(self):
super().__post_init__()

self.url = self.tty

super(PySerial, self).__post_init__()


@dataclass(kw_only=True)
class DutlinkPower(DutlinkConfig, PowerInterface, Driver):
last_action: str | None = field(default=None)
Expand Down Expand Up @@ -199,7 +211,7 @@ async def write(self, src: str):
async for chunk in res:
await stream.send(chunk)
if total_bytes > next_print:
log.debug(f"{self.storage_device} written {total_bytes/(1024*1024)} MB")
log.debug(f"{self.storage_device} written {total_bytes / (1024 * 1024)} MB")
next_print += 50 * 1024 * 1024
total_bytes += len(chunk)

Expand Down Expand Up @@ -252,13 +264,12 @@ def __post_init__(self):
self.children["console"] = PySerial(url=self.alternate_console, baudrate=self.baudrate)
except SerialException:
log.info(
f"failed to open alternate console {self.alternate_console} "
"but trying to power on the target once"
f"failed to open alternate console {self.alternate_console} but trying to power on the target once"
)
self.children["power"].on()
time.sleep(5)
self.children["console"] = PySerial(url=self.alternate_console, baudrate=self.baudrate)
self.children["power"].off()
else:
# otherwise look up the tty console provided by dutlink
self.children["console"] = PySerial(url=self.tty, baudrate=self.baudrate)
self.children["console"] = DutlinkSerial(serial=self.serial, baudrate=self.baudrate)
74 changes: 37 additions & 37 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.