Functions
Watch
Eeze » main » udev

These are functions which monitor udev for events. More...

Functions

EAPI Eeze_Udev_Watcheeze_udev_watch_add (Eeze_Udev_Type type, int event, Eeze_Udev_Watch_Cb cb, void *user_data)
 Add a watch for a device type. More...
 
EAPI void * eeze_udev_watch_del (Eeze_Udev_Watch *watch)
 Deletes a watch. More...
 

Detailed Description

These are functions which monitor udev for events.

Eeze watches are simple: you specify a type of device to watch (or all devices), some events (or all) to watch for, a callback, and some data, and then udev watches those device types for events of the type you specified. Your callback is called with a syspath of the triggering device and the event that happened to the device, along with the data you associated with the watch and the watch object itself in case you want to stop the watch easily in a callback.

Function Documentation

◆ eeze_udev_watch_add()

EAPI Eeze_Udev_Watch * eeze_udev_watch_add ( Eeze_Udev_Type  type,
int  event,
Eeze_Udev_Watch_Cb  cb,
void *  user_data 
)

Add a watch for a device type.

Parameters
typeThe Eeze_Udev_Type to watch
eventThe events to watch; an OR list of Eeze_Udev_Event (ie (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE)), or 0 for all events
cbThe function to call when the watch receives data of type Eeze_Udev_Watch_Cb
user_dataData to pass to the callback function
Returns
A watch struct for the watch type specified, or NULL on failure

Eeze watches will monitor udev for changes of type(s) event to devices of type type. When these changes occur, the stringshared syspath of the device will be sent to function func, along with the bitmask of the event type which can be detected through binary &.

References ecore_fork_reset_callback_add(), eina_inlist_append(), EINA_INLIST_GET, EINA_SAFETY_ON_NULL_RETURN_VAL, and _Eina_Value::type.

Referenced by ecore_drm2_outputs_create(), and ecore_drm_device_open().

◆ eeze_udev_watch_del()

EAPI void * eeze_udev_watch_del ( Eeze_Udev_Watch watch)

Deletes a watch.

Parameters
watchAn Eeze_Udev_Watch object
Returns
The data originally associated with the watch, or NULL

Deletes a watch, closing file descriptors and freeing related udev memory.

References ecore_fork_reset_callback_del(), ecore_main_fd_handler_del(), EINA_INLIST_GET, and eina_inlist_remove().

Referenced by ecore_drm_device_close().