On Sat, Oct 08, 2022 at 03:10:18PM +0300, Mikhail wrote: > 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)
Thinking about this a little bit more, I thought that we can just check if EC_ID from ECDT is actually present, and if it's not - fail the attach. With the patch I see two ECs in my dmesg: acpiec0 at acpi0 acpiec0: failed to find EC_ID acpiec0: Failed to read resource settings [...] acpiec1 at acpi0 which is of course wrong. But these things works: - apm status - capslock led - brightness keys diff /usr/src commit - 924a158ae16809f41bf3f03c54fb2a8cdfa1d6e8 path + /usr/src blob - 5ef24d5179de52d5321e578b3b73dd9524e7c1de file + sys/dev/acpi/acpiec.c --- sys/dev/acpi/acpiec.c +++ sys/dev/acpi/acpiec.c @@ -429,6 +429,14 @@ acpiec_getcrs(struct acpiec_softc *sc, struct acpi_att /* Check if this is ECDT initialization */ if (ecdt) { + /* Get devnode from header */ + sc->sc_devnode = aml_searchname(sc->sc_acpi->sc_root, + ecdt->ec_id); + if (sc->sc_devnode == NULL) { + printf("%s: failed to find EC_ID\n", DEVNAME(sc)); + return (1); + } + /* Get GPE, Data and Control segments */ sc->sc_gpe = ecdt->gpe_bit; @@ -444,10 +452,6 @@ acpiec_getcrs(struct acpiec_softc *sc, struct acpi_att sc->sc_data_bt = sc->sc_acpi->sc_memt; sc->sc_ec_data = ecdt->ec_data.address; - /* Get devnode from header */ - sc->sc_devnode = aml_searchname(sc->sc_acpi->sc_root, - ecdt->ec_id); - goto ecdtdone; }