public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Starikovskiy <aystarik@gmail.com>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Alexey Starikovskiy <astarikovskiy@suse.de>,
	Roland Dreier <roland@digitalvampire.org>,
	Len Brown <len.brown@intel.com>,
	linux-acpi@vger.kernel.org,
	Rolf Eike Beer <eike-kernel@sf-tec.de>
Subject: Re: ACPI: Always return valid 'status' from acpi_battery_get_property()
Date: Mon, 19 Nov 2007 15:46:05 +0300	[thread overview]
Message-ID: <4741858D.9020802@gmail.com> (raw)
In-Reply-To: <20071108144207.GA8814@khazad-dum.debian.net>

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

Henrique de Moraes Holschuh wrote:
> On Thu, 08 Nov 2007, Alexey Starikovskiy wrote:
>   
>>> handle explicitly.  There doesn't seem to be any status enum value
>>> defined that makes more sense than 'unknown' for a battery at a
>>> critical charge level.
>>>       
>
> Maybe one should be added?
>
>   
There is already "Critical" field for capacity.
It seems that the state should be limited to only 3 options:
    charging, discharging, and not charging.

Regards,
Alex.


[-- Attachment #2: always_return_valid_status.patch --]
[-- Type: text/x-patch, Size: 860 bytes --]

ACPI: Battery: Always return valid 'status' from get_property

From: Alexey Starikovskiy <astarikovskiy@suse.de>

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
---

 drivers/acpi/battery.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 192c244..064d80b 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -151,8 +151,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
 			val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
 		else if (battery->state & 0x02)
 			val->intval = POWER_SUPPLY_STATUS_CHARGING;
-		else if (battery->state == 0)
-			val->intval = POWER_SUPPLY_STATUS_FULL;
+		else
+			val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
 		break;
 	case POWER_SUPPLY_PROP_PRESENT:
 		val->intval = acpi_battery_present(battery);

  reply	other threads:[~2007-11-19 12:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07 23:09 ACPI: Always return valid 'status' from acpi_battery_get_property() Roland Dreier
2007-11-08  8:29 ` Alexey Starikovskiy
2007-11-08 14:42   ` Henrique de Moraes Holschuh
2007-11-19 12:46     ` Alexey Starikovskiy [this message]
2007-11-19 18:36       ` Henrique de Moraes Holschuh
2007-11-19 18:41         ` Alexey Starikovskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4741858D.9020802@gmail.com \
    --to=aystarik@gmail.com \
    --cc=astarikovskiy@suse.de \
    --cc=eike-kernel@sf-tec.de \
    --cc=hmh@hmh.eng.br \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=roland@digitalvampire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox