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
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
@dataclass(kw_only=True)
class DutlinkConfig:
serial: str | None = field(default=None)
timeout_s: int = field(default=20) # 20 seconds, power control sequences can block USB for a long time

dev: usb.core.Device = field(init=False)
itf: usb.core.Interface = field(init=False)
Expand Down Expand Up @@ -52,6 +53,7 @@ def __post_init__(self):
if not self.tty:
raise RuntimeError(f"no console found for the dutlink board with serial {serial}")

self.dev.default_timeout = self.timeout_s * 1000
return

raise FileNotFoundError("failed to find dutlink device")
Expand Down Expand Up @@ -227,7 +229,6 @@ async def read(self, dst: str):
@dataclass(kw_only=True)
class Dutlink(DutlinkConfig, CompositeInterface, Driver):
alternate_console: str | None = field(default=None)
timeout_s: int = field(default=20) # 20 seconds, power control sequences can block USB for a long time
storage_device: str
baudrate: int = field(default=115200)

Expand All @@ -252,10 +253,9 @@ class Dutlink(DutlinkConfig, CompositeInterface, Driver):
def __post_init__(self):
super().__post_init__()

self.dev.default_timeout = self.timeout_s * 1000

self.children["power"] = DutlinkPower(serial=self.serial)
self.children["storage"] = DutlinkStorageMux(serial=self.serial, storage_device=self.storage_device)
self.children["power"] = DutlinkPower(serial=self.serial, timeout_s=self.timeout_s)
self.children["storage"] = DutlinkStorageMux(serial=self.serial, storage_device=self.storage_device,
timeout_s=self.timeout_s)
Comment on lines +256 to +258
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Add timeout_s parameter to DutlinkSerial instantiation

For consistency with DutlinkPower and DutlinkStorageMux, pass the timeout_s parameter to DutlinkSerial:

  • self.children["console"] = DutlinkSerial(serial=self.serial, baudrate=self.baudrate, timeout_s=self.timeout_s)
🔗 Analysis chain

Verify if DutlinkSerial needs the timeout parameter.

The timeout is propagated to DutlinkPower and DutlinkStorageMux, but DutlinkSerial might also need it since it inherits from DutlinkConfig.

Run this script to analyze the inheritance and timeout usage:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Analyze DutlinkSerial's inheritance chain and timeout usage

# Search for DutlinkSerial class definition and its base classes
ast-grep --pattern 'class DutlinkSerial($_)'

# Search for timeout usage in PySerial
rg -A 5 "timeout" --type python | grep -C 5 "class PySerial"

Length of output: 138


Script:

#!/bin/bash
# Search for DutlinkSerial class definition and inheritance
ast-grep --pattern 'class DutlinkSerial'

# Find all references to DutlinkSerial
rg "DutlinkSerial" -A 5 --type py

# Search for DutlinkConfig class and its timeout usage
ast-grep --pattern 'class DutlinkConfig'
rg "DutlinkConfig.*timeout" --type py

# Find timeout parameter usage in constructor
ast-grep --pattern 'def __init__($$$timeout$$$)'

Length of output: 984


Script:

#!/bin/bash
# Get DutlinkConfig implementation
rg -A 10 "class DutlinkConfig" --type py

# Get implementation of similar classes
rg -A 10 "class DutlinkPower|class DutlinkStorageMux" --type py

# Find all timeout-related parameters in the file
rg "timeout" --type py packages/jumpstarter-driver-dutlink/jumpstarter_driver_dutlink/driver.py

Length of output: 4217


# if an alternate serial port has been requested, use it
if self.alternate_console is not None:
Expand Down
20 changes: 0 additions & 20 deletions uv.lock

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