how can I read the upower UPS battery state from a file?

Asked by Keith Myers on 2019-10-04

I have old outdated code in the BOINC client that tries to read the state of system batteries from outdated and old interfaces. The current upower interface seems to be the current and modern interface to use. But I can't determine if upower sets the power state in any discrete system file that can be read from the client code. It looks like the only way to poll the state is to use the upower command line interface which would be much harder to code and is not a simple drop in.

What I would like is to inform the BOINC client that the system has switched off from mains power to UPS standby power so that the client can shed compute load. The client mechanism works correctly for a Windows host but is ignored by Linux hosts.

I think the code needs to be updated in the https://github.com/BOINC/boinc/blob/master/client/hostinfo_unix.cpp#L195 file so that a new method for upower is added. But I am not a programmer and need help. The BOINC project does not have any current Linux programmers.

Can somebody suggest what changes to be made to this module to use the upower interface to determine the status of when the host goes onto UPS standby power. Thanks for any help.

Question information

Language:
English Edit question
Status:
Open
For:
Ubuntu upower Edit question
Assignee:
No assignee Edit question
Last query:
2019-10-04
Last reply:

Can you help with this problem?

Provide an answer of your own, or ask Keith Myers for more information if necessary.

To post a message you must log in.