From 6c066b442c636b157893073d6addf8dd9367c0b7 Mon Sep 17 00:00:00 2001 From: Florian Schrofner Date: Tue, 13 Jun 2023 16:48:21 +0200 Subject: [PATCH] fix issue in waht when connecting to devices with multiple ip addresses --- wireless-adb-helper-tool/waht.clj | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wireless-adb-helper-tool/waht.clj b/wireless-adb-helper-tool/waht.clj index 68cc7c7..5be2630 100755 --- a/wireless-adb-helper-tool/waht.clj +++ b/wireless-adb-helper-tool/waht.clj @@ -11,11 +11,17 @@ (def options (:options (parse-opts *command-line-args* cli-options))) (def port (:port options)) +;; using wlan0 for now, as this fixes issues with devices having multiple ip addresses (e.g. when using a vpn) +;; it seems like this interface name is used on all devices that i'm using at least (def ip (->> (shell/sh "adb" "shell" "ip addr") :out - (re-find #"inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/.* scope global") + (re-find #"inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/.* scope global wlan0") last)) +(println (str "determined ip address of device: " ip)) + (shell/sh "adb" "tcpip" (str port)) +(println (str "opened adb in tcp mode on port: " port)) + (def result (shell/sh "adb" "connect" (str ip ":" port))) (println (:out result))