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

六月ゝ 毕业季﹏ 提交于 2019-12-30 20:20:50

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/29968795/is-there-any-difference-between-adb-wait-for-device-and-adb-wait-for-devices

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!