Discussion:
apm_emu module missing
(too old to reply)
Ed Robbins
2024-10-13 21:10:01 UTC
Permalink
Hi all,
I believe that the apm_emu module is required for battery
indicator/monitoring on certain powerbooks?

It seems to be missing on latest kernels (6.3, 6.11). Can it be
enabled for our config?

Or, is there an alternative way to enable battery indicators?

Thanks,
Ed
Ed Robbins
2024-10-17 15:50:01 UTC
Permalink
Hi again,
Post by Ed Robbins
Hi all,
I believe that the apm_emu module is required for battery
indicator/monitoring on certain powerbooks?
It seems to be missing on latest kernels (6.3, 6.11). Can it be
enabled for our config?
Or, is there an alternative way to enable battery indicators?
I recompiled the 6.11.2 kernel and added the apm_emu module. It does
give extra compatibility with battery indicator software. xbattbar
works, and although xfce4 battery plugin removed support for APM on
Linux a couple of versions ago, I was able to build an older version
(1.1.1) and it works perfectly with the latest xfce4, as long as
apm_emu is present.

So I think that the apm_emu module should be included by default in
powerpc kernel builds. Is it possible to have it added to the kernel
config?

Thanks,
Ed
Post by Ed Robbins
Thanks,
Ed
John Paul Adrian Glaubitz
2024-10-17 16:00:01 UTC
Permalink
Hi Ed,
Post by Ed Robbins
So I think that the apm_emu module should be included by default in
powerpc kernel builds. Is it possible to have it added to the kernel
config?
Yes, this is possible. Someone needs to open a pull request with the
corresponding change to the powerpc kernel configuration [1].

Adrian
Post by Ed Robbins
[1] https://salsa.debian.org/kernel-team/linux/-/blob/master/debian/config/kernelarch-powerpc/config?ref_type=heads
--
.''`. John Paul Adrian Glaubitz
: :' : Debian Developer
`. `' Physicist
`- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Ed Robbins
2024-10-17 17:00:01 UTC
Permalink
On Thu, 17 Oct 2024 at 16:51, John Paul Adrian Glaubitz
Post by John Paul Adrian Glaubitz
Hi Ed,
Post by Ed Robbins
So I think that the apm_emu module should be included by default in
powerpc kernel builds. Is it possible to have it added to the kernel
config?
Yes, this is possible. Someone needs to open a pull request with the
corresponding change to the powerpc kernel configuration [1].
Adrian
Post by Ed Robbins
[1] https://salsa.debian.org/kernel-team/linux/-/blob/master/debian/config/kernelarch-powerpc/config?ref_type=heads
Thanks Adrian, I will try to do it!

Ed
Ed Robbins
2024-10-18 04:20:01 UTC
Permalink
Post by Ed Robbins
On Thu, 17 Oct 2024 at 16:51, John Paul Adrian Glaubitz
Post by John Paul Adrian Glaubitz
Hi Ed,
Post by Ed Robbins
So I think that the apm_emu module should be included by default in
powerpc kernel builds. Is it possible to have it added to the kernel
config?
Yes, this is possible. Someone needs to open a pull request with the
corresponding change to the powerpc kernel configuration [1].
Adrian
Post by Ed Robbins
[1] https://salsa.debian.org/kernel-team/linux/-/blob/master/debian/config/kernelarch-powerpc/config?ref_type=heads
I spent some time looking at this again this evening, and it turns out
that there is a much better solution. The macintosh PMU driver uses
the Linux power supply subsystem and reports info about the battery,
but it is not being picked up by the upower daemon because the driver
does not give the battery type, so it comes out as "Unknown", and
upower doesn't recognise it as battery:

