> Date: Sat, 8 Oct 2022 15:10:18 +0300 > From: Mikhail <mp39...@gmail.com> > > I'm troubleshooting battery status for my Lenovo IdeaPad 3 14ITL05, on > latest -current it shows that battery is absent and AC not connected: > > Battery state: absent, 0% remaining, unknown life estimate > AC adapter state: not connected > Performance adjustment mode: manual (2900 MHz) > > while reviewing the code and ASL dump for DSDT I found strange code path > in acpiec.c: > > 284 if (aml_evalinteger(sc->sc_acpi, sc->sc_devnode, "_STA", 0, NULL, > &st)) > 285 st = STA_PRESENT | STA_ENABLED | STA_DEV_OK; > 286 if ((st & STA_PRESENT) == 0) { > 287 printf(": not present\n"); > 288 return; > 289 } > > In my case, for acpiec0, sc->sc_devnode is NULL, and aml_evalinteger > returns (ACPI_E_BADVALUE), which is (1), so 'if' statement becomes true > and 'st' got set, further down we check for 'st' value which looks > useless. > > With the patch inlined I was able to see my battery and AC status: > > Battery state: high, 100% remaining, unknown life estimate > AC adapter state: connected > Performance adjustment mode: manual (2900 MHz) > > If I unplug the AC, change is also detected. > > Old, new and diff of dmesg's are also inlined. Notable change - new > acpiec1 device in new dmesg, acpiec0 is detected as 'not present'. > > Can somebody with broader understanding of ACPI and auto configuration > procedure take a look at the patch and assess it?
The patch isn't quite right, but you're on the right track here. Can you send me the contents of /var/db/acpi for this machine? Alternatively you can use sendbug(1), which will create a report with all the necessary information attached. Cheers, Mark