Message boards : BOINC Manager : What module contains the code to detect when the host computer has shifted to battery power?
Message board moderation
Author | Message |
---|---|
Send message Joined: 17 Nov 16 Posts: 890 |
What module contains the code to detect when the host computer has shifted to battery power? The "Suspend computer when on battery" setting in the Manager does not work in Linux Ubuntu for PC's that are backed up by a UPS and running the apcupsd daemon. I do not know if this setting is observed in laptops. Maybe someone with a laptop running Linux can comment if it works or not. There is a running daemon in Linux that monitors all devices that can run on battery power. It can be polled for battery level, discharge or charge state and whether the device in on battery power. The daemon upowerd could be used to detect when the host has shifted to battery power. Where would this detection code be placed? In the client or the Manager? |
Send message Joined: 5 Oct 06 Posts: 5129 |
Detection will be done in the client. The Manager is simply a 'command and control' module, allowing the user to see data and configure settings (like whether battery status is allowed to change processing state). More seriously, I don't know enough about the internal workings of either Linux or Windows to verify whether the 'external UPS' case is handled through exactly the same pathway as the 'internal laptop primary power' case. That needs nailing down first. |
Send message Joined: 17 Nov 16 Posts: 890 |
So who would know where the code resides. I have tried searching on "battery" in the client directory and found no hits. So that keyword is not a variable in the code it seems. What would the "on battery" algorithm variable be called? This issue mentions what the Windows API is using. https://github.com/BOINC/boinc/issues/1471 I added comments to this issue. But nothing in the issue points me to where the code resides. |
Send message Joined: 5 Oct 06 Posts: 5129 |
Sorry, I've had an unexpectedly busy day. I'll try and find time over the weekend to have a ferret around. |
Send message Joined: 17 Nov 16 Posts: 890 |
Finally have managed some usable search output. I think the module that we need to be concerned with is the boinc-client_release-7-7.16/client/hostinfo_unix.cpp file. It should work if the search for the interfaces was up to date. It doesn't appear so. The code looks like it was current for the BOINC Linux 7.4.22 app. None of the interfaces it checks are using the current Linux naming or locations. Lines 223 through 364. We need to change the interrogation to the upower interface. upower -i /org/freedesktop/UPower/devices/ups_hiddev0 native-path: /sys/devices/pci0000:00/0000:00:08.1/0000:0d:00.3/usb9/9-4/9-4:1.0/usbmisc/hiddev0 vendor: American Power Conversion model: Smart-UPS_1500 FW:UPS 03.5 / ID=1015 serial: 3S1831X12519 power supply: yes updated: Fri 04 Oct 2019 01:58:57 PM PDT (23 seconds ago) has history: yes has statistics: yes ups present: yes state: charging warning-level: none time to empty: 11.7 minutes percentage: 98% icon-name: 'battery-full-charging-symbolic' |
Send message Joined: 5 Oct 06 Posts: 5129 |
I think it would be better to continue this discussion in the 'BOINC client' version of this thread. |
Copyright © 2024 University of California.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License,
Version 1.2 or any later version published by the Free Software Foundation.