Пример #1
0
// Split the comma/space/colum/semi-column separated list of tags from the trace
// setting and build the trace mask from it. note that '1' and 'all' are special
// cases to enable all tracing.
//
// adb's trace setting comes from the ADB_TRACE environment variable, whereas
// adbd's comes from the system property persist.adb.trace_mask.
void adb_trace_init() {
    const std::string trace_setting = get_trace_setting();

    static const struct {
        const char*  tag;
        int           flag;
    } tags[] = {
        { "1", 0 },
        { "all", 0 },
        { "adb", TRACE_ADB },
        { "sockets", TRACE_SOCKETS },
        { "packets", TRACE_PACKETS },
        { "rwx", TRACE_RWX },
        { "usb", TRACE_USB },
        { "sync", TRACE_SYNC },
        { "sysdeps", TRACE_SYSDEPS },
        { "transport", TRACE_TRANSPORT },
        { "jdwp", TRACE_JDWP },
        { "services", TRACE_SERVICES },
        { "auth", TRACE_AUTH },
        { NULL, 0 }
    };

    if (trace_setting.empty()) {
        return;
    }

    // Use a comma/colon/semi-colon/space separated list
    const char* p = trace_setting.c_str();
    while (*p) {
        int  len, tagn;

        const char* q = strpbrk(p, " ,:;");
        if (q == NULL) {
            q = p + strlen(p);
        }
        len = q - p;

        for (tagn = 0; tags[tagn].tag != NULL; tagn++) {
            int  taglen = strlen(tags[tagn].tag);

            if (len == taglen && !memcmp(tags[tagn].tag, p, len)) {
                int  flag = tags[tagn].flag;
                if (flag == 0) {
                    adb_trace_mask = ~0;
                    return;
                }
                adb_trace_mask |= (1 << flag);
                break;
            }
        }
        p = q;
        if (*p)
            p++;
    }

#if !ADB_HOST
    start_device_log();
#endif
}
Пример #2
0
void adb_trace_init(char** argv) {
#if !ADB_HOST
    if (isatty(STDOUT_FILENO) == 0) {
        start_device_log();
    }
#endif

    setup_trace_mask();
    android::base::InitLogging(argv, AdbLogger);
}
Пример #3
0
int main(int argc, char **argv)
{
	if ((argc > 1) && (!strcmp(argv[1], "recovery"))) {
		adb_device_banner = "recovery";
		recovery_mode = 1;
	}

	start_device_log();
	D("Handling main()\n");
	return adb_main(0, DEFAULT_ADB_PORT);
}
Пример #4
0
int main(int argc, char **argv)
{
#if ADB_HOST
    adb_trace_init();
    adb_sysdeps_init();
    return adb_commandline(argc - 1, argv + 1);
#else
    if((argc > 1) && (!strcmp(argv[1],"recovery"))) {
        adb_device_banner = "recovery";
        recovery_mode = 1;
    }

    start_device_log();
    return adb_main(0, DEFAULT_ADB_PORT);
#endif
}
Пример #5
0
void adb_trace_init(char** argv) {
#if !ADB_HOST
    // Don't open log file if no tracing, since this will block
    // the crypto unmount of /data
    if (!get_trace_setting().empty()) {
        if (isatty(STDOUT_FILENO) == 0) {
            start_device_log();
        }
    }
#endif

    android::base::InitLogging(argv, AdbLogger);
    setup_trace_mask();

    VLOG(ADB) << adb_version();
}
Пример #6
0
void adb_trace_init(char** argv) {
    // Don't open log file if no tracing, since this will block
    // the crypto unmount of /data
    const std::string trace_setting = get_trace_setting();
    if (trace_setting.empty()) {
        return;
    }

#if !ADB_HOST
    if (isatty(STDOUT_FILENO) == 0) {
        start_device_log();
    }
#endif

    setup_trace_mask();
    android::base::InitLogging(argv, AdbLogger);
}
int main(int argc, char **argv)
{
#if ADB_HOST
    adb_sysdeps_init();
    adb_trace_init();
    D("Handling commandline()\n");
    return adb_commandline(argc - 1, argv + 1);
#else
    /* If adbd runs inside the emulator this will enable adb tracing via
     * adb-debug qemud service in the emulator. */
    adb_qemu_trace_init();
    if((argc > 1) && (!strcmp(argv[1],"recovery"))) {
        adb_device_banner = "recovery";
        recovery_mode = 1;
    }

    start_device_log();
    D("Handling main()\n");
    return adb_main(0, DEFAULT_ADB_PORT);
#endif
}
Пример #8
0
int main(int argc, char **argv)
{
#if ADB_HOST
    adb_sysdeps_init();
    adb_trace_init();
    D("Handling commandline()\n");
    return adb_commandline(argc - 1, argv + 1);
#else
    /* If adbd runs inside the emulator this will enable adb tracing via
     * adb-debug qemud service in the emulator. */
    adb_qemu_trace_init();
    while(1) {
        int c;
        int option_index = 0;
        static struct option opts[] = {
            {"root_seclabel", required_argument, 0, 's' },
            {"device_banner", required_argument, 0, 'b' }
        };
        c = getopt_long(argc, argv, "", opts, &option_index);
        if (c == -1)
            break;
        switch (c) {
        case 's':
            root_seclabel = optarg;
            break;
        case 'b':
            adb_device_banner = optarg;
            break;
        default:
            break;
        }
    }

    recovery_mode = (strcmp(adb_device_banner, "recovery") == 0);

    start_device_log();
    D("Handling main()\n");
    return adb_main(0, DEFAULT_ADB_PORT);
#endif
}