[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [STUMP] [PATCH] Add charge_{now,full} support to sysfs-battery.
From: |
Julian Stecklina |
Subject: |
Re: [STUMP] [PATCH] Add charge_{now,full} support to sysfs-battery. |
Date: |
Wed, 30 Sep 2009 13:06:43 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
"Desmond O. Chang" <address@hidden> writes:
> ---
> contrib/battery-portable.lisp | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/battery-portable.lisp b/contrib/battery-portable.lisp
> index 13ae2f4..b06a492 100644
> --- a/contrib/battery-portable.lisp
> +++ b/contrib/battery-portable.lisp
> @@ -203,8 +203,10 @@
> :unknown
> (let* ((state (sysfs-field path "status"))
> (consumption (sysfs-int-field path "current_now"))
> - (curr (sysfs-int-field path "energy_now"))
> - (full (sysfs-int-field path "energy_full"))
> + (curr (handler-case (sysfs-int-field path "energy_now")
> + (file-error () (sysfs-int-field path
> "charge_now"))))
> + (full (handler-case (sysfs-int-field path "energy_full")
> + (file-error () (sysfs-int-field path
> "charge_full"))))
> (percent (* 100 (/ curr full))))
> (cond
> ((string= state "Full") (values :charged percent))
What is your kernel version?
Regards,
--
Julian Stecklina
The day Microsoft makes something that doesn't suck is probably the day
they start making vacuum cleaners - Ernst Jan Plugge