X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/blobdiff_plain/66c8343c4d2ea118601ba5d8ce52fa622cbcd665..c181bf984d4c5c8b189e3ffcf6bb52f5ed6b0d98:/tools/helpers/net.py diff --git a/tools/helpers/net.py b/tools/helpers/net.py index b267357..13723f3 100644 --- a/tools/helpers/net.py +++ b/tools/helpers/net.py @@ -13,18 +13,28 @@ def adb_connect(args): """ # Check if adb exists on the system. if not which("adb"): - return + raise RuntimeError("Could not find adb") # Start and 'warm up' the adb server tools.helpers.run.user(args, ["adb", "start-server"]) ip = get_device_ip_address() if not ip: - return + raise RuntimeError("Unknown container IP address. Is Waydroid running?") tools.helpers.run.user(args, ["adb", "connect", ip]) logging.info("Established ADB connection to Waydroid device at {}.".format(ip)) +def adb_disconnect(args): + if not which("adb"): + raise RuntimeError("Could not find adb") + + ip = get_device_ip_address() + if not ip: + raise RuntimeError("Unknown container IP address. Was Waydroid ever running?") + + tools.helpers.run.user(args, ["adb", "disconnect", ip]) + def get_device_ip_address(): # The IP address is queried from the DHCP lease file. lease_file = "/var/lib/misc/dnsmasq.waydroid0.leases"