ENXIOing non-present battery

Dan Lukes dan at obluda.cz
Sun Dec 7 10:11:04 UTC 2014


Colin Percival wrote:
>>> The attached patch adds a acpi.cmbat.hide_not_present loader tunable which,
>>> as the name suggests, hides non-present batteries; this is done in the probe
>>> code by returning ENXIO

>> No, but it may be more useful to create more generalized interface.

> I agree in theory, but do you have any idea how to do this?

Well, may be I'm not the best expert on the matter, but I assume there
is an device enumerator which invoke "probe" function of device drivers.
Such enumerator should skip the devices listen in "don't probe" list.

I'm aware there is no single enumerator in the kernel. All those
enumerators needs to be patched to honor such list.

Other solutions:

No enumerator needs to be patched. There needs to be device driver
module which will claim high priority ownership of all devices on the
"disabled device" list. So particular device will be attached to such
special driver, not to the standard one.

> In the case of my laptop, the only way I can see to distinguish between the
> real battery and the "ghost" battery is that the latter returns zero from
> acpi_BatteryIsPresent;

In case of your particular laptop you can claim second battery to be
ghost battery as you know there is no second battery now and will not be
even in the future.

So no "battery" device driver needs to be attached to such device. It
will hide such battery from applications.

By the way, as long as your ACPI claim non-existent battery as non
existent, it seems not to be broken.

If KDE read remaining capacity of battery claimed to be non-present,
then it seems to be KDE who have broken logic ...

> There is, of course, the option of using debug.apci.disabled to disable
> complete subsystems, but I only want to hide the ghost battery, not the
> real one.

I asked for more generic mechanism, but not as generic as you described.

It would eb nice if we can disable enumeration of broken devices only
(despite they are enumerated trough ACPI, PNP, PCI, USB or so
enumerator), not the just ACPI at all.


Dan




More information about the freebsd-acpi mailing list