Skip to main content

uevent_drain_battery

Function uevent_drain_battery 

Source
pub fn uevent_drain_battery(fd: &Fd) -> Option<(Option<u8>, String)>
Expand description

Drain all pending uevent messages; return the last power_supply event seen.

Returns (capacity, status) where capacity is None if POWER_SUPPLY_CAPACITY was absent from the uevent (caller should fall back to sysfs). Returns None if the queue contained no power_supply events at all. Must be called in a loop after EPOLLET fires to drain the edge-triggered fd.