Populate battery data from uevent file
svartalf opened this issue · 1 comments
svartalf commented
Power supply folder might contain an uevent
file, which can be used to load battery data with a fewer syscalls amount.
uevent
file by itself should be considered as optional, implementation should not check if it is exists on each refresh (confirm than kernel will not create it suddenly at some random point of time)- Consider that any expected value might be missing in this file
- Find format specification if any exists (Let's help Dora dig the linux sources)
svartalf commented
After a short investigation I'm thinking that this is a bad idea: uevent
file is updated rarely, only when udev
thinks that it is time. As a quick experiment, I've tried the udevadm monitor --subsystem-match=power_supply
shell command and did not received any event related to battery in twenty minutes.
udev
allows to "refresh" uevent
contents with change
event, but this event will be propagated to all possible event listeners; considering that library users will want to refresh battery data roughly each couple of seconds this will spam the listeners.