From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoLlW-00024N-Ep for qemu-devel@nongnu.org; Tue, 11 Nov 2014 19:26:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoLlN-00005U-CF for qemu-devel@nongnu.org; Tue, 11 Nov 2014 19:26:30 -0500 Received: from mail-oi0-f41.google.com ([209.85.218.41]:54554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoLlN-0008W9-6k for qemu-devel@nongnu.org; Tue, 11 Nov 2014 19:26:21 -0500 Received: by mail-oi0-f41.google.com with SMTP id e131so7884949oig.28 for ; Tue, 11 Nov 2014 16:26:20 -0800 (PST) From: Greg Bellows Date: Tue, 11 Nov 2014 18:25:53 -0600 Message-Id: <1415751963-4081-6-git-send-email-greg.bellows@linaro.org> In-Reply-To: <1415751963-4081-1-git-send-email-greg.bellows@linaro.org> References: <1415751963-4081-1-git-send-email-greg.bellows@linaro.org> Subject: [Qemu-devel] [PATCH v1 05/15] android-console: Add console base power command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, peter.maydell@linaro.org, christoffer.dall@linaro.org, alex.bennee@linaro.org Cc: Greg Bellows Added the base Android emulator console power command and infrastructure for adding sub-commands. Signed-off-by: Greg Bellows --- android-commands.h | 11 +++++++++++ android-console.c | 16 ++++++++++++++++ android-console.h | 2 ++ 3 files changed, 29 insertions(+) diff --git a/android-commands.h b/android-commands.h index 1bfd15d..29c8769 100644 --- a/android-commands.h +++ b/android-commands.h @@ -25,6 +25,10 @@ static mon_cmd_t android_redir_cmds[] = { { NULL, NULL, }, }; +static mon_cmd_t android_power_cmds[] = { + { NULL, NULL, }, +}; + static mon_cmd_t android_cmds[] = { { .name = "help|h|?", @@ -55,5 +59,12 @@ static mon_cmd_t android_cmds[] = { .mhandler.cmd = android_console_redir, .sub_table = android_redir_cmds, }, + { .name = "power", + .args_type = "item:s?", + .params = "", + .help = "power related commands", + .mhandler.cmd = android_console_power, + .sub_table = android_power_cmds, + }, { NULL, NULL, }, }; diff --git a/android-console.c b/android-console.c index 0be5949..c08c607 100644 --- a/android-console.c +++ b/android-console.c @@ -298,3 +298,19 @@ void android_console_redir(Monitor *mon, const QDict *qdict) monitor_printf(mon, "%s\n", redir_help[cmd]); } +enum { + CMD_POWER, +}; + +static const char *power_help[] = { + /* CMD_POWER */ + "allows to change battery and AC power status", +}; + +void android_console_power(Monitor *mon, const QDict *qdict) +{ + /* Default to the first entry which is the parent help message */ + int cmd = CMD_POWER; + + monitor_printf(mon, "%s\n", power_help[cmd]); +} diff --git a/android-console.h b/android-console.h index 2786b64..ba936be 100644 --- a/android-console.h +++ b/android-console.h @@ -28,6 +28,8 @@ void android_console_redir_list(Monitor *mon, const QDict *qdict); void android_console_redir_add(Monitor *mon, const QDict *qdict); void android_console_redir_del(Monitor *mon, const QDict *qdict); +void android_console_power(Monitor *mon, const QDict *qdict); + void android_monitor_print_error(Monitor *mon, const char *fmt, ...); #endif -- 1.8.3.2