View Source NervesUEvent (nerves_uevent v0.1.0)
NervesUEvent listens for events from the Linux kernel, automatically loads device drivers, and forwards them to your Elixir programs.
NervesUEvent is a very simple version of the Linux udevd
. Just like udevd
does for desktop Linux, NervesUEvent registers to receive UEvents from the Linux
kernel. Unlike udevd
, NervesUEvent only runs modprobe
when needed and keeps
track of what hardware is in the system. For most Nerves use cases, udevd
isn't needed.
Link to this section Summary
Functions
Get the most recent value of UEvent report
Get all reported UEvents
Run an arbitrary match against UEvents
Subscribe to uevent notifications
Link to this section Functions
@spec get(PropertyTable.property(), PropertyTable.value()) :: PropertyTable.value()
Get the most recent value of UEvent report
For example,
> NervesUEvent.get(["devices", "platform", "leds", "leds", "red:indicator-1"])
%{
"of_compatible_n" => "0",
"of_fullname" => "/leds/rgb1-blue",
"of_name" => "rgb1-blue",
"subsystem" => "leds"
}}
@spec get_all() :: [{PropertyTable.property(), PropertyTable.value()}]
Get all reported UEvents
@spec match(PropertyTable.pattern()) :: [ {PropertyTable.property(), PropertyTable.value()} ]
Run an arbitrary match against UEvents
Use :_
in the path to accept any value in that position
Use :"$"
at the end of the path to perform an exact match
@spec subscribe(PropertyTable.pattern()) :: :ok
Subscribe to uevent notifications
Pass a pattern like one you'd pass to match/1
. Instead of getting a
response, you'll receive a message when a matching UEvent happens.