9front - general discussion about 9front
 help / color / mirror / Atom feed
From: sl@stanleylieber.com
To: 9front@9front.org
Subject: Re: [9front] Re: [9front] ThinkPad X380 Yoga, aux/acpi reports 13245% battery charge
Date: Tue, 16 Apr 2024 12:19:38 -0400	[thread overview]
Message-ID: <987137D97785518F2D32366C21388469@gaff.inri.net> (raw)
In-Reply-To: <C616324B-5F0F-44D2-9CF1-410D65BFCFEF@ftrv.se>

> 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

  reply	other threads:[~2024-04-16 16:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16  0:43 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 [this message]
2024-04-17 21:24     ` sl
2024-04-17 21:30       ` Sigrid Solveig Haflínudóttir
2024-04-17 21:42         ` sl

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=987137D97785518F2D32366C21388469@gaff.inri.net \
    --to=sl@stanleylieber.com \
    --cc=9front@9front.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;
as well as URLs for NNTP newsgroup(s).