Skip to content

Commit

Permalink
update adb client host (openatx#821)
Browse files Browse the repository at this point in the history
  • Loading branch information
lewis32 authored Jul 19, 2022
1 parent 9053a14 commit 5826094
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion uiautomator2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def _get_atx_agent_url(self) -> str:
try:
lport = self._adb_device.forward_port(
7912) # this method is so fast, only take 0.2ms
return f"http://127.0.0.1:{lport}"
return f"http://{self._adb_device._client.host}:{lport}"
except adbutils.AdbError as e:
if not _is_tmq_production() and self._atx_agent_url:
# when device offline, use atx-agent-url
Expand Down
7 changes: 4 additions & 3 deletions uiautomator2/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,12 @@ def setup_atx_agent(self):
def check_atx_agent_version(self):
port = self._device.forward_port(7912)
self.logger.debug("Forward: local:tcp:%d -> remote:tcp:%d", port, 7912)
version = requests.get("http://127.0.0.1:%d/version" %
port).text.strip()
version = requests.get("http://%s:%d/version" %
(self._device._client.host, port)).text.strip()
self.logger.debug("atx-agent version %s", version)

wlan_ip = requests.get("http://127.0.0.1:%d/wlan/ip" % port).text.strip()
wlan_ip = requests.get("http://%s:%d/wlan/ip" %
(self._device._client.host, port)).text.strip()
self.logger.debug("device wlan ip: %s", wlan_ip)
return version

Expand Down

0 comments on commit 5826094

Please sign in to comment.