From patchwork Wed Nov 12 00:25:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Bellows X-Patchwork-Id: 40620 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 02F9D205DF for ; Wed, 12 Nov 2014 00:27:43 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id b6sf732684lbj.0 for ; Tue, 11 Nov 2014 16:27:41 -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=duV/gqBsSAtvrctM/0HP2siBLhY2hMCDg/84EiWR7JQ=; b=buQTMG1E0Mil/iXU68jk4cMTi5xPVQeoDSkLSfxWxuBRKCAGnAt1KK8BQ0mjXgJq6s bh29EJBSokmeyISRIWQmi1wgfwtYo072v0nRXcQx+bdawSB7QpLkIPjzWt3/Fbp9JMUP aps9F3o0oFMtYj/LcoyYV6IF8ZbfcqoBfZlWIVkU83UvrTQytV4lDwrIS9haseNcBAEs mSFQESV6e20KfwC9crj8lnxqVF7VWsMBrtzKBj4sPiopk78NX7699IRJJ/4V1CihNTUE Bt5NxEiCCi56Z71VyqaTTSiDIFTujSuFLC0IFb0RN5JjgUkvis3unyp5KZzE+/AfIePg jU0w== X-Gm-Message-State: ALoCoQkiyL+ftdWdY6b23J4Cdgt4+6no9awCpVAowFWpDXYvsVAdZKAa/4PTyVTBXsLfabI4yxsX X-Received: by 10.112.154.194 with SMTP id vq2mr1173840lbb.10.1415752061945; Tue, 11 Nov 2014 16:27:41 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.206.104 with SMTP id ln8ls654440lac.22.gmail; Tue, 11 Nov 2014 16:27:41 -0800 (PST) X-Received: by 10.153.11.5 with SMTP id ee5mr7057327lad.55.1415752061471; Tue, 11 Nov 2014 16:27:41 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id b4si33135334lbd.70.2014.11.11.16.27.41 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Nov 2014 16:27:41 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id l4so8457951lbv.24 for ; Tue, 11 Nov 2014 16:27:41 -0800 (PST) X-Received: by 10.112.151.70 with SMTP id uo6mr38601716lbb.2.1415752061401; Tue, 11 Nov 2014 16:27:41 -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 ew9csp347131lbc; Tue, 11 Nov 2014 16:27:40 -0800 (PST) X-Received: by 10.224.127.193 with SMTP id h1mr26609807qas.1.1415752059868; Tue, 11 Nov 2014 16:27:39 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id c90si39198650qgf.111.2014.11.11.16.27.39 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 11 Nov 2014 16:27:39 -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]:51540 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoLmc-0003Og-ME for patch@linaro.org; Tue, 11 Nov 2014 19:27:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37997) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoLlW-00024O-Hw for qemu-devel@nongnu.org; Tue, 11 Nov 2014 19:26:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XoLlO-00007l-47 for qemu-devel@nongnu.org; Tue, 11 Nov 2014 19:26:30 -0500 Received: from mail-oi0-f47.google.com ([209.85.218.47]:54273) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XoLlO-000077-0b for qemu-devel@nongnu.org; Tue, 11 Nov 2014 19:26:22 -0500 Received: by mail-oi0-f47.google.com with SMTP id a3so7849089oib.20 for ; Tue, 11 Nov 2014 16:26:21 -0800 (PST) X-Received: by 10.182.215.136 with SMTP id oi8mr35670638obc.18.1415751981724; Tue, 11 Nov 2014 16:26:21 -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.20 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Nov 2014 16:26:21 -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:54 -0600 Message-Id: <1415751963-4081-7-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.47 Cc: Greg Bellows Subject: [Qemu-devel] [PATCH v1 06/15] android-console: Add missing hw_has_battery prop 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.217.179 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 missing hw_has_battery property to the Goldfish batter state. This property indicates whether the device has a battery and controls whether some power commands are available. In the Android emulator this property is acquired from the AVD for the device. For now, this is wired as always enabled. Signed-off-by: Greg Bellows --- hw/misc/goldfish_battery.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/misc/goldfish_battery.c b/hw/misc/goldfish_battery.c index 89fd05d..a0bc379 100644 --- a/hw/misc/goldfish_battery.c +++ b/hw/misc/goldfish_battery.c @@ -52,6 +52,7 @@ struct goldfish_battery_state { uint32_t health; uint32_t present; uint32_t capacity; + uint32_t hw_has_battery;; }; /* update this each time you update the battery_state struct */ @@ -70,6 +71,7 @@ static const VMStateDescription goldfish_battery_vmsd = { VMSTATE_UINT32(health, struct goldfish_battery_state), VMSTATE_UINT32(present, struct goldfish_battery_state), VMSTATE_UINT32(capacity, struct goldfish_battery_state), + VMSTATE_UINT32(hw_has_battery, struct goldfish_battery_state), VMSTATE_END_OF_LIST() } }; @@ -146,6 +148,11 @@ static void goldfish_battery_realize(DeviceState *dev, Error **errp) // default values for the battery s->ac_online = 1; + /* TODO: The Android Emulator gets this attribute from the AVD + * hw-config-defs.h. For now we hard-code the value to match the + * other values. + */ + s->hw_has_battery = 1; s->status = POWER_SUPPLY_STATUS_CHARGING; s->health = POWER_SUPPLY_HEALTH_GOOD; s->present = 1; // battery is present