[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apm_emu module missing



On Thu, 17 Oct 2024 at 17:54, Ed Robbins <edd.robbins@googlemail.com> wrote:
>
> On Thu, 17 Oct 2024 at 16:51, John Paul Adrian Glaubitz
> <glaubitz@physik.fu-berlin.de> wrote:
> >
> > Hi Ed,
> >
> > On Thu, 2024-10-17 at 16:42 +0100, Ed Robbins wrote:
> > > 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
> >
> > > [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:

ed@powerbook12:~$ cat /sys/class/power_supply/PMU_battery_0/uevent
DEVTYPE=power_supply
POWER_SUPPLY_NAME=PMU_battery_0
POWER_SUPPLY_TYPE=Unknown
...
ed@powerbook12:~$ sudo journalctl -u upower
...
Oct 13 20:00:24 powerbook12 upowerd[994]: did not recognise type
Unknown, please report
...
ed@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


Reply to: