# Uevent and DRM
Linux kobject-uevent socket primitives and DRM vblank waiting — two device-event
facilities Core exposes as stateless primitives.
## Uevent (`uevent`)
Kernel object (kobject) uevent socket — the netlink-style socket the kernel
uses to announce device/battery/power events.
- `open()` — an `AF_NETLINK` `NETLINK_KOBJECT_UEVENT` socket bound to the
kernel multicast group (`nl_groups = 1`), non-blocking + `CLOEXEC`. On
non-Android it returns `ENOSYS` (`Err(Unsupported)`).
- `recv(fd, buf)` — receive a uevent message into a buffer; non-blocking,
returns `Some(n)` on a message and `None` on `EAGAIN` **or** a zero-length
recv. (There is no public `recv_raw` — the raw receive is private to the
platform `imp` module.)
- `drain_battery(fd)` — drain the **entire** pending queue (edge-trigger
contract) and return the **last** decoded `power_supply` uevent:
`Option<(Option<u8> percent, String what)>`. `POWER_SUPPLY_STATUS` missing
defaults to the literal `"Unknown"`; a non-numeric capacity yields `None` for
the percent.
Callers own the reactor wiring and the decision of what to do with an event;
Core only decodes.
## DRM (`drm`)
Direct Rendering Manager primitives.
- `DrmCard::open(path)` — open a DRM card node by path (e.g. `/dev/dri/card0`).
- `DrmCard::wait_vblank()` — a blocking `DRM_IOCTL_WAIT_VBLANK` wait that
returns the monotonic unblock instant.
Reply timestamps are ignored because `msm` display stacks zero
`t_sec`/`t_usec`; the returned `Instant` is measured locally, which is what
consumers should rely on.