- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files
- Examples

Functions
Watch
Eeze » main » udev

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

## Functions
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. 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

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

  type | The Eeze_Udev_Type to watch
  event | The events to watch; an OR list of Eeze_Udev_Event (ie (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE)), or 0 for all events
  cb | The function to call when the watch receives data of type Eeze_Udev_Watch_Cb
  user_data | Data 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_FD_READ, ecore_main_fd_handler_add(), EEZE_UDEV_TYPE_BLUETOOTH, EEZE_UDEV_TYPE_DRIVE_CDROM, EEZE_UDEV_TYPE_DRIVE_INTERNAL, EEZE_UDEV_TYPE_DRIVE_MOUNTABLE, EEZE_UDEV_TYPE_DRIVE_REMOVABLE, EEZE_UDEV_TYPE_DRM, EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR, EEZE_UDEV_TYPE_JOYSTICK, EEZE_UDEV_TYPE_KEYBOARD, EEZE_UDEV_TYPE_MOUSE, EEZE_UDEV_TYPE_NET, EEZE_UDEV_TYPE_POWER_AC, EEZE_UDEV_TYPE_POWER_BAT, EEZE_UDEV_TYPE_TOUCHPAD, EEZE_UDEV_TYPE_V4L, and ERR.

Referenced by ecore_drm_outputs_create().

EAPI void* eeze_udev_watch_del | ( | Eeze_Udev_Watch * | watch | ) |

Deletes a watch.

Parameters

  watch | An 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_main_fd_handler_del().