In a PC, the hw.acpi.battery MIB does not exist.
Also, the hw.acpi.acline is only present if supported by the hardware. In addition, some variables were used uninitialized and that causes strange behavior: in a PC it showed it worked on battery and the % of charge was an ridiculous big number.
This patch addresses the issue. It fixes the problem in the PC. It has also being tested in a laptop running FreeBSD current plugin and unplugging the AC line and also snatching the battery mercilessly to see if something breaks.
Checklist
[x] I have described the changes
[x] I have linked to any relevant GitHub issues, if applicable
[x ] Documentation in doc/ has been updated
[x] All new code is licensed under GPLv3
Description
Describe the changes, why they were necessary, etc
Describe how the changes will affect existing behaviour.
Describe how you tested and validated your changes.
Include any relevant screenshots/evidence demonstrating that the changes work and have been tested.
The logic for the detection of the battery/AC line was not completely correct for FreeBSD. Launching conky on console shows the following:
Cannot read sysctl "hw.acpi.battery.time" Cannot read sysctl "hw.acpi.battery.life" Cannot read sysctl "hw.acpi.battery.state" Cannot read sysctl "hw.acpi.acline" Unknown battery state 8!
In a PC, the hw.acpi.battery MIB does not exist. Also, the hw.acpi.acline is only present if supported by the hardware. In addition, some variables were used uninitialized and that causes strange behavior: in a PC it showed it worked on battery and the % of charge was an ridiculous big number.
This patch addresses the issue. It fixes the problem in the PC. It has also being tested in a laptop running FreeBSD current plugin and unplugging the AC line and also snatching the battery mercilessly to see if something breaks.
Checklist
doc/
has been updatedDescription