[oi-dev] [CFT] Upower / mate-power-manager test and review

Alexander Pyhalov alp at rsu.ru
Thu Jan 18 13:15:21 UTC 2018

On 01/12/18 04:19 PM, Alexander Pyhalov wrote:
> Hello, guys.
> It seems that my upower port finally is useful. I've tested it in 
> VirtualBox VM and on my notebook (Thinkpad X1 Carbon). While testing on 
> real hardware found some issues, which were not present in VM.

I've been busy with upower/ConsoleKit/mate-power-manager for some time.
Now I have some updates.

Upower - https://github.com/OpenIndiana/oi-userland/pull/3869

1) Now it tends to crash less often - it seems to be able to handle 
battery inserion/removal event and work on systems, which report ac 
device presence, but doesn't have any battery device.
2) We can use new ConsoleKit port, so we modified Hibernate method so 
that it in theory could work (don't have any system which actually can 

mate-power-manager  - https://github.com/OpenIndiana/oi-userland/pull/3870

1) use pfexec instead of pkexec (yes, I know it's not the same, but it's 
poor man's analog);
2) mate power manager now checks if Suspend is actually supported before 
showing this item in menus (so we avoid "blank" menu entries);
3) I've imported subset of gnome-power-manager patch, and now mate power 
manager can really lock screen (on suspend, on lid close and so on);
4) Menu with reaction on power button event is disabled - currently we 
have no means to get power button event in unprivileged process without 
using HAL (and no, I don't want to resurrect HAL support in 
mate-power-manager). Perhaps, better idea is to make Xorg interact with 
HAL (as it anyway already does this) to present xinput 'Power button' 
device, so that mate-power-manager could process this event as any other 
keyboard event.
5) The last change is related to ConsoleKit - I've fixed Hibernate/Sleep 
method to work with our ConsoleKit.

ConsoleKit - https://github.com/OpenIndiana/oi-userland/pull/3873

I've imported upstream (rather old) patches to support 
Suspend/Hibernate/CanSuspend/CanHibernate methods and added 
solaris-specific scripts to actually call uadmin with necessary 
parameters. The issue is that current ConsoleKit has changed method 
signatures to match logind, but I haven't imported these patches due to 
differences in code base. Updating ConsoleKit to the latest one would 
likely fix these issues, but we'll have to inspect a lot of 
Solaris-specific patches (including patches necessary for SunRay 
support) to do this, I'm not ready for this yet. Any volunteers here?

mate-session-manager - https://github.com/OpenIndiana/oi-userland/pull/3879

It needs small fixes to account for incompatible Suspend/Hibernate 
method signatures.

lightdm - https://github.com/OpenIndiana/oi-userland/pull/3874

It needs small fixes to be able to use ConsoleKit to Suspend/Hibernate 

One issue that currently I see is that when system is resumed after 
sleep Intel video adapter doesn't behave properly - 
https://www.illumos.org/issues/8971 (I'd prefer to leave it to someone 
qualified :)) .

I've prepared test images with latest OI and all modified packages 

> I took OpenBSD upower backend and polished it until it behaved on illumos.
> The code can be found here:
> https://github.com/OpenIndiana/oi-userland/pull/3869
> What are current restrictions:
> - we don't try to suspend laptop, just intelligently turn it off, when 
> battery charge is critical (critical is determined by 
> /etc/UPower/UPower.conf);
> - upower backend suggests that we have one AC and one battery. I haven't
> tested it in case when battery is absent (as my is not so easy to 
> remove), but suppose this case is broken.
> - mate-power-manager can't manage display brightness - it's 
> implementation is Linux-specific and there's little gain in illumos port 
> of this functionality as our acpi_drv driver supports display brightness 
> management only for some Toshiba notebooks.
> High-level configuration can also be performed by mate-power-manager ( 
> https://github.com/OpenIndiana/oi-userland/pull/3870 ).
> So, what can we do? React on "lid close", "battery has critical charge"
> events (by powering down system) and monitor current battery state 
> (charge level, status (on-battery/on AC power).
> Test OI images with upower/mate-power-manager pre-installed are 
> available here: http://buildzone.oi-build.r61.net/isos-upower/
> If you want to report issue, please, use the following algorithm:
> a) disable upower service,
> b) kill mate-power-manager,
> c) start upower with /usr/lib/upower -v
> d) start mate-power-manager
> e) log their messages (and/or core dumps).
> P.S.: Yes, I know that code could be better... Don't hesitate to create 
> PRs or report evident issues :)

С уважением,
Александр Пыхалов,
программист отдела телекоммуникационной инфраструктуры
управления информационно-коммуникационной инфраструктуры ЮФУ

More information about the oi-dev mailing list