Is there any difference between adb wait-for-devic

2019-02-25 16:12发布

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?

标签: android adb
1条回答
我命由我不由天
2楼-- · 2019-02-25 16:41

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

查看更多
登录 后发表回答