Insomniac
Insomniac copied to clipboard
UIAutomator2 - Does it auto connect to Wi-fi? USB disconnected, fallback to WiFi, ATX_AGENT_URL
Hello guys, after start script then disconnect cable from computer it seems to auto connect to Wifi and start to message
[I 201025 00:17:02 init:259] USB disconnected, fallback to WiFi, ATX_AGENT_URL=http://192.168.2.59:7912
https://prnt.sc/v69ia1
Is there anyway to handle this system and messages? It seems to be more stable than using adb connect ip:port
As i could check there are two ways to connect with ui2
Connect to a device
There are two ways to connect to the device.
1 - Through WiFi
Suppose device IP is 10.0.0.1 and your PC is in the same network.
import uiautomator2 as u2
d = u2.connect('10.0.0.1') # alias for u2.connect_wifi('10.0.0.1')
print(d.info)
2 - Through USB
Suppose the device serial is 123456f (seen from adb devices)
import uiautomator2 as u2
d = u2.connect('123456f') # alias for u2.connect_usb('123456f')
print(d.info)
3 - Through ADB WiFi
import uiautomator2 as u2
d = u2.connect_adb_wifi("10.0.0.1:5555")
Equals to
- Shell: adb connect 10.0.0.1:5555
- Python: u2.connect_usb("10.0.0.1:5555")
Thank you