Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate battery data from uevent file #1

Closed
svartalf opened this Issue Feb 18, 2019 · 1 comment

Comments

Projects
None yet
1 participant
@svartalf
Copy link
Owner

svartalf commented Feb 18, 2019

Power supply folder might contain an uevent file, which can be used to load battery data with a fewer syscalls amount.

  1. 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)
  2. Consider that any expected value might be missing in this file
  3. Find format specification if any exists (Let's help Dora dig the linux sources)
@svartalf

This comment has been minimized.

Copy link
Owner Author

svartalf commented Feb 27, 2019

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.

@svartalf svartalf added the invalid label Feb 27, 2019

@svartalf svartalf closed this Feb 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.