|
21 | 21 | *
|
22 | 22 | */
|
23 | 23 |
|
24 |
| -#include "android/sockets.h" |
25 |
| -#include "sysemu/char.h" |
26 |
| -#include "sysemu/sysemu.h" |
27 | 24 | #include "android/android.h"
|
28 |
| -#include "cpu.h" |
29 |
| -#include "hw/android/goldfish/device.h" |
30 |
| -#include "hw/power_supply.h" |
31 |
| -#include "android/shaper.h" |
32 |
| -#include "telephony/modem_driver.h" |
| 25 | +#include "android/display-core.h" |
33 | 26 | #include "android/gps.h"
|
34 | 27 | #include "android/globals.h"
|
| 28 | +#include "android/hw-events.h" |
| 29 | +#include "android/hw-fingerprint.h" |
| 30 | +#include "android/hw-sensors.h" |
| 31 | +#include "android/shaper.h" |
| 32 | +#include "android/skin/charmap.h" |
| 33 | +#include "android/skin/keycode-buffer.h" |
| 34 | +#include "android/sockets.h" |
| 35 | +#include "android/tcpdump.h" |
| 36 | +#include "android/user-events.h" |
35 | 37 | #include "android/utils/bufprint.h"
|
36 | 38 | #include "android/utils/debug.h"
|
37 | 39 | #include "android/utils/eintr_wrapper.h"
|
38 | 40 | #include "android/utils/http_utils.h"
|
39 | 41 | #include "android/utils/stralloc.h"
|
40 | 42 | #include "android/utils/utf8_utils.h"
|
41 |
| -#include "android/config/config.h" |
42 |
| -#include "android/tcpdump.h" |
43 |
| -#include "net/net.h" |
| 43 | + |
| 44 | +#include "config-host.h" |
| 45 | +#include "cpu.h" |
| 46 | +#include "hw/android/goldfish/device.h" |
| 47 | +#include "hw/power_supply.h" |
| 48 | +#if defined(CONFIG_SLIRP) |
| 49 | +#include "libslirp.h" |
| 50 | +#endif |
44 | 51 | #include "monitor/monitor.h"
|
| 52 | +#include "net/net.h" |
| 53 | +#include "telephony/modem_driver.h" |
| 54 | +#include "sysemu/char.h" |
| 55 | +#include "sysemu/sysemu.h" |
45 | 56 |
|
46 |
| -#include <stdlib.h> |
47 |
| -#include <stdio.h> |
| 57 | +#include <fcntl.h> |
48 | 58 | #include <stdarg.h>
|
| 59 | +#include <stdio.h> |
| 60 | +#include <stdlib.h> |
49 | 61 | #include <string.h>
|
50 | 62 | #include <unistd.h>
|
51 |
| -#include <fcntl.h> |
52 |
| -#include "android/hw-events.h" |
53 |
| -#include "android/user-events.h" |
54 |
| -#include "android/hw-fingerprint.h" |
55 |
| -#include "android/hw-sensors.h" |
56 |
| -#include "android/skin/charmap.h" |
57 |
| -#include "android/skin/keycode-buffer.h" |
58 |
| -#include "android/display-core.h" |
59 |
| - |
60 |
| -#if defined(CONFIG_SLIRP) |
61 |
| -#include "libslirp.h" |
62 |
| -#endif |
63 | 63 |
|
64 | 64 | extern void android_emulator_set_window_scale(double, int);
|
65 | 65 |
|
@@ -118,23 +118,6 @@ typedef struct ControlGlobalRec_
|
118 | 118 |
|
119 | 119 | } ControlGlobalRec;
|
120 | 120 |
|
121 |
| -#ifdef CONFIG_STANDALONE_CORE |
122 |
| -/* UI client currently attached to the core. */ |
123 |
| -ControlClient attached_ui_client = NULL; |
124 |
| - |
125 |
| -/* User events service client. */ |
126 |
| -ControlClient user_events_client = NULL; |
127 |
| - |
128 |
| -/* UI control service client (UI -> Core). */ |
129 |
| -ControlClient ui_core_ctl_client = NULL; |
130 |
| - |
131 |
| -/* UI control service (UI -> Core. */ |
132 |
| -// CoreUICtl* ui_core_ctl = NULL; |
133 |
| - |
134 |
| -/* UI control service client (Core-> UI). */ |
135 |
| -ControlClient core_ui_ctl_client = NULL; |
136 |
| -#endif // CONFIG_STANDALONE_CORE |
137 |
| - |
138 | 121 | static int
|
139 | 122 | control_global_add_redir( ControlGlobal global,
|
140 | 123 | int host_port,
|
@@ -222,28 +205,6 @@ control_client_destroy( ControlClient client )
|
222 | 205 |
|
223 | 206 | D(( "destroying control client %p\n", client ));
|
224 | 207 |
|
225 |
| -#ifdef CONFIG_STANDALONE_CORE |
226 |
| - if (client == attached_ui_client) { |
227 |
| - attachUiProxy_destroy(); |
228 |
| - attached_ui_client = NULL; |
229 |
| - } |
230 |
| - |
231 |
| - if (client == user_events_client) { |
232 |
| - userEventsImpl_destroy(); |
233 |
| - user_events_client = NULL; |
234 |
| - } |
235 |
| - |
236 |
| - if (client == ui_core_ctl_client) { |
237 |
| - coreCmdImpl_destroy(); |
238 |
| - ui_core_ctl_client = NULL; |
239 |
| - } |
240 |
| - |
241 |
| - if (client == core_ui_ctl_client) { |
242 |
| - uiCmdProxy_destroy(); |
243 |
| - core_ui_ctl_client = NULL; |
244 |
| - } |
245 |
| -#endif // CONFIG_STANDALONE_CORE |
246 |
| - |
247 | 208 | sock = control_client_detach( client );
|
248 | 209 | if (sock >= 0)
|
249 | 210 | socket_close(sock);
|
@@ -2641,227 +2602,12 @@ do_qemu_monitor( ControlClient client, char* args )
|
2641 | 2602 | return -1;
|
2642 | 2603 | }
|
2643 | 2604 |
|
2644 |
| -#ifdef CONFIG_STANDALONE_CORE |
2645 |
| -/* UI settings, passed to the core via -ui-settings command line parameter. */ |
2646 |
| -extern char* android_op_ui_settings; |
2647 |
| - |
2648 |
| -static int |
2649 |
| -do_attach_ui( ControlClient client, char* args ) |
2650 |
| -{ |
2651 |
| - // Make sure that there are no UI already attached to this console. |
2652 |
| - if (attached_ui_client != NULL) { |
2653 |
| - control_write( client, "KO: Another UI is attached to this core!\r\n" ); |
2654 |
| - control_client_destroy(client); |
2655 |
| - return -1; |
2656 |
| - } |
2657 |
| - |
2658 |
| - if (!attachUiProxy_create(client->sock)) { |
2659 |
| - char reply_buf[4096]; |
2660 |
| - attached_ui_client = client; |
2661 |
| - // Reply "OK" with the saved -ui-settings property. |
2662 |
| - snprintf(reply_buf, sizeof(reply_buf), "OK: %s\r\n", android_op_ui_settings); |
2663 |
| - control_write( client, reply_buf); |
2664 |
| - } else { |
2665 |
| - control_write( client, "KO\r\n" ); |
2666 |
| - control_client_destroy(client); |
2667 |
| - return -1; |
2668 |
| - } |
2669 |
| - |
2670 |
| - return 0; |
2671 |
| -} |
2672 |
| - |
2673 |
| -void |
2674 |
| -destroy_attach_ui_client(void) |
2675 |
| -{ |
2676 |
| - if (attached_ui_client != NULL) { |
2677 |
| - control_client_destroy(attached_ui_client); |
2678 |
| - } |
2679 |
| -} |
2680 |
| - |
2681 |
| -static int |
2682 |
| -do_create_framebuffer_service( ControlClient client, char* args ) |
2683 |
| -{ |
2684 |
| - ProxyFramebuffer* core_fb; |
2685 |
| - const char* protocol = "-raw"; // Default framebuffer exchange protocol. |
2686 |
| - char reply_buf[64]; |
2687 |
| - |
2688 |
| - // Protocol type is defined by the arguments passed with the stream switch |
2689 |
| - // command. |
2690 |
| - if (args != NULL && *args != '\0') { |
2691 |
| - size_t token_len; |
2692 |
| - const char* param_end = strchr(args, ' '); |
2693 |
| - if (param_end == NULL) { |
2694 |
| - param_end = args + strlen(args); |
2695 |
| - } |
2696 |
| - token_len = param_end - args; |
2697 |
| - protocol = args; |
2698 |
| - |
2699 |
| - // Make sure that this is one of the supported protocols. |
2700 |
| - if (strncmp(protocol, "-raw", token_len) && |
2701 |
| - strncmp(protocol, "-shared", token_len)) { |
2702 |
| - derror("Invalid framebuffer parameter %s\n", protocol); |
2703 |
| - control_write( client, "KO: Invalid parameter\r\n" ); |
2704 |
| - control_client_destroy(client); |
2705 |
| - return -1; |
2706 |
| - } |
2707 |
| - } |
2708 |
| - |
2709 |
| - core_fb = proxyFb_create(client->sock, protocol); |
2710 |
| - if (core_fb == NULL) { |
2711 |
| - control_write( client, "KO\r\n" ); |
2712 |
| - control_client_destroy(client); |
2713 |
| - return -1; |
2714 |
| - } |
2715 |
| - |
2716 |
| - // Reply "OK" with the framebuffer's bits per pixel |
2717 |
| - snprintf(reply_buf, sizeof(reply_buf), "OK: -bitsperpixel=%d\r\n", |
2718 |
| - proxyFb_get_bits_per_pixel(core_fb)); |
2719 |
| - control_write( client, reply_buf); |
2720 |
| - return 0; |
2721 |
| -} |
2722 |
| - |
2723 |
| -static int |
2724 |
| -do_create_user_events_service( ControlClient client, char* args ) |
2725 |
| -{ |
2726 |
| - // Make sure that there are no user events client already existing. |
2727 |
| - if (user_events_client != NULL) { |
2728 |
| - control_write( client, "KO: Another user events service is already existing!\r\n" ); |
2729 |
| - control_client_destroy(client); |
2730 |
| - return -1; |
2731 |
| - } |
2732 |
| - |
2733 |
| - if (!userEventsImpl_create(client->sock)) { |
2734 |
| - char reply_buf[4096]; |
2735 |
| - user_events_client = client; |
2736 |
| - snprintf(reply_buf, sizeof(reply_buf), "OK\r\n"); |
2737 |
| - control_write( client, reply_buf); |
2738 |
| - } else { |
2739 |
| - control_write( client, "KO\r\n" ); |
2740 |
| - control_client_destroy(client); |
2741 |
| - return -1; |
2742 |
| - } |
2743 |
| - |
2744 |
| - return 0; |
2745 |
| -} |
2746 |
| - |
2747 |
| -void |
2748 |
| -destroy_user_events_client(void) |
2749 |
| -{ |
2750 |
| - if (user_events_client != NULL) { |
2751 |
| - control_client_destroy(user_events_client); |
2752 |
| - } |
2753 |
| -} |
2754 |
| - |
2755 |
| -static int |
2756 |
| -do_create_ui_core_ctl_service( ControlClient client, char* args ) |
2757 |
| -{ |
2758 |
| - // Make sure that there are no ui control client already existing. |
2759 |
| - if (ui_core_ctl_client != NULL) { |
2760 |
| - control_write( client, "KO: Another UI control service is already existing!\r\n" ); |
2761 |
| - control_client_destroy(client); |
2762 |
| - return -1; |
2763 |
| - } |
2764 |
| - |
2765 |
| - if (!coreCmdImpl_create(client->sock)) { |
2766 |
| - char reply_buf[4096]; |
2767 |
| - ui_core_ctl_client = client; |
2768 |
| - snprintf(reply_buf, sizeof(reply_buf), "OK\r\n"); |
2769 |
| - control_write( client, reply_buf); |
2770 |
| - } else { |
2771 |
| - control_write( client, "KO\r\n" ); |
2772 |
| - control_client_destroy(client); |
2773 |
| - return -1; |
2774 |
| - } |
2775 |
| - |
2776 |
| - return 0; |
2777 |
| -} |
2778 |
| - |
2779 |
| -void |
2780 |
| -destroy_ui_core_ctl_client(void) |
2781 |
| -{ |
2782 |
| - if (ui_core_ctl_client != NULL) { |
2783 |
| - control_client_destroy(ui_core_ctl_client); |
2784 |
| - } |
2785 |
| -} |
2786 |
| - |
2787 |
| -void |
2788 |
| -destroy_corecmd_client(void) |
2789 |
| -{ |
2790 |
| - if (ui_core_ctl_client != NULL) { |
2791 |
| - control_client_destroy(ui_core_ctl_client); |
2792 |
| - } |
2793 |
| -} |
2794 |
| - |
2795 |
| -static int |
2796 |
| -do_create_core_ui_ctl_service( ControlClient client, char* args ) |
2797 |
| -{ |
2798 |
| - // Make sure that there are no ui control client already existing. |
2799 |
| - if (core_ui_ctl_client != NULL) { |
2800 |
| - control_write( client, "KO: Another UI control service is already existing!\r\n" ); |
2801 |
| - control_client_destroy(client); |
2802 |
| - return -1; |
2803 |
| - } |
2804 |
| - |
2805 |
| - if (!uiCmdProxy_create(client->sock)) { |
2806 |
| - char reply_buf[4096]; |
2807 |
| - core_ui_ctl_client = client; |
2808 |
| - snprintf(reply_buf, sizeof(reply_buf), "OK\r\n"); |
2809 |
| - control_write( client, reply_buf); |
2810 |
| - } else { |
2811 |
| - control_write( client, "KO\r\n" ); |
2812 |
| - control_client_destroy(client); |
2813 |
| - return -1; |
2814 |
| - } |
2815 |
| - |
2816 |
| - return 0; |
2817 |
| -} |
2818 |
| - |
2819 |
| -void |
2820 |
| -destroy_core_ui_ctl_client(void) |
2821 |
| -{ |
2822 |
| - if (core_ui_ctl_client != NULL) { |
2823 |
| - control_client_destroy(core_ui_ctl_client); |
2824 |
| - } |
2825 |
| -} |
2826 |
| - |
2827 |
| -void |
2828 |
| -destroy_uicmd_client(void) |
2829 |
| -{ |
2830 |
| - if (core_ui_ctl_client != NULL) { |
2831 |
| - control_client_destroy(core_ui_ctl_client); |
2832 |
| - } |
2833 |
| -} |
2834 |
| - |
2835 |
| -#endif // CONFIG_STANDALONE_CORE |
2836 |
| - |
2837 | 2605 | static const CommandDefRec qemu_commands[] =
|
2838 | 2606 | {
|
2839 | 2607 | { "monitor", "enter QEMU monitor",
|
2840 | 2608 | "Enter the QEMU virtual machine monitor\r\n",
|
2841 | 2609 | NULL, do_qemu_monitor, NULL },
|
2842 | 2610 |
|
2843 |
| -#ifdef CONFIG_STANDALONE_CORE |
2844 |
| - { "attach-UI", "attach UI to the core", |
2845 |
| - "Attach UI to the core\r\n", |
2846 |
| - NULL, do_attach_ui, NULL }, |
2847 |
| - |
2848 |
| - { "framebuffer", "create framebuffer service", |
2849 |
| - "Create framebuffer service\r\n", |
2850 |
| - NULL, do_create_framebuffer_service, NULL }, |
2851 |
| - |
2852 |
| - { "user-events", "create user events service", |
2853 |
| - "Create user events service\r\n", |
2854 |
| - NULL, do_create_user_events_service, NULL }, |
2855 |
| - |
2856 |
| - { "ui-core-control", "create UI control service", |
2857 |
| - "Create UI control service\r\n", |
2858 |
| - NULL, do_create_ui_core_ctl_service, NULL }, |
2859 |
| - |
2860 |
| - { "core-ui-control", "create UI control service", |
2861 |
| - "Create UI control service\r\n", |
2862 |
| - NULL, do_create_core_ui_ctl_service, NULL }, |
2863 |
| -#endif // CONFIG_STANDALONE_CORE |
2864 |
| - |
2865 | 2611 | { NULL, NULL, NULL, NULL, NULL, NULL }
|
2866 | 2612 | };
|
2867 | 2613 |
|
|
0 commit comments