http://bugs.winehq.org/show_bug.cgi?id=58401
Bug ID: 58401 Summary: system.fill_battery_state: support battery drivers that expose energy_* instead of charge_* attributes of power_supply_class Product: Wine Version: 10.10 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: ntdll Assignee: wine-bugs@winehq.org Reporter: rtdiasmendes@gmail.com Distribution: ---
File: system.c Method: fill_battery_state( SYSTEM_BATTERY_STATE *bs )
Current implementation: - Assumes battery driver exposes: "charge_now", "charge_full", "voltage_now" and "current_now". - Populates SYSTEM_BATTERY_STATE with those attributes after converting to expected units
Issue: - Some battery drivers expose different ABI-compliant attributes - In systems with those drivers, Wine is incapable of emulating windows behaviour
Enhacement proposal: - Add support for drivers that expose different attributes
Further reading: - https://docs.kernel.org/power/power_supply_class.html - https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-power - https://github.com/torvalds/linux/blob/master/include/linux/power_supply.h - https://github.com/torvalds/linux/blob/master/drivers/power/supply/power_sup...
Note: Attribute "scope", while implemented in the kernel, is undocumented in the power_supply_class docs. Will later check if the rest of the documentation is up to date and raise the appropriate issue upstream. Until then, do not assume it correctly reflects the kernel implementation.
Out-of-scope commentary: While Wine's behavior of querying /sys/class/power_supply/ on every NtPowerInformation() call correctly emulates the Windows API semantics, it has unintended performance implications on Linux. This is due to the fact that retrieving battery information from sysfs involves real filesystem I/O, including frequent failed lookups on systems that expose energy_* instead of charge_* attributes.
Therefore, applications may call NtPowerInformation() without prioritizing caching or proper fallback logic as they expect the operation to have a lower-cost then it does on Linux - causing significant and unnecessary performance degradation.
This may merit its own enhacement proposal if it results in noticeable performance degradation.
http://bugs.winehq.org/show_bug.cgi?id=58401
Tomás Mendes rtdiasmendes@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Depends on| |58397 CC| |rtdiasmendes@gmail.com
http://bugs.winehq.org/show_bug.cgi?id=58401
Tomás Mendes rtdiasmendes@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Depends on|58397 |
http://bugs.winehq.org/show_bug.cgi?id=58401
Tomás Mendes rtdiasmendes@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Blocks| |58397
http://bugs.winehq.org/show_bug.cgi?id=58401
Tomás Mendes rtdiasmendes@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|system.fill_battery_state: |ntdll: Improve battery |support battery drivers |driver support by adding |that expose energy_* |energy_*, power_* |instead of charge_* |attributes to battery |attributes of |polling logic |power_supply_class |