| Summary: | Wider support for seconds of battery life left on Linux platforms using sys interface | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Murad <muradkarammaev> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | enhancement | ||
| Priority: | P2 | ||
| Version: | 2.0.10 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Attachments: | wider support for battery lifetime data on Linux platforms using sys interface | ||
This is my first contribution to any oss project ever, so, please, point me kindly at any mistake I have made. Thanks! Patch added, thanks! https://hg.libsdl.org/SDL/rev/8a12cc1abc9e |
Created attachment 4140 [details] wider support for battery lifetime data on Linux platforms using sys interface On my system, SDL_GetPowerInfo() returns -1 seconds of battery life left. I have quickly investigated that in my case SDL uses sys interface to get battery data. It tries to read "time_to_empty_now" file which is not always present. However, it is still possible to calculate remaining lifetime using "energy_now" and "power_now" files. This is what my simple patch (included as attachment) tries to accomplish. Best wishes.