From: Peter Toth Subject: Re: acpibat remaining capacity is 0 To: tech@openbsd.org Date: Tue, 25 Feb 2025 09:08:04 +0100 Performed a bit more testing with ACPI_DEBUG enabled and that produced the same result for _BST method, remaining capacity returns 1 (output below). The other _BST fields are working as expected and refreshing values correctly. Checked sys/dev/acpi/dsdt.c and the ACPI spec for the battery state method and all those values are parsed through the same functions and should be the same type according the spec: Package { Battery State // Integer (DWORD) Battery Present Rate // Integer (DWORD) Battery Remaining Capacity // Integer (DWORD) Battery Present Voltage // Integer (DWORD) } ACPI_DEBUG: --==Finished evaluating method: \\_SB_.BAT0._BST t 0xffff800002212888 cnt:01 stk:00 package: 04 0xffff800002216f08 cnt:01 stk:00 integer: 1 0xffff800002212788 cnt:01 stk:00 integer: 1ac 0xffff800002214888 cnt:01 stk:00 integer: 1 <--- remaining capacity 0xffff800002213788 cnt:01 stk:00 integer: 2d1d ===== Stack \\_SB_.BAT0._BST:Method I will test a bit more as time permits. PT On Fri, Feb 21, 2025 at 7:24 PM Peter Toth wrote: > > Hi all, > > Tested a couple of Getac laptops recently with latest amd64 snapshots. > Both have dual batteries attached to acpibat(4) and both show 0 > remaining battery capacity. > Apart from that most other battery properties are OK and sysctl reports: > hw.sensors.acpibat0.volt0=11.10 VDC (voltage) > hw.sensors.acpibat0.volt1=11.63 VDC (current voltage) > hw.sensors.acpibat0.current0=0.39 A (rate) > hw.sensors.acpibat0.amphour0=2.01 Ah (last full capacity) > hw.sensors.acpibat0.amphour1=0.00 Ah (warning capacity) > hw.sensors.acpibat0.amphour2=0.00 Ah (low capacity) > hw.sensors.acpibat0.amphour3=0.00 Ah (remaining capacity), OK > hw.sensors.acpibat0.amphour4=2.10 Ah (design capacity) > hw.sensors.acpibat0.raw0=1 (battery discharging), OK > hw.sensors.acpibat1.volt0=11.10 VDC (voltage) > hw.sensors.acpibat1.volt1=11.63 VDC (current voltage) > hw.sensors.acpibat1.current0=0.40 A (rate) > hw.sensors.acpibat1.amphour0=2.04 Ah (last full capacity) > hw.sensors.acpibat1.amphour1=0.00 Ah (warning capacity) > hw.sensors.acpibat1.amphour2=0.00 Ah (low capacity) > hw.sensors.acpibat1.amphour3=0.00 Ah (remaining capacity), OK > hw.sensors.acpibat1.amphour4=2.10 Ah (design capacity) > hw.sensors.acpibat1.raw0=1 (battery discharging), OK > > Inserted a couple of printf lines in sys/dev/acpi/acpibat.c to see > what could be happening. The battery state for capacity in > acpibat_getbst, line sc->sc_bst.bst_capacity = > aml_val2int(res.v_package[2]); always reports a value of "1". The > other 3 bst properties for voltage, rate and state are correct. > > Perhaps the AML parsing is breaking on some unexpected DSDT _BST > values. If anyone is interested, I've uploaded the gzipped DSDT.dsl > to: > https://limewire.com/d/10e22f54-79da-456b-b492-c67e5cd40f81#EQDxKXdMDt05voTVeono-cfx3tgF3MJP9RdUhiEPEKg > > Perhaps someone has already seen this issue before, I would appreciate > any help or pointers. > > As a side note, also tested with FreeBSD live usb boot and the > remaining capacity showed up OK (same in Linux). > > dmesg below: > OpenBSD 7.6 (GENERIC.MP) #10: Fri Feb 21 17:00:04 CET 2025 > p@b360.my.domain:/usr/src/sys/arch/amd64/compile/GENERIC.MP > real mem = 68532105216 (65357MB) > avail mem = 66431197184 (63353MB) > random: good seed from bootblocks > mpath0 at root > scsibus0 at mpath0: 256 targets > mainbus0 at root > bios0 at mainbus0: SMBIOS rev. 3.2 @ 0x9a263000 (38 entries) > bios0: vendor INSYDE Corp. version "R1.35.070520" date 05/29/2024 > bios0: GETAC B360 > efi0 at bios0: UEFI 2.7 > efi0: INSYDE Corp. rev 0x1350000 > acpi0 at bios0: ACPI 5.1 > acpi0: sleep states S0 S3 S4 S5 > acpi0: tables DSDT FACP UEFI SSDT SSDT SSDT TPM2 MSDM LPIT WSMT SSDT > SSDT DBGP DBG2 SSDT SSDT SSDT SSDT NHLT ECDT HPET APIC MCFG SSDT DMAR > SSDT FPDT ASF! BGRT > acpi0: wakeup devices UAR1(S3) GLAN(S4) XHC_(S3) XDCI(S4) HDAS(S4) > RP01(S4) RP02(S4) RP03(S4) RP04(S4) RP05(S4) RP06(S4) RP07(S4) > RP08(S4) RP09(S4) PEGP(S4) RP10(S4) [...] > acpitimer0 at acpi0: 3579545 Hz, 24 bits > acpiec0 at acpi0 > acpihpet0 at acpi0: 23999999 Hz > acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat > cpu0 at mainbus0: apid 0 (boot processor) > cpu0: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz, 1547.73 MHz, > 06-8e-0c, patch 000000fc > cpu0: cpuid 1 edx=bfebfbff > ecx=77fafbbf > cpu0: cpuid 6 eax=27f7 ecx=9 > cpu0: cpuid 7.0 > ebx=29c67af > edx=bc000600 > cpu0: cpuid a vers=4, gp=4, gpwidth=48, ff=3, ffwidth=48 > cpu0: cpuid d.1 eax=f > cpu0: cpuid 80000001 edx=2c100800 > ecx=121 > cpu0: cpuid 80000007 edx=100 > cpu0: msr 10a=a0a0c2b > cpu0: 32KB 64b/line 8-way D-cache, 32KB 64b/line 8-way I-cache, 256KB > 64b/line 4-way L2 cache, 6MB 64b/line 12-way L3 cache > cpu0: smt 0, core 0, package 0 > mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges > cpu0: apic clock running at 24MHz > cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1.1.1, IBE > cpu1 at mainbus0: apid 2 (application processor) > cpu1: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz, 1513.41 MHz, > 06-8e-0c, patch 000000fc > cpu1: smt 0, core 1, package 0 > cpu2 at mainbus0: apid 4 (application processor) > cpu2: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz, 1496.52 MHz, > 06-8e-0c, patch 000000fc > cpu2: smt 0, core 2, package 0 > cpu3 at mainbus0: apid 6 (application processor) > cpu3: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz, 1496.52 MHz, > 06-8e-0c, patch 000000fc > cpu3: smt 0, core 3, package 0 > cpu4 at mainbus0: apid 1 (application processor) > cpu4: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz, 1496.51 MHz, > 06-8e-0c, patch 000000fc > cpu4: smt 1, core 0, package 0 > cpu5 at mainbus0: apid 3 (application processor) > cpu5: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz, 1496.52 MHz, > 06-8e-0c, patch 000000fc > cpu5: smt 1, core 1, package 0 > cpu6 at mainbus0: apid 5 (application processor) > cpu6: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz, 1496.51 MHz, > 06-8e-0c, patch 000000fc > cpu6: smt 1, core 2, package 0 > cpu7 at mainbus0: apid 7 (application processor) > cpu7: Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz, 1496.52 MHz, > 06-8e-0c, patch 000000fc > cpu7: smt 1, core 3, package 0 > ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 120 pins > acpimcfg0 at acpi0 > acpimcfg0: addr 0xe0000000, bus 0-255 > acpiprt0 at acpi0: bus 0 (PCI0) > acpiprt1 at acpi0: bus -1 (RP01) > acpiprt2 at acpi0: bus -1 (RP02) > acpiprt3 at acpi0: bus -1 (RP03) > acpiprt4 at acpi0: bus -1 (RP04) > acpiprt5 at acpi0: bus -1 (RP05) > acpiprt6 at acpi0: bus -1 (RP06) > acpiprt7 at acpi0: bus -1 (RP07) > acpiprt8 at acpi0: bus 1 (RP08) > acpiprt9 at acpi0: bus -1 (RP09) > acpiprt10 at acpi0: bus 2 (RP10) > acpiprt11 at acpi0: bus -1 (RP11) > acpiprt12 at acpi0: bus -1 (RP12) > acpiprt13 at acpi0: bus 7 (RP13) > acpiprt14 at acpi0: bus -1 (RP14) > acpiprt15 at acpi0: bus -1 (RP15) > acpiprt16 at acpi0: bus -1 (RP16) > acpiprt17 at acpi0: bus -1 (RP17) > acpiprt18 at acpi0: bus -1 (RP18) > acpiprt19 at acpi0: bus -1 (RP19) > acpiprt20 at acpi0: bus -1 (RP20) > acpiprt21 at acpi0: bus -1 (RP21) > acpiprt22 at acpi0: bus -1 (RP22) > acpiprt23 at acpi0: bus -1 (RP23) > acpiprt24 at acpi0: bus -1 (RP24) > acpipci0 at acpi0 PCI0: 0x00000010 0x00000011 0x00000000 > "MTC0303" at acpi0 not configured > "PNP0A05" at acpi0 not configured > com0 at acpi0 UAR1 addr 0x3f8/0x8 irq 4: ns16550a, 16 byte fifo > com1 at acpi0 UAR2 addr 0x2f8/0x8 irq 3: ns16550a, 16 byte fifo > "PNP0A05" at acpi0 not configured > com3 at acpi0 UAR1 addr 0x2e8/0x8 irq 5: ns16550a, 16 byte fifo > com3: probed fifo depth: 0 bytes > "ETD045F" at acpi0 not configured > "MSFT9001" at acpi0 not configured > pchgpio0 at acpi0 GPI0 addr 0xfd6e0000/0x10000 0xfd6d0000/0x10000 > 0xfd6a0000/0x10000 irq 14, 320 pins > "CUST0000" at acpi0 not configured > "INT3515" at acpi0 not configured > "ACPI000E" at acpi0 not configured > "PNP0C14" at acpi0 not configured > acpiac0 at acpi0: AC unit offline > acpibat0 at acpi0: BAT0 model "Internal Battery" type Lion oem > "Generic Charger " > acpibat1 at acpi0: BAT1 model "Internal Battery" type Lion oem > "Generic Charger " > acpibtn0 at acpi0: LID0 > "PNP0C14" at acpi0 not configured > acpibtn1 at acpi0: SLPB > "PNP0C14" at acpi0 not configured > "PNP0C14" at acpi0 not configured > intelpmc0 at acpi0: PEPD > state 0: 0x7f:1:2:0x00:0x0000000000000060 > counter: 0x7f:64:0:0x00:0x0000000000000632 > frequency: 0 > state 1: 0x7f:1:2:0x00:0x0000000000000060 > counter: 0x00:32:0:0x03:0x00000000fe00193c > frequency: 9580 > tpm0 at acpi0 TPM_ 2.0 (TIS) addr 0xfed40000/0x5000, device 0x001b15d1 rev 0x16 > "PNP0C14" at acpi0 not configured > acpipwrres0 at acpi0: USBC, resource for XDCI > acpipwrres1 at acpi0: PC05, resource for RP09 > acpipwrres2 at acpi0: V0PR > acpipwrres3 at acpi0: V1PR > acpipwrres4 at acpi0: V2PR > acpipwrres5 at acpi0: WRST > acpicpu0 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 > mwait.1@0x33), C1(1000@1 mwait.1), PSS > acpicpu1 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 > mwait.1@0x33), C1(1000@1 mwait.1), PSS > acpicpu2 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 > mwait.1@0x33), C1(1000@1 mwait.1), PSS > acpicpu3 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 > mwait.1@0x33), C1(1000@1 mwait.1), PSS > acpicpu4 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 > mwait.1@0x33), C1(1000@1 mwait.1), PSS > acpicpu5 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 > mwait.1@0x33), C1(1000@1 mwait.1), PSS > acpicpu6 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 > mwait.1@0x33), C1(1000@1 mwait.1), PSS > acpicpu7 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 > mwait.1@0x33), C1(1000@1 mwait.1), PSS > acpitz0 at acpi0: critical temperature is 99 degC > acpipwrres6 at acpi0: PIN_ > acpivideo0 at acpi0: GFX0 > acpivout0 at acpivideo0: DD1F > cpu0: Enhanced SpeedStep 1547 MHz: speeds: 2101, 2100, 2000, 1900, > 1700, 1600, 1500, 1400, 1200, 1100, 1000, 800, 700, 600, 500, 400 MHz > pci0 at mainbus0 bus 0 > pchb0 at pci0 dev 0 function 0 "Intel Core 10G Host" rev 0x0c > inteldrm0 at pci0 dev 2 function 0 "Intel UHD Graphics" rev 0x02 > drm0 at inteldrm0 > inteldrm0: msi, COMETLAKE, gen 9 > pchtemp0 at pci0 dev 18 function 0 "Intel 400 Series Thermal" rev 0x00 > "Intel 400 Series ISH" rev 0x00 at pci0 dev 19 function 0 not configured > xhci0 at pci0 dev 20 function 0 "Intel 400 Series xHCI" rev 0x00: msi, xHCI 1.10 > usb0 at xhci0: USB revision 3.0 > uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev > 3.00/1.00 addr 1 > "Intel 400 Series Shared SRAM" rev 0x00 at pci0 dev 20 function 2 not configured > dwiic0 at pci0 dev 21 function 0 "Intel 400 Series I2C" rev 0x00: apic 2 int 16 > iic0 at dwiic0 > dwiic1 at pci0 dev 21 function 1 "Intel 400 Series I2C" rev 0x00: apic 2 int 17 > iic1 at dwiic1 > ihidev0 at iic1 addr 0x2a gpio 103, vendor 0xeef product 0xc002, CUST0000 > ihidev0: 24 report ids > ims0 at ihidev0 reportid 1: 3 buttons > wsmouse0 at ims0 mux 0 > hid at ihidev0 reportid 3 not configured > hid at ihidev0 reportid 5 not configured > hid at ihidev0 reportid 7 not configured > ims1 at ihidev0 reportid 24: 1 button, tip > wsmouse1 at ims1 mux 0 > dwiic2 at pci0 dev 21 function 2 "Intel 400 Series I2C" rev 0x00: apic 2 int 18 > iic2 at dwiic2 > "INT3515" at iic2 addr 0x23 not configured > "Intel 400 Series MEI" rev 0x00 at pci0 dev 22 function 0 not configured > ahci0 at pci0 dev 23 function 0 "Intel 400 Series AHCI" rev 0x00: msi, > AHCI 1.3.1 > ahci0: PHY offline on port 0 > ahci0: PHY offline on port 1 > scsibus1 at ahci0: 32 targets > ppb0 at pci0 dev 28 function 0 "Intel 400 Series PCIE" rev 0xf0: msi > pci1 at ppb0 bus 1 > iwx0 at pci1 dev 0 function 0 "Intel Wi-Fi 6 AX200" rev 0x1a, msix > ppb1 at pci0 dev 29 function 0 "Intel 400 Series PCIE" rev 0xf0: msi > pci2 at ppb1 bus 2 > ppb2 at pci0 dev 29 function 4 "Intel 400 Series PCIE" rev 0xf0: msi > pci3 at ppb2 bus 7 > nvme0 at pci3 dev 0 function 0 "Samsung PM9C1 NVMe" rev 0x00: msix, NVMe 2.0 > nvme0: Samsung SSD 990 PRO 1TB, firmware 4B2QJXD7, serial S6Z2NU0X554555D > scsibus2 at nvme0: 2 targets, initiator 0 > sd0 at scsibus2 targ 1 lun 0: > sd0: 953869MB, 512 bytes/sector, 1953525168 sectors > pcib0 at pci0 dev 31 function 0 "Intel 400 Series LPC" rev 0x00 > azalia0 at pci0 dev 31 function 3 "Intel 400 Series HD Audio" rev 0x00: msi > azalia0: codecs: Realtek ALC268, Intel/0x280b, using Realtek ALC268 > audio0 at azalia0 > ichiic0 at pci0 dev 31 function 4 "Intel 400 Series SMBus" rev 0x00: > apic 2 int 16 > iic3 at ichiic0 > spdmem0 at iic3 addr 0x50: 32GB DDR4 SDRAM PC4-25600 SO-DIMM > spdmem1 at iic3 addr 0x52: 32GB DDR4 SDRAM PC4-25600 SO-DIMM > "Intel 400 Series SPI" rev 0x00 at pci0 dev 31 function 5 not configured > em0 at pci0 dev 31 function 6 "Intel I219-LM" rev 0x00: msi, address > 00:22:20:3e:a3:52 > isa0 at pcib0 > isadma0 at isa0 > pckbc0 at isa0 port 0x60/5 irq 1 irq 12 > pckbd0 at pckbc0 (kbd slot) > wskbd0 at pckbd0: console keyboard > pms0 at pckbc0 (aux slot) > wsmouse2 at pms0 mux 0 > pms0: Elantech Touchpad, version 4, firmware 0x5e0f01 > pcppi0 at isa0 port 0x61 > spkr0 at pcppi0 > vmm0 at mainbus0: VMX/EPT > efifb at mainbus0 not configured > uhub1 at uhub0 port 8 configuration 1 interface 0 "Genesys Logic > USB2.0 Hub" rev 2.00/60.90 addr 2 > ugen0 at uhub1 port 1 "Generic EMV Smartcard Reader" rev 2.01/1.20 addr 3 > uvideo0 at uhub0 port 9 configuration 1 interface 0 "SunplusIT Inc > Full HD Camera" rev 2.01/1.10 addr 4 > video0 at uvideo0 > vscsi0 at root > scsibus3 at vscsi0: 256 targets > softraid0 at root > scsibus4 at softraid0: 256 targets > sd1 at scsibus4 targ 1 lun 0: > sd1: 953609MB, 512 bytes/sector, 1952992063 sectors > root on sd1a (81e11568a3f5b815.a) swap on sd1b dump on sd1b > inteldrm0: 1920x1080, 32bpp > wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0 > wsdisplay0: screen 1-5 added (std, vt100 emulation) > iwx0: hw rev 0x340, fw 77.a20fb07d.0, address e0:2e:0b:92:0b:08