21
21
logger = logging .getLogger (__name__ )
22
22
23
23
24
+ def install_driver_if_required () -> None :
25
+ if sys .platform == 'win32' :
26
+ import pywintunx_pmd3
27
+ pywintunx_pmd3 .install_wetest_driver ()
28
+
29
+
24
30
def get_device_list () -> List [RemoteServiceDiscoveryService ]:
25
31
result = []
26
32
with stop_remoted ():
@@ -57,6 +63,7 @@ def cli_tunneld(host: str, port: int, daemonize: bool, protocol: str):
57
63
""" Start Tunneld service for remote tunneling """
58
64
if not verify_tunnel_imports ():
59
65
return
66
+ install_driver_if_required ()
60
67
protocol = TunnelProtocol (protocol )
61
68
tunneld_runner = partial (TunneldRunner .create , host , port , protocol )
62
69
if daemonize :
@@ -77,6 +84,7 @@ def cli_tunneld(host: str, port: int, daemonize: bool, protocol: str):
77
84
@click .option ('--color/--no-color' , default = True )
78
85
def browse (color : bool ):
79
86
""" browse devices using bonjour """
87
+ install_driver_if_required ()
80
88
devices = []
81
89
for rsd in get_device_list ():
82
90
devices .append ({'address' : rsd .service .address [0 ],
@@ -91,6 +99,7 @@ def browse(color: bool):
91
99
@click .option ('--color/--no-color' , default = True )
92
100
def rsd_info (service_provider : RemoteServiceDiscoveryService , color : bool ):
93
101
""" show info extracted from RSD peer """
102
+ install_driver_if_required ()
94
103
print_json (service_provider .peer_info , colored = color )
95
104
96
105
@@ -168,6 +177,7 @@ def select_device(udid: str) -> RemoteServiceDiscoveryService:
168
177
@sudo_required
169
178
def cli_start_tunnel (udid : str , secrets : TextIO , script_mode : bool , max_idle_timeout : float , protocol : str ):
170
179
""" start quic tunnel """
180
+ install_driver_if_required ()
171
181
protocol = TunnelProtocol (protocol )
172
182
if not verify_tunnel_imports ():
173
183
return
@@ -190,5 +200,6 @@ def cli_delete_pair(udid: str):
190
200
@click .argument ('service_name' )
191
201
def cli_service (service_provider : RemoteServiceDiscoveryService , service_name : str ):
192
202
""" start an ipython shell for interacting with given service """
203
+ install_driver_if_required ()
193
204
with service_provider .start_remote_service (service_name ) as service :
194
205
service .shell ()
0 commit comments