Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Wait-for-device command #100

Closed
ddalla opened this issue Apr 3, 2018 · 3 comments
Closed

Wait-for-device command #100

ddalla opened this issue Apr 3, 2018 · 3 comments

Comments

@ddalla
Copy link

ddalla commented Apr 3, 2018

Hi all,
I'm trying to use this Python implementation of ADB to issue reboot commands to my device.
The problem is that I cannot find a function that can be invoked to let me know when the device reboot has been completed.
In the Android ADB implementation I just use adb wait-for-device and wait until it returns.
Is the function available or am I missing something?

Thank you

@MohammadAG
Copy link
Contributor

It's missing, I implemented it quickly in a project I had with this code. I'm sure there's a better way to do it though.

def wait_for_device(serial=None):
    success = False

    while not success:
        try:
            device = adb_commands.AdbCommands.ConnectDevice(serial=serial)
            success = True
            return device
        except:
            time.sleep(1)

@ddalla
Copy link
Author

ddalla commented Apr 4, 2018

Ok @MohammadAG thank you. A polling solution like this is what I was thinking.
Maybe the project should offer this function, since it's also available in ADB.

@fahhem
Copy link
Contributor

fahhem commented May 31, 2018

I'm open to a Pull Request that adds a WaitForDevice() function to both AdbCommands and FastbootCommands that take the same arguments as ConnectDevice().

Thanks!

@fahhem fahhem closed this as completed May 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants