Skip to content

ViewClient.connectToDeviceOrExit does not connect to (remote?) devices, it only lists devices that are already connected and uses them #327

@aentwist

Description

@aentwist

The only connecting AdbClient does is to the adb server, not any devices

self.socket = connect(self.hostname, self.port, self.timeout)

Then after not doing any connecting to devices, they are listed

devices = self.getDevices()
if len(devices) == 0 and timeout > 0:
print("Empty device list, will wait %s secs for devices to appear" % self.timeout, file=sys.stderr)

This results in a blank list and failure

$ ./adb devices
List of devices attached

When I actually connect

$ ./adb connect 127.0.0.1:7555
connected to 127.0.0.1:7555
$ ./adb devices
List of devices attached
127.0.0.1:7555  device

Only then do I find immediate success with connectToDeviceOrExit

from com.dtmilano.android.viewclient import ViewClient


adb_client, _ = ViewClient.connectToDeviceOrExit()

What is the idea behind this? The method name is misleading without any context. Have I misunderstood something in trying to get to the bottom of things?

Note that I just switched emulators and the new one uses port 7555 instead of 5555. I did not have this issue with the old emulator - maybe it ran adb connect itself?

Any feedback is appreciated. I was not able to find a way to run adb connect before using connectToDeviceOrExit after reading the wiki and API docs. This leaves me thinking that this library is not right for me since my use case is simple.

Edit: it seems like maybe this usage falls under "remote" devices, so this issue might be specific to that

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions