This forum has been archived. All content is frozen. Please use KDE Discuss instead.

PowerDevil and APC UPS

Tags: None
(comma "," separated)
User avatar
grof
Registered Member
Posts
49
Karma
0
OS

PowerDevil and APC UPS

Tue Mar 16, 2010 12:42 pm
I am curious...

I have APC's UPS connected to my PC via USB cable. PowerDevil see battery and report them as Number of Batteries 1 (with or without apcupsd daemon).
But, Battery Monitor plasmoid do not see that battery and do not react on changing cord/battery state from UPS and not showing battery state.

Why is that, and can I fix this or this is something what is not supported by Powerdevil/Battery Monitor plasmoid?

Of course, at GNOME the whole thing works well! GNOME's battery applet see UPS's battery state and report them to system tray. Why KDE can not do this??

I'm currently using KDE 4.3.5
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: PowerDevil and APC UPS

Wed Mar 17, 2010 3:50 am
Can you please run the following command?

Code: Select all
solid-hardware query 'IS Battery'


If it returns your device, then the bug is in the Battery Monitor widget.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
grof
Registered Member
Posts
49
Karma
0
OS

Re: PowerDevil and APC UPS

Wed Mar 17, 2010 4:21 pm
Here is the answer from solid-hardware:
Code: Select all
solid-hardware query 'IS Battery'
udi = '/org/freedesktop/Hal/devices/usb_device_51d_2_QB0429138064_if0_hiddev'


And there are details for this item:
Code: Select all
udi = '/org/freedesktop/Hal/devices/usb_device_51d_2_QB0429138064_if0_hiddev'
  parent = '/org/freedesktop/Hal/devices/usb_device_51d_2_QB0429138064_if0'  (string)
  vendor = ''  (string)
  product = 'American Power Conversion Back-UPS CS 650 FW:817.v2.I USB FW:v2'  (string)
  Battery.plugged = true  (bool)
  Battery.type = 'UpsBattery'  (0x2)  (enum)
  Battery.chargePercent = 100  (0x64)  (int)
  Battery.rechargeable = true  (bool)
  Battery.chargeState = 'NoCharge'  (0x0)  (enum)


So, can we assign this as bug in Powerdevil's plasmoid?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: PowerDevil and APC UPS

Thu Mar 18, 2010 4:09 am
Correct, this is a bug in the Battery Monitor widget. Please file a bug at bugs.kde.org.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
grof
Registered Member
Posts
49
Karma
0
OS

Re: PowerDevil and APC UPS

Thu Mar 18, 2010 7:15 am
bcooksley wrote:Correct, this is a bug in the Battery Monitor widget. Please file a bug at bugs.kde.org.


I found this bug report here:
https://bugs.kde.org/show_bug.cgi?id=197627

