mirror of
https://github.com/libretro/RetroArch.git
synced 2026-11-22 10:50:15 -10:00
Without UPower, the Game Mode helper re-read /sys/class/power_supply every 5 seconds to notice a charger being plugged in or pulled. It now listens on the kernel's uevent broadcast (NETLINK_KOBJECT_UEVENT, group 1, the one udev itself reads; unprivileged processes may receive it) and re-reads sysfs only when a SUBSYSTEM=power_supply event arrives, or when the socket reports dropped events (ENOBUFS). The helper now never wakes unless something actually changed. UPower is also asked only once per Game Mode session: when it is absent, later checks go straight to sysfs instead of making a D-Bus call that is bound to fail. The 5 s re-check remains only where the uevent socket cannot be opened at all (some containers). samples/frontend/gamemode gains a "nowake" lane: run under strace without UPower, it checks that a uevent socket is opened and bound and that no poll() ever uses the 5 s timeout. Skipped without strace.