module Monitor:sig
..end
type
t
Monitor.t
monitor listens for changes to the device list. A monitor is
created by connecting to the kernel daemon through netlink (see
Monitor.create
).type
filter =
Monitor.set_filter
, specifying a list of filter
values.
| |
Tag of |
Tag tag matches devices which have the tag tag attached. |
|
| |
Subsystem_devtype of |
Subsystem_devtype (subsystem, devtype) matches devices of subsystem ,
with optionally device type devtype . |
type
netlink_source =
Monitor.create
.
| |
Udev |
| |
Kernel |
val create : ?source:netlink_source -> Udev.Context.t -> t
By default, source
is Udev
: the monitor listens to the events emitted
after udev has registered and configured the device. This is the absolutely
recommended source for applications.
A source
of Kernel
means that the monitor receives the events directly
after the kernel has seen the device. The device has not yet been configured
by udev and might not be usable at all. Do not use this, unless you know
what you are doing.
val set_filter : t -> filter list -> unit
val start : t -> unit
m
will not receive events until
Monitor.start m
is called. This function does nothing if called on an
already started monitor.exception Timeout
Monitor.receive_device
.val receive_device : ?timeout:float -> t -> Udev.Device.t
Monitor.receive_device ~timeout m
will block
until a device event is received, or after timeout
seconds, in which case
the Timeout
exception is raised.
If no timeout
value is specified, the function blocks until a device
event is available. A timeout
of 0.
means that the function just polls
and will never block.
val context : t -> Udev.Context.t
val set_receive_buffer_size : t -> int -> unit
val fd : t -> Unix.file_descr