24
24
@dataclass (kw_only = True )
25
25
class DutlinkConfig :
26
26
serial : str | None = field (default = None )
27
+ timeout_s : int = field (default = 20 ) # 20 seconds, power control sequences can block USB for a long time
27
28
28
29
dev : usb .core .Device = field (init = False )
29
30
itf : usb .core .Interface = field (init = False )
@@ -52,6 +53,7 @@ def __post_init__(self):
52
53
if not self .tty :
53
54
raise RuntimeError (f"no console found for the dutlink board with serial { serial } " )
54
55
56
+ self .dev .default_timeout = self .timeout_s * 1000
55
57
return
56
58
57
59
raise FileNotFoundError ("failed to find dutlink device" )
@@ -227,7 +229,6 @@ async def read(self, dst: str):
227
229
@dataclass (kw_only = True )
228
230
class Dutlink (DutlinkConfig , CompositeInterface , Driver ):
229
231
alternate_console : str | None = field (default = None )
230
- timeout_s : int = field (default = 20 ) # 20 seconds, power control sequences can block USB for a long time
231
232
storage_device : str
232
233
baudrate : int = field (default = 115200 )
233
234
@@ -252,10 +253,9 @@ class Dutlink(DutlinkConfig, CompositeInterface, Driver):
252
253
def __post_init__ (self ):
253
254
super ().__post_init__ ()
254
255
255
- self .dev .default_timeout = self .timeout_s * 1000
256
-
257
- self .children ["power" ] = DutlinkPower (serial = self .serial )
258
- self .children ["storage" ] = DutlinkStorageMux (serial = self .serial , storage_device = self .storage_device )
256
+ self .children ["power" ] = DutlinkPower (serial = self .serial , timeout_s = self .timeout_s )
257
+ self .children ["storage" ] = DutlinkStorageMux (serial = self .serial , storage_device = self .storage_device ,
258
+ timeout_s = self .timeout_s )
259
259
260
260
# if an alternate serial port has been requested, use it
261
261
if self .alternate_console is not None :
0 commit comments