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?
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With