DragonFly On-Line Manual Pages
LIBDEVQ(3) DragonFly Library Functions Manual LIBDEVQ(3)
NAME
libdevq -- Generic Device Query and Monitor interface
LIBRARY
Portable query and monitoring library (libdevq, -ldevq)
SYNOPSIS
#include <sys/types.h>
#include <libdevq.h>
devq_class_t
devq_device_get_class(struct devq_device *device);
const char *
devq_device_get_devpath_from_fd(int fd, char *path, size_t *path_len);
const char *
devq_device_get_path(struct devq_device *device);
int
devq_device_get_pcibusaddr(int *domain, int *bus, int *slot,
int *function);
int
devq_device_get_pciid_from_fd(int fd, int *vendor_id, int *device_id);
int
devq_device_get_pciid_full_from_fd(int fd, int *vendor_id,
int *device_id, int *subvendor_id, int *subdevice_id,
int *revision_id);
const char *
devq_device_get_product(struct devq_device *device);
devq_device_t
devq_device_get_type(struct devq_device *device);
const char *
devq_device_get_vendor(struct devq_device *device);
int
devq_drm_get_drvname_from_fd(int fd, char *driver_name,
size_t *driver_name_len);
const char *
devq_event_dump(struct devq_event *);
void
devq_event_free(struct devq_event *);
struct devq_device *
devq_event_get_deviced(struct devq_event *);
devq_event_t
devq_event_get_type(struct devq_event *);
void
devq_event_monitor_fini(struct devq_evmon *);
int
devq_event_monitor_get_fd(struct devq_evmon *);
struct devq_evmon *
devq_event_monitor_init(void);
int
devq_event_monitor_poll(struct devq_evmon *);
struct devq_event *
devq_event_monitor_read(struct devq_evmon *);
REFERENCE
This section documents the functions, types, and variable available via
<libdevq.h>.
Types
devq_class_t
A list of event class. Values are:
DEVQ_CLASS_UNKNOWN Unknown class
DEVQ_CLASS_INPUT Input device class
devq_device_t
A list of device types. Values are:
DEVQ_DEVICE_UNKNOWN Unknown device type
DEVQ_DEVICE_KEYBOARD Device is a keyboard
DEVQ_DEVICE_MOUSE Device is a mouse
DEVQ_DEVICE_JOYSTICK Device is a joystick
DEVQ_DEVICE_TOUCHPAD Device is a touchpad
DEVQ_DEVICE_TOUCHSCREEN Device is a touchscreen
devq_event_t
A list of event types. Values are:
DEVQ_ATTACHED A device have been attached
DEVQ_DETACHED A device have been detached
DEVQ_NOTICE An information is available
DEVQ_UNKNOWN An unknown event has occured
struct devq_device
An opaque structure representing a device
struct devq_event
An opaque structure representing an event
struct devq_evmon
An opaque structure representing an event monitor
Functions
Device query functions.
devq_device_get_pcibusaddr()
Return the pci bus location: domain, bus, slot and function. Currently
only for DRM devices.
devq_device_get_devpath_from_fd()
Returns the absolute path of the device.
devq_device_get_pciid_full_from_fd()
Return the vendor_id, device_id, subvendor_id, subdevice_id and revi-
sion_id of the supplied fd. Currently only for DRM devices.
devq_device_get_pciid_from_fd()
Return the vendor_id and device_id of the supplied fd. Currently only
for DRM devices.
devq_drm_get_drvname_from_fd()
Returns the driver name.
Device notification API
devq_event_dump()
Returns the raw devq_event content.
devq_event_free()
Frees the devq_event struct.
devq_event_monitor_init()
function setups the monitoring code.
devq_event_monitor_fini()
function cleanup the event monitering code.
devq_event_monitor_get_fd()
Return the fd of the devq_evmon.
devq_event_monitor_poll()
Returns 1 if there are events waiting, otherwise 0.
devq_event_monitor_read()
Returns a devq_event struct otherwise NULL.
devq_event_get_type()
Returns what kind of event this is.
devq_event_get_deviced()
Returns information about the device on ATTACH or DETACH events. Other-
wise NULL.
devq_device_get_type()
Returns the type of the device the event is about.
devq_device_get_class()
Return the device class for a given device.
devq_device_get_path()
Return the absolute path of the device.
devq_device_get_product()
Return the product of the device the event is about.
devq_device_get_vendor()
Return the vendor of the device the event is about.
EXAMPLES
fill me...
Return values
Upon successful completion, the value 0 is returned; otherwise the
value -1 is returned and the global variable errno is set to indicate the
error.
ERRORS
The functions in libdevq() may fail with the following errors:
[EBADF] Bad File Descriptor
[ENOMEM] Cannot allocate memory
[ENOENT] No such file or directory
[EINVAL] Invalid argument
SEE ALSO
devinfo(3), devctl(4), devclass(9)
AUTHORS
The libdevq library was written by:
Baptiste Daroussin <bapt@FreeBSD.org>,
Jean-Sebastien Pedron <dumbbell@FreeBSD.org>,
Koop Mast <kwm@FreeBSD.org>
DragonFly 5.5 January 08, 2015 DragonFly 5.5