/* Copyright (C) 2006-2010 The Android Open Source Project ** ** This software is licensed under the terms of the GNU General Public ** License version 2, as published by the Free Software Foundation, and ** may be copied, distributed, and modified under those terms. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. */ #include "libslirp.h" #include "qemu-common.h" #include "sysemu.h" #include "modem_driver.h" #include "proxy_http.h" #include "android/android.h" #include "android/globals.h" #include "android/hw-sensors.h" #include "android/utils/debug.h" #include "android/utils/path.h" #include "android/utils/system.h" #include "android/utils/bufprint.h" #include "android/adb-server.h" #include "android/adb-qemud.h" #define D(...) do { if (VERBOSE_CHECK(init)) dprint(__VA_ARGS__); } while (0) #ifdef ANDROID_SDK_TOOLS_REVISION # define VERSION_STRING STRINGIFY(ANDROID_SDK_TOOLS_REVISION)".0" #else # define VERSION_STRING "standalone" #endif extern int control_console_start( int port ); /* in control.c */ /* Contains arguments for -android-ports option. */ char* android_op_ports = NULL; /* Contains arguments for -android-port option. */ char* android_op_port = NULL; /* Contains arguments for -android-report-console option. */ char* android_op_report_console = NULL; /* Contains arguments for -http-proxy option. */ char* op_http_proxy = NULL; /* Base port for the emulated system. */ int android_base_port; /* Strings describing the host system's OpenGL implementation */ char android_gl_vendor[ANDROID_GLSTRING_BUF_SIZE]; char android_gl_renderer[ANDROID_GLSTRING_BUF_SIZE]; char android_gl_version[ANDROID_GLSTRING_BUF_SIZE]; /*** APPLICATION DIRECTORY *** Where are we ? ***/ const char* get_app_dir(void) { char buffer[1024]; char* p = buffer; char* end = p + sizeof(buffer); p = bufprint_app_dir(p, end); if (p >= end) return NULL; return strdup(buffer); } enum { REPORT_CONSOLE_SERVER = (1 << 0), REPORT_CONSOLE_MAX = (1 << 1) }; static int get_report_console_options( char* end, int *maxtries ) { int flags = 0; if (end == NULL || *end == 0) return 0; if (end[0] != ',') { derror( "socket port/path can be followed by [,