6
6
7
7
import attr
8
8
9
+ from .exception import ExecutionError
9
10
from ..factory import target_factory
10
11
from ..protocol import DebuggerProtocol
11
12
from ..resource .lauterbach import NetworkLauterbachDebugger , NetworkUSBLauterbachDebugger
@@ -34,7 +35,8 @@ class LauterbachDriver(Driver, DebuggerProtocol):
34
35
t32_bin = attr .ib (default = "t32marm" , validator = attr .validators .instance_of (str ))
35
36
t32_sys = attr .ib (
36
37
default = None ,
37
- validator = attr .validators .optional (attr .validators .instance_of (str )))
38
+ validator = attr .validators .optional (attr .validators .instance_of (str ))
39
+ )
38
40
39
41
def __attrs_post_init__ (self ):
40
42
super ().__attrs_post_init__ ()
@@ -56,7 +58,14 @@ def on_activate(self):
56
58
if isinstance (self .interface , USBLauterbachDebugger ):
57
59
self .connection = self ._pystart .USBConnection (f"{ self .interface .busnum :03d} :{ self .interface .devnum :03d} " )
58
60
elif isinstance (self .interface , NetworkLauterbachDebugger ):
59
- self .connection = self ._pystart .UDPConnection (self .interface .node )
61
+ if self .interface .protocol .lower () == "udp" :
62
+ host , port = proxymanager .get_host_and_port (self .interface , default_port = 9187 )
63
+ if host != self .interface .host :
64
+ raise ExecutionError ("Proxy support not available for legacy Lauterbach devices" )
65
+ self .connection = self ._pystart .UDPConnection (self .interface .host )
66
+ else :
67
+ host , port = proxymanager .get_host_and_port (self .interface , default_port = 9187 )
68
+ self .connection = self ._pystart .TCPConnection (host , port )
60
69
elif isinstance (self .interface , NetworkUSBLauterbachDebugger ):
61
70
62
71
path = os .path .join (self .t32sys , self .pathmap .get (self .interface .architecture ), "t32tcpusb" )
0 commit comments