But the author of Powedevil does not want to work on that feature because he does not have the UPS. :(
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: PowerDevil and APC UPS

Thu Mar 18, 2010 7:21 am
I thought you stated earlier that PowerDevil saw your UPS?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
grof
Registered Member
Posts
49
Karma
0
OS

Re: PowerDevil and APC UPS

Thu Mar 18, 2010 7:28 am
bcooksley wrote:I thought you stated earlier that PowerDevil saw your UPS?


Yes, Powerdevil see my UPS, but widget do not, but I think that Battery monitor widget is a some kind of Powerdevil's plasma functionality and that is the same thing.

So, I'll check this again (is the author of Powerdevil and Battery Monitor the same person :) )

EDIT:

You are right!
This is not the same thing... I'll report bug for the widget itself.

Thx.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: PowerDevil and APC UPS

Thu Mar 18, 2010 7:49 am
Just a quick warning: Whilst the PowerDevil user interface will be aware of the UPS, PowerDevil itself ( the daemon ) is not! This means that if you lose power, PowerDevil will not take needed measures to shutdown the system.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
grof
Registered Member
Posts
49
Karma
0
OS

Re: PowerDevil and APC UPS

Thu Mar 18, 2010 8:05 am
bcooksley wrote:Just a quick warning: Whilst the PowerDevil user interface will be aware of the UPS, PowerDevil itself ( the daemon ) is not! This means that if you lose power, PowerDevil will not take needed measures to shutdown the system.


OK, but isn't it the Battery Monitor's job? Or the Battery monitor is only a monitor?

What about laptops? Is Powerdevil's daemon handles battery measures on laptops?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: PowerDevil and APC UPS

Thu Mar 18, 2010 8:08 am
The Battery Monitor applet is simply a visual display of the system battery status, and provides quick access to some power management methods ( screen brightness, and suspend )

PowerDevil actually does the work of monitoring the battery state and performing actions such as shutting down the system if the level gets too low and power is unavailable.

On laptops, the battery appears as a "Primary" battery and is thus fully supported by both the Monitor and PowerDevil.

I have just fixed the control module in trunk so that it will no longer mislead users.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
grof
Registered Member
Posts
49
Karma
0
OS

Re: PowerDevil and APC UPS

Thu Mar 18, 2010 8:16 am
OK, I understand now.

So this is issue at Powerdevil's daemon level....

If Dario (Powerdevil's author) don't want to implement UPS features to Powerdevil, I'll try with NUT and Knutclient. (But this is another daemon what I must lead to OS and the best solution will be that Powerdevil can handle UPSes ;) )

EDIT:
Maybe I can change NUT's control scripts, so they can send d-bus messages to Powerdevil (In that case we do not need Knutclient, except for monitoring battery state)
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: PowerDevil and APC UPS

Fri Mar 19, 2010 7:31 am
Please note that D-Bus is extremely strict with permissions, unless the NUT client runs as your user, inside your session, it will probably not be able to access it.

In this case, it is just that Dario Freddi does not have a UPS, and therefore cannot test it.

A developer with a UPS is more than welcome to contribute code to make it work, according to Dario's bug report comment ( just a case of changing the needed if() statements really since Solid abstracts the difference away. Whether anything special is needed in Solid is something different altogether )


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
grof
Registered Member
Posts
49
Karma
0
OS

Re: PowerDevil and APC UPS

Fri Mar 19, 2010 7:51 am
bcooksley wrote:A developer with a UPS is more than welcome to contribute code to make it work, according to Dario's bug report comment ( just a case of changing the needed if() statements really since Solid abstracts the difference away. Whether anything special is needed in Solid is something different altogether )


Unfortunately my knowledge of C++ is very poor, so I can not declare myself as C++ programmer or developer. But, I understand the C code pretty well and I can and want to help on any other way :)
User avatar
grof
Registered Member
Posts
49
Karma
0
OS

Re: PowerDevil and APC UPS

Fri Mar 19, 2010 2:07 pm
bcooksley wrote:Please note that D-Bus is extremely strict with permissions, unless the NUT client runs as your user, inside your session, it will probably not be able to access it.


With this simply trick I can sent messages from root scripts to session:

Code: Select all
#!/bin/bash

#Find the user of active session
PID=$(pidof -s knotify4)
QUERY_ENVIRON="$(tr '\0' '\n' < /proc/${PID}/environ | grep "USER" | cut -d "=" -f 2-)"
su ${QUERY_ENVIRON} -c 'qdbus org.kde.powerdevil /modules/powerdevil org.kde.PowerDevil.setProfile string:'Powersave''


I tried with DBUS_SESSION_BUS_ADDRESS, but did not work so I decide to using username of active session user.

It works, so I'm happy.
kdeuser
Registered Member
Posts
4
Karma
0
OS

Re: PowerDevil and APC UPS

Sat Dec 04, 2010 7:30 pm
The bug was solved , but still no ups battery in battery monitor plasmoid.

I installed KDE 4.5.4 yesterday. What's wrong ?


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]