Bug#1007702: Acknowledgement (fdpowermon: "Not charging" state not supported)

2022-03-23 Thread Wouter Verhelst
On Wed, Mar 16, 2022 at 06:30:55PM +0100, Roland Rosenfeld wrote:
> Hi Wouter!
> 
> It seems, that my patch isn't complete, since with the following
> output of acpi -bi:
> 
> Battery 0: Discharging, 87%, 03:13:16 remaining
> Battery 0: design capacity 1958 mAh, last full capacity 1506 mAh = 76%
> Battery 1: Not charging, 5%
> Battery 1: design capacity 4609 mAh, last full capacity 4239 mAh = 91%
> 
> I now see the charging symbol (flash next to the battery).
> 
> So the attached additional patch seems to be necessary.
> 
> Greetings
> Roland

> diff --git a/fdpowermon b/fdpowermon
> index d7b8b6f..ee20dda 100755
> --- a/fdpowermon
> +++ b/fdpowermon
> @@ -447,6 +447,9 @@ sub checklevels {
>   if($state =~ /Discharging/) {
>   $step = $themes{$theme}->{discharging};
>   $charging = 0;
> + } elsif($state =~ /Not charging/) {
> + $step = $themes{$theme}->{discharging};
> + $charging = 0;

This assumes that "Not charging" is always equal to "Discharging",
which is not necessarily true (you gave examples where one battery is
charging, and the other one is "Not charging").

I've instead made it so that $state is assigned to if the state is
"Charging" or "Discharging", but not if $state already has a value and
the state is neither of those two.

This will make a state of "Discharging" for one battery and "Not
charging" for the other use discharging theme, and a state of "Not
charging" for one battery and "Charging" for the other to use the
charging theme.

-- 
 w@uter.{be,co.za}
wouter@{grep.be,fosdem.org,debian.org}



Bug#1007702: Acknowledgement (fdpowermon: "Not charging" state not supported)

2022-03-16 Thread Roland Rosenfeld
Hi Wouter!

It seems, that my patch isn't complete, since with the following
output of acpi -bi:

Battery 0: Discharging, 87%, 03:13:16 remaining
Battery 0: design capacity 1958 mAh, last full capacity 1506 mAh = 76%
Battery 1: Not charging, 5%
Battery 1: design capacity 4609 mAh, last full capacity 4239 mAh = 91%

I now see the charging symbol (flash next to the battery).

So the attached additional patch seems to be necessary.

Greetings
Roland
diff --git a/fdpowermon b/fdpowermon
index d7b8b6f..ee20dda 100755
--- a/fdpowermon
+++ b/fdpowermon
@@ -447,6 +447,9 @@ sub checklevels {
 	if($state =~ /Discharging/) {
 		$step = $themes{$theme}->{discharging};
 		$charging = 0;
+	} elsif($state =~ /Not charging/) {
+		$step = $themes{$theme}->{discharging};
+		$charging = 0;
 	} elsif($state =~/Charging/) {
 		$step = $themes{$theme}->{charging};
 		$charging = 1;


signature.asc
Description: PGP signature