***@powerbook12:~$ cat /sys/class/power_supply/PMU_battery_0/uevent
DEVTYPE=power_supply
POWER_SUPPLY_NAME=PMU_battery_0
POWER_SUPPLY_TYPE=Unknown
...
***@powerbook12:~$ sudo journalctl -u upower
...
Oct 13 20:00:24 powerbook12 upowerd[994]: did not recognise type
Unknown, please report
...
***@powerbook12:~$ upower -e
/org/freedesktop/UPower/devices/line_power_pmu_ac
/org/freedesktop/UPower/devices/DisplayDevice

It turns out that adding a single line in the driver
(drivers/power/supply/pmu_battery.c) is enough to fix this:
pbat->bat_desc.type = POWER_SUPPLY_TYPE_BATTERY;

After recompiling the module upower can see the battery and the
default GUI indicators work as well.

I will try to submit this change upstream.
Ed
Riccardo Mottola
2024-10-18 07:50:01 UTC
Permalink
Hi Ed,
Post by Ed Robbins
I believe that the apm_emu module is required for battery
indicator/monitoring on certain powerbooks?
It seems to be missing on latest kernels (6.3, 6.11). Can it be
enabled for our config?
Or, is there an alternative way to enable battery indicators?
GNUstep battery monitor (batmon.app) supports directly the Apple PMU.
Didn't check if it is packaged on Debian though.
I didn't even know emulation of APM existed.
It has some minor shortcomings since it seems the kernel has some bogus
flags, I asked about this here in the mailing list a year ago and never
got an answer! So it can what I found though reverse engineering.

Riccardo
Ed Robbins
2024-10-18 08:30:01 UTC
Permalink
Hi Riccardo,

On Fri, 18 Oct 2024 at 08:44, Riccardo Mottola
Post by John Paul Adrian Glaubitz
Hi Ed,
Post by Ed Robbins
I believe that the apm_emu module is required for battery
indicator/monitoring on certain powerbooks?
It seems to be missing on latest kernels (6.3, 6.11). Can it be
enabled for our config?
Or, is there an alternative way to enable battery indicators?
GNUstep battery monitor (batmon.app) supports directly the Apple PMU.
Didn't check if it is packaged on Debian though.
I didn't even know emulation of APM existed.
It has some minor shortcomings since it seems the kernel has some bogus
flags, I asked about this here in the mailing list a year ago and never
got an answer! So it can what I found though reverse engineering.
Well, the latest version of xfce4-battery-plugin supports neither APM
nor upower nor the apple PMU in some more direct way. So fixing upower
does not actually resolve my original problem directly either. But
there is some other battery indicator in the xfce panel by default
that does support upower, and the xfce power preferences also seems to
support upower. So if upstream accept a patch for upower support this
will be acceptable to me.

However if the apm_emu module would be useful for other desktop
environments I can submit a patch to add it to the default debian
powerpc kernel config as suggested by Adrian? It appears the GNUstep
battery monitor does support APM.

I submitted a kernel patch to fix upower support this morning [1].
Ed

[1] https://lore.kernel.org/linux-pm/***@googlemail.com/T/#u
Riccardo Mottola
2024-10-18 09:30:01 UTC
Permalink
Hi,
Post by Ed Robbins
However if the apm_emu module would be useful for other desktop
environments I can submit a patch to add it to the default debian
powerpc kernel config as suggested by Adrian? It appears the GNUstep
battery monitor does support APM.
GNUstep Battery Monitor supports both ACPI, APM and PMU in that fallback
order, IIRC. It's my code!
It started as APM many years ago, but that is mostly obsolete. I also
wrote the PMU support, maybe it should be preferred if found?

But as you write, probably there are few or no monitors left supporting
APM. I hinted you to batmon to avoid it, if you wish.

Riccardo
Ed Robbins
2024-11-10 12:20:01 UTC
Permalink
Post by Ed Robbins
I submitted a kernel patch to fix upower support this morning [1].
Ed
FYI this got accepted to Sebastian Reichel's tree and should appear in
6.13, after that battery and power monitoring for apple laptops should
work again.
Ed

Loading...