From patchwork Wed Nov 12 00:25:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 40622 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EEA9B205DF for ; Wed, 12 Nov 2014 00:29:45 +0000 (UTC) Received: by mail-la0-f71.google.com with SMTP id gq15sf7086895lab.6 for ; Tue, 11 Nov 2014 16:29:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=glAn5L+w2solfnWpr97i/da+7SSp1auxY79pwzVT304=; b=QMqIhAKNX+Mgj3jUOQTPq03O0WfXeDvTwWMizPtpFH4gHNg/+VnC1j0aKW35s9wAkq IUA06h+IPqvdjY7CKbNeCR8VbT7w750LNVIY00G98e3R2vwEFuPNmwvjuOcvjxULlFIs oeYSjU9s5pmaci8oElM6APJ6QOrBrrF/s8vMjecYZuIjCIS7mDHX2mpGgVfR+eUkSFyO wn+eyt4IT5HnW5CzrD300Tugsyc24JswX7KEvvil9tzrEnSjMixFKPs6Aw6sqG4TotL/ //r+e97ZJN0Inl/eFWJ7OZcR7RvlNFnHKoeokiqlC8NmyTQruxZmcs2AiDCfdvpX0MA9 8ukg== X-Gm-Message-State: ALoCoQnStX8vqQ93hCrqdbWHgoP1+raqB4QEKMG31ccbulmVjeYPRQdXjjlmbqLRddSfnA8gcoVY X-Received: by 10.112.147.131 with SMTP id tk3mr993887lbb.2.1415752184583; Tue, 11 Nov 2014 16:29:44 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.67 with SMTP id z3ls648386lag.74.gmail; Tue, 11 Nov 2014 16:29:44 -0800 (PST) X-Received: by 10.112.57.227 with SMTP id l3mr18248384lbq.68.1415752184439; Tue, 11 Nov 2014 16:29:44 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id wv8si33089116lac.86.2014.11.11.16.29.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Nov 2014 16:29:44 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id gq15so10646621lab.1 for ; Tue, 11 Nov 2014 16:29:44 -0800 (PST) X-Received: by 10.112.50.133 with SMTP id c5mr18695619lbo.54.1415752184233; Tue, 11 Nov 2014 16:29:44 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp347260lbc; Tue, 11 Nov 2014 16:29:43 -0800 (PST) X-Received: by 10.224.111.201 with SMTP id t9mr56618772qap.44.1415752182860; Tue, 11 Nov 2014 16:29:42 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k8si12513254qad.19.2014.11.11.16.29.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 11 Nov 2014 16:29:42 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:51558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoLob-0006yF-Tn for patch@linaro.org; Tue, 11 Nov 2014 19:29:41 -0500 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) X-Received: by 10.182.46.168 with SMTP id w8mr4452021obm.56.1415751980834; Tue, 11 Nov 2014 16:26:20 -0800 (PST) Received: from gbellows-linaro.bellowshome.net (99-179-1-128.lightspeed.austtx.sbcglobal.net. [99.179.1.128]) by mx.google.com with ESMTPSA id d3sm6239765obs.18.2014.11.11.16.26.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Nov 2014 16:26:20 -0800 (PST) From: Greg Bellows To: qemu-devel@nongnu.org, peter.maydell@linaro.org, christoffer.dall@linaro.org, alex.bennee@linaro.org Date: Tue, 11 Nov 2014 18:25:53 -0600 Message-Id: <1415751963-4081-6-git-send-email-greg.bellows@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1415751963-4081-1-git-send-email-greg.bellows@linaro.org> References: <1415751963-4081-1-git-send-email-greg.bellows@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.218.41 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v1 05/15] android-console: Add console base power command X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: greg.bellows@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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