Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any difference between adb wait-for-device and adb wait-for-devices?

Tags:

android

adb

There are two commands that I used wait for a device to come up: adb wait-for-device and adb wait-for-devices. Both seem to wait for a device to boot up, I din't find any difference in their behaviour. Is there any difference in their behaviour?

Adding more information on what I did:

So here is what I did, from the android documentation I used adb wait-for-device but then sometime while using this command I used it as adb wait-for-devices, as you can see I added a extra 's' at the end, but the command still worked. So I was thinking why does both wait-for-device and wait-for-devices work! Why would android provide two commands for the same?

like image 304
Destructor Avatar asked Apr 30 '15 13:04

Destructor


People also ask

What is adb wait for device?

Device Basics wait-for-device can be specified after adb to ensure that the command will run once the device is connected. -s can be used to send the commands to a specific device when multiple are connected.

Which adb option should you use if you have multiple devices connected?

If multiple emulators are running and/or multiple devices are attached, you need to use the -d, -e, or -s option to specify the target device to which the command should be directed. The table below lists all of the supported adb commands and explains their meaning and usage.

How do I choose my adb device?

Use the -s option followed by a device name to select on which device the adb command should run. The -s options should be first in line, before the command.


1 Answers

This is how adb handles the command:

 /* handle wait-for-* prefix */
if (!strncmp(argv[0], "wait-for-", strlen("wait-for-"))) {
    const char* service = argv[0];
    if (!strncmp(service, "wait-for-device", strlen("wait-for-device"))) {
        if (ttype == kTransportUsb) {
            service = "wait-for-usb";
        } else if (ttype == kTransportLocal) {
            service = "wait-for-local";
        } else {
            service = "wait-for-any";
        }
    }

So any string starting with wait-for-device would have the same effect

like image 74
Alex P. Avatar answered Nov 11 '22 20:11

Alex P.