NAME
udev_device_ref,
udev_device_unref,
udev_device_get_dictionary,
udev_device_get_udev,
udev_device_get_action,
udev_device_get_devnum,
udev_device_get_devnode,
udev_device_get_driver,
udev_device_get_subsystem,
udev_device_get_kptr,
udev_device_get_major,
udev_device_get_minor,
udev_device_get_property_value —
udev device functions
LIBRARY
library “libdevattr”
SYNOPSIS
#include
<devattr.h>
struct udev_device *
udev_device_ref(struct
udev_device *udev_device);
void
udev_device_unref(struct
udev_device *udev_device);
struct udev *
udev_device_get_udev(struct
udev_device *udev_device);
prop_dictionary_t
udev_device_get_dictionary(struct
udev_device *udev_device);
const char *
udev_device_get_action(struct
udev_device *udev_device);
dev_t
udev_device_get_devnum(struct
udev_device *udev_device);
const char *
udev_device_get_devnode(struct
udev_device *udev_device);
const char *
udev_device_get_driver(struct
udev_device *udev_device);
const char *
udev_device_get_subsystem(struct
udev_device *udev_device);
uint64_t
udev_device_get_kptr(struct
udev_device *udev_device);
int32_t
udev_device_get_major(struct
udev_device *udev_device);
int32_t
udev_device_get_minor(struct
udev_device *udev_device);
const char *
udev_device_get_property_value(struct
udev_device *udev_device,
const char *key);
DESCRIPTION
Theudev_device_ref()
and
udev_device_unref()
functions increase or decrease the reference count on a
udev_device object respectively. When the reference
count drops to 0, the object is automatically destroyed. The
udev_device_ref() function returns the same object
that was passed in.
The
udev_device_get_udev()
function returns the udev context in which the
udev_device was created.
The
udev_device_get_dictionary()
function returns the raw
prop_dictionary(3) dictionary associated to the given
udev_device. It returns NULL
when no dictionary is associated to the device.
The
udev_device_get_action()
function returns the action, as a string, related to the
udev_device. Possible actions are "add" for
attach events, "remove" for detach events and "none" if
the udev_device is not associated with a particular event.
The
udev_device_get_devnum(),
udev_device_get_devnode(),
udev_device_get_driver(),
udev_device_get_subsystem(),
udev_device_get_kptr(),
udev_device_get_major()
and
udev_device_get_minor()
function return some information of the device corresponding to the
udev_device. The
udev_device_get_devnum(), function returns the
device number. The udev_device_get_devnode()
function returns the full path in the system to the given device. The
returned string and errno are the same as for the
devname(3) function. The
udev_device_get_driver() and
udev_device_get_subsystem() functions return the
driver name and subsystem of the device if available. Otherwise they return
NULL. The
udev_device_get_kptr(),
udev_device_get_major() and
udev_device_get_minor() functions return the kernel
pointer to the associated cdev_t, the major and the minor number,
respectively.
The
udev_device_get_property_value()
function returns the value for the udev_device for the
specified property key. It returns
NULL if the specified
udev_device has no property for
key.
SEE ALSO
devattr(3), udev(3), udev_enumerate(3), udev_monitor(3), udevd(8)