9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
@ 2024-04-16  0:43 sl
  2024-04-16  0:46 ` Noam Preil
  2024-04-16  3:09 ` Sigrid Solveig Haflínudóttir
  0 siblings, 2 replies; 11+ messages in thread
From: sl @ 2024-04-16  0:43 UTC (permalink / raw)
  To: 9front

http://plan9.stanleylieber.com/hardware/thinkpad/x380/yoga/20LH-000YUS/sysinfo

; cat /dev/battery
13245 mW 31790 240 51000 12 1600 mV 15371 15280 03:36:34 discharging

sl

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
  2024-04-16  0:43 [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge sl
@ 2024-04-16  0:46 ` Noam Preil
  2024-04-16  0:55   ` [9front] " Stanley Lieber
  2024-04-16  3:09 ` Sigrid Solveig Haflínudóttir
  1 sibling, 1 reply; 11+ messages in thread
From: Noam Preil @ 2024-04-16  0:46 UTC (permalink / raw)
  To: 9front

If I'm reading that right, it thinks that the battery has degraded and
can only hold ~0.4% of its original capacity, but also that it's
charged to the point where it's holding ~55% of the original capacity,
thus leaving it thinking that the battery is ~13x above max capacity.

That may be just the battery controller being wrong?

- Noam Preil


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [9front] Re: [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
  2024-04-16  0:46 ` Noam Preil
@ 2024-04-16  0:55   ` Stanley Lieber
  2024-04-16  2:29     ` Noam Preil
  0 siblings, 1 reply; 11+ messages in thread
From: Stanley Lieber @ 2024-04-16  0:55 UTC (permalink / raw)
  To: 9front

On April 15, 2024 8:46:23 PM EDT, Noam Preil <noam@pixelhero.dev> wrote:
>If I'm reading that right, it thinks that the battery has degraded and
>can only hold ~0.4% of its original capacity, but also that it's
>charged to the point where it's holding ~55% of the original capacity,
>thus leaving it thinking that the battery is ~13x above max capacity.
>
>That may be just the battery controller being wrong?
>
>- Noam Preil
>
>

it stayed on for >1hr on battery power while i puttered around, didn't try to run it all the way down.

sl

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] Re: [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
  2024-04-16  0:55   ` [9front] " Stanley Lieber
@ 2024-04-16  2:29     ` Noam Preil
  2024-04-16  2:41       ` [9front] " Stanley Lieber
  0 siblings, 1 reply; 11+ messages in thread
From: Noam Preil @ 2024-04-16  2:29 UTC (permalink / raw)
  To: 9front

IIRC, after swapping the battery in my T420s, I had to do a full battery
discharge/charge cycle (drain to 0%, charge to 100%, drain to 0%, charge
to 100%) to get the battery controller to realize that the capacity had
increased.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [9front] Re: [9front] Re: [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
  2024-04-16  2:29     ` Noam Preil
@ 2024-04-16  2:41       ` Stanley Lieber
  2024-04-18  2:45         ` Noam Preil
  0 siblings, 1 reply; 11+ messages in thread
From: Stanley Lieber @ 2024-04-16  2:41 UTC (permalink / raw)
  To: 9front

On April 15, 2024 10:29:11 PM EDT, Noam Preil <noam@pixelhero.dev> wrote:
>IIRC, after swapping the battery in my T420s, I had to do a full battery
>discharge/charge cycle (drain to 0%, charge to 100%, drain to 0%, charge
>to 100%) to get the battery controller to realize that the capacity had
>increased.
>
>

probably should have mentioned, battery status is reported correctly in openbsd.

sl

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [9front] Re: [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
  2024-04-16  0:43 [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge sl
  2024-04-16  0:46 ` Noam Preil
@ 2024-04-16  3:09 ` Sigrid Solveig Haflínudóttir
  2024-04-16 16:19   ` sl
  1 sibling, 1 reply; 11+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2024-04-16  3:09 UTC (permalink / raw)
  To: 9front

In aux/acpi.c try replacing (batteryread func only) bats[n].fullcharge with b->capacity.

On April 16, 2024 2:43:25 AM GMT+02:00, sl@stanleylieber.com wrote:
>http://plan9.stanleylieber.com/hardware/thinkpad/x380/yoga/20LH-000YUS/sysinfo
>
>; cat /dev/battery
>13245 mW 31790 240 51000 12 1600 mV 15371 15280 03:36:34 discharging
>
>sl

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] Re: [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
  2024-04-16  3:09 ` Sigrid Solveig Haflínudóttir
@ 2024-04-16 16:19   ` sl
  2024-04-17 21:24     ` sl
  0 siblings, 1 reply; 11+ messages in thread
From: sl @ 2024-04-16 16:19 UTC (permalink / raw)
  To: 9front

> In aux/acpi.c try replacing (batteryread func only) bats[n].fullcharge
> with b->capacity.

i did this:

 				state = "charging";
 			if(st.rate > 0 && (st.state & 2) == 0)
 				ss = st.capacity * 3600 / st.rate;
-			if(bats[n].fullcharge > 0){
-				x = st.capacity * 100 / bats[n].fullcharge;
+			if(b->capacity > 0){
+				x = st.capacity * 100 / b->capacity;
 				if(st.rate > 0 && (st.state & 2) != 0)
-					ss = (bats[n].fullcharge - st.capacity) * 3600 / st.rate;
+					ss = (b->capacity - st.capacity) * 3600 / st.rate;
 			}
 		}else{
 			memset(&st, 0, sizeof(st));

and i get this:

; mk acpi.install
6l  -o 6.acpi acpi.6
cp 6.acpi /amd64/bin/aux/acpi
; aux/acpi
; cat /dev/battery
82479 mW 197950 240 51000 12 1600 mV 0 15280 00:00:00 discharging

sl

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] Re: [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
  2024-04-16 16:19   ` sl
@ 2024-04-17 21:24     ` sl
  2024-04-17 21:30       ` Sigrid Solveig Haflínudóttir
  0 siblings, 1 reply; 11+ messages in thread
From: sl @ 2024-04-17 21:24 UTC (permalink / raw)
  To: 9front

after a cold boot with the test code it seemed everything was now working normally.

but every cold boot produces wildly different numbers for the first field:

389
619
103

then it increments (when plugged in) or decrements (when unplugged) roughly
as expected.

sl

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] Re: [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
  2024-04-17 21:24     ` sl
@ 2024-04-17 21:30       ` Sigrid Solveig Haflínudóttir
  2024-04-17 21:42         ` sl
  0 siblings, 1 reply; 11+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2024-04-17 21:30 UTC (permalink / raw)
  To: 9front

Can you try killing aux/acpi, starting a new one and checking if there is any difference?
Maybe it should query all of the battery info every single time.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] Re: [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
  2024-04-17 21:30       ` Sigrid Solveig Haflínudóttir
@ 2024-04-17 21:42         ` sl
  0 siblings, 0 replies; 11+ messages in thread
From: sl @ 2024-04-17 21:42 UTC (permalink / raw)
  To: 9front

> Can you try killing aux/acpi, starting a new one and checking 
> if there is any difference? Maybe it should query all of the 
> battery info every single time.

the first time i did this, the readings looked more or less accurate.

did it again, and now the readings are definitely wrong again.

sl

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [9front] Re: [9front] Re: [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
  2024-04-16  2:41       ` [9front] " Stanley Lieber
@ 2024-04-18  2:45         ` Noam Preil
  0 siblings, 0 replies; 11+ messages in thread
From: Noam Preil @ 2024-04-18  2:45 UTC (permalink / raw)
  To: 9front

Ah. Might be a bug in our ACPI library, then?


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-04-18  2:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-16  0:43 [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge sl
2024-04-16  0:46 ` Noam Preil
2024-04-16  0:55   ` [9front] " Stanley Lieber
2024-04-16  2:29     ` Noam Preil
2024-04-16  2:41       ` [9front] " Stanley Lieber
2024-04-18  2:45         ` Noam Preil
2024-04-16  3:09 ` Sigrid Solveig Haflínudóttir
2024-04-16 16:19   ` sl
2024-04-17 21:24     ` sl
2024-04-17 21:30       ` Sigrid Solveig Haflínudóttir
2024-04-17 21:42         ` sl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).