aboutsummaryrefslogtreecommitdiff
path: root/android-commands.h
blob: a7b24740c8a193ff6fd5e5d2c078ac4793e872e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
/* hand-written for now; consider .hx autogen */

static mon_cmd_t android_redir_cmds[] = {
    {
        .name = "list",
        .args_type = "",
        .params = "",
        .help = "list current redirections",
        .mhandler.cmd = android_console_redir_list,
    },
    {
        .name = "add",
        .args_type = "arg:s",
        .params = "[tcp|udp]:hostport:guestport",
        .help = "add new redirection",
        .mhandler.cmd = android_console_redir_add,
    },
    {
        .name = "del",
        .args_type = "arg:s",
        .params = "[tcp|udp]:hostport",
        .help = "remove existing redirection",
        .mhandler.cmd = android_console_redir_del,
    },
    { NULL, NULL, },
};

static mon_cmd_t android_power_cmds[] = {
    {
        .name = "display",
        .args_type = "",
        .params = "",
        .help = "display battery and charger state",
        .mhandler.cmd = android_console_power_display,
    },
    {
        .name = "ac",
        .args_type = "arg:s?",
        .params = "",
        .help = "set AC charging state",
        .mhandler.cmd = android_console_power_ac,
    },
    {
        .name = "status",
        .args_type = "arg:s?",
        .params = "",
        .help = "set battery status",
        .mhandler.cmd = android_console_power_status,
    },
    {
        .name = "present",
        .args_type = "arg:s?",
        .params = "",
        .help = "set battery present state",
        .mhandler.cmd = android_console_power_present,
    },
    {
        .name = "health",
        .args_type = "arg:s?",
        .params = "",
        .help = "set battery health state",
        .mhandler.cmd = android_console_power_health,
    },
    {
        .name = "capacity",
        .args_type = "arg:s?",
        .params = "",
        .help = "set battery capacity state",
        .mhandler.cmd = android_console_power_capacity,
    },
    { NULL, NULL, },
};

static mon_cmd_t android_event_cmds[] = {
    {
        .name = "types",
        .args_type = "arg:s?",
        .params = "",
        .help = "list all <type> aliases",
        .mhandler.cmd = android_console_event_types,
    },
    {
        .name = "codes",
        .args_type = "arg:s?",
        .params = "",
        .help = "list all <code> aliases for a given <type>",
        .mhandler.cmd = android_console_event_codes,
    },
    {
        .name = "send",
        .args_type  = "arg:s?",
        .params = "",
        .help = "send a series of events to the kernel",
        .mhandler.cmd = android_console_event_send,
    },
    {
        .name = "text",
        .args_type  = "arg:S?",
        .params = "",
        .help = "simulate keystrokes from a given text",
        .mhandler.cmd = android_console_event_text,
    },
    { NULL, NULL, },
};

static mon_cmd_t android_avd_snapshot_cmds[] = {
    {
        .name = "list",
        .args_type = "",
        .params = "",
        .help = "'avd snapshot list' will show a list of all state snapshots "
                "that can be loaded",
        .mhandler.cmd = android_console_avd_snapshot_list,
    },
    {
        .name = "save",
        .args_type = "arg:s?",
        .params = "",
        .help = "'avd snapshot save <name>' will save the current (run-time) "
                "state to a snapshot with the given name",
        .mhandler.cmd = android_console_avd_snapshot_save,
    },
    {
        .name = "load",
        .args_type = "arg:s?",
        .params = "",
        .help = "'avd snapshot load <name>' will load the state snapshot of "
                "the given name",
        .mhandler.cmd = android_console_avd_snapshot_load,
    },
    {
        .name = "del",
        .args_type = "arg:s?",
        .params = "",
        .help = "'avd snapshot del <name>' will delete the state snapshot with "
                "the given name",
        .mhandler.cmd = android_console_avd_snapshot_del,
    },
    { NULL, NULL, },
};

static mon_cmd_t android_avd_cmds[] = {
    {
        .name = "stop",
        .args_type = "",
        .params = "",
        .help = "stop the virtual device",
        .mhandler.cmd = android_console_avd_stop,
    },
    {
        .name = "start",
        .args_type = "",
        .params = "",
        .help = "start/restart the virtual device",
        .mhandler.cmd = android_console_avd_start,
    },
    {
        .name = "status",
        .args_type = "",
        .params = "",
        .help = "query virtual device status",
        .mhandler.cmd = android_console_avd_status,
    },
    {
        .name = "name",
        .args_type = "",
        .params = "",
        .help = "query virtual device name",
        .mhandler.cmd = android_console_avd_name,
    },
    {
        .name = "snapshot",
        .args_type = "item:s",
        .params = "",
        .help = "state snapshot commands",
        .mhandler.cmd = android_console_avd_snapshot,
        .sub_cmds.static_table = android_avd_snapshot_cmds,
    },
    { NULL, NULL, },
};

static mon_cmd_t android_cmds[] = {
    {
        .name = "help|h|?",
        .args_type = "helptext:S?",
        .params = "",
        .help = "print a list of commands",
        .mhandler.cmd = android_console_help,
    },
    {
        .name = "kill",
        .args_type = "",
        .params = "",
        .help = "kill the emulator instance",
        .mhandler.cmd = android_console_kill,
    },
    {
        .name = "quit|exit",
        .args_type = "",
        .params = "",
        .help = "quit control session",
        .mhandler.cmd = android_console_quit,
    },
    {
        .name = "redir",
        .args_type = "item:s?",
        .params = "",
        .help = "manage port redirections",
        .mhandler.cmd = android_console_redir,
        .sub_cmds.static_table = android_redir_cmds,
    },
    {   .name = "power",
        .args_type = "item:s?",
        .params = "",
        .help = "power related commands",
        .mhandler.cmd = android_console_power,
        .sub_cmds.static_table = android_power_cmds,
    },
    {   .name = "event",
        .args_type = "item:s?",
        .params = "",
        .help = "simulate hardware events",
        .mhandler.cmd = android_console_event,
        .sub_cmds.static_table = android_event_cmds,
    },
    {   .name = "avd",
        .args_type = "item:s?",
        .params = "",
        .help = "control virtual device execution",
        .mhandler.cmd = android_console_avd,
        .sub_cmds.static_table = android_avd_cmds,
    },
    { NULL, NULL, },
};