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

Make battery module update on plugging/unplugging again (refs #2519) #3474

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

schmop
Copy link

@schmop schmop commented Jul 24, 2024

When switching how you listen for battery plugging status events, the battery status will instantly update again!
Instead of inotify events on the /sys/class/.../ files, it is recommended to listen to udev netlink kernel events.

Closes #2444
Closes #2519

I need aid implementing this, because I'm new to this project.
I will try to make this code look more like the backlight_backend, which also uses the udev netlink interfaces.

@schmop schmop changed the title PoC: Use udev polling of netlink kernel events for battery plugging events (refs #2519) PoC: Make battery module update on plugging/unplugging again (refs #2519) Jul 24, 2024
Historically we listened to /sys/class/poewr_supply inotify events,
which does not seem to work anymore.
We switched now to udev netlink kernel events.
@schmop schmop force-pushed the battery-plugging-instant-updates branch from a519c0c to f4608b3 Compare July 26, 2024 23:19
@schmop schmop changed the title PoC: Make battery module update on plugging/unplugging again (refs #2519) Make battery module update on plugging/unplugging again (refs #2519) Jul 26, 2024
@schmop
Copy link
Author

schmop commented Jul 26, 2024

So it seems, that the udev kernel events are sent very early. The battery status "Charging" might return just a bit later from the /sys/class/powersupply/BAT0/status path, than the last event is received.
For my setup, this will result in a "Plugged in" (but not charging) state :(

When implementing some sleep(1) this race condition does not occur anymore, but this cannot be a solution.

@Alexays Alexays force-pushed the master branch 2 times, most recently from d623a89 to a4d31ab Compare September 13, 2024 07:40
@schmop
Copy link
Author

schmop commented Nov 27, 2024

Might also
Closes #3726
Closes #3603
Closes #3471

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant