Eeze.h File Reference

Easy device manipulation. More...

Typedefs

typedef struct Eeze_Udev_Watch Eeze_Udev_Watch
 Opaque structure to hold data for a udev watch.
typedef void(* Eeze_Udev_Watch_Cb )(const char *, Eeze_Udev_Event, void *, Eeze_Udev_Watch *)
 Callback type for use with Eeze_Udev_Watch.

Enumerations

enum  Eeze_Udev_Event {
  EEZE_UDEV_EVENT_NONE = 0xf0,
  EEZE_UDEV_EVENT_ADD = (1 << 1),
  EEZE_UDEV_EVENT_REMOVE = (1 << 2),
  EEZE_UDEV_EVENT_CHANGE = (1 << 3),
  EEZE_UDEV_EVENT_ONLINE = (1 << 4),
  EEZE_UDEV_EVENT_OFFLINE = (1 << 5)
}
 Flags for watch events. More...
enum  Eeze_Udev_Type {
  EEZE_UDEV_TYPE_NONE,
  EEZE_UDEV_TYPE_KEYBOARD,
  EEZE_UDEV_TYPE_MOUSE,
  EEZE_UDEV_TYPE_TOUCHPAD,
  EEZE_UDEV_TYPE_DRIVE_MOUNTABLE,
  EEZE_UDEV_TYPE_DRIVE_INTERNAL,
  EEZE_UDEV_TYPE_DRIVE_REMOVABLE,
  EEZE_UDEV_TYPE_DRIVE_CDROM,
  EEZE_UDEV_TYPE_POWER_AC,
  EEZE_UDEV_TYPE_POWER_BAT,
  EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR,
  EEZE_UDEV_TYPE_NET,
  EEZE_UDEV_TYPE_V4L,
  EEZE_UDEV_TYPE_BLUETOOTH,
  EEZE_UDEV_TYPE_JOYSTICK
}
 Convenience types to simplify udev access. More...

Functions

EAPI int eeze_init (void)
 Initialize the eeze library.
EAPI int eeze_shutdown (void)
 Shut down the eeze library.
EAPI Eina_List * eeze_udev_find_similar_from_syspath (const char *syspath)
 Returns a stringshared list of all syspaths that are (or should be) the same device as the device pointed at by syspath.
EAPI Eina_List * eeze_udev_find_unlisted_similar (Eina_List *list)
 Updates a list of all syspaths that are (or should be) the same device.
EAPI Eina_List * eeze_udev_find_by_sysattr (const char *sysattr, const char *value)
 Find a list of devices by a sysattr (and, optionally, a value of that sysattr).
EAPI Eina_List * eeze_udev_find_by_type (Eeze_Udev_Type type, const char *name)
 Find devices using an Eeze_Udev_Type and/or a name.
EAPI Eina_List * eeze_udev_find_by_filter (const char *subsystem, const char *type, const char *name)
 A more advanced find, allows finds using udev properties.
EAPI const char * eeze_udev_devpath_get_syspath (const char *devpath)
 Get the syspath of a device from the /dev/ path.
EAPI const char * eeze_udev_syspath_get_parent (const char *syspath)
 Find the root device of a device from its syspath.
EAPI Eina_List * eeze_udev_syspath_get_parents (const char *syspath)
 Returns a list of all parent device syspaths for syspath.
EAPI const char * eeze_udev_syspath_get_devpath (const char *syspath)
 Get the /dev/ path from the /sys/ path.
EAPI const char * eeze_udev_syspath_get_devname (const char *syspath)
 Get the /dev/ name from the /sys/ path.
EAPI const char * eeze_udev_syspath_get_subsystem (const char *syspath)
 Get the subsystem of a device from the /sys/ path.
EAPI const char * eeze_udev_syspath_get_property (const char *syspath, const char *property)
 Get the property value of a device from the /sys/ path.
EAPI const char * eeze_udev_syspath_get_sysattr (const char *syspath, const char *sysattr)
 Get the sysattr value of a device from the /sys/ path.
EAPI Eina_Bool eeze_udev_syspath_is_mouse (const char *syspath)
 Checks whether the device is a mouse.
EAPI Eina_Bool eeze_udev_syspath_is_kbd (const char *syspath)
 Checks whether the device is a keyboard.
EAPI Eina_Bool eeze_udev_syspath_is_touchpad (const char *syspath)
 Checks whether the device is a touchpad.
EAPI Eina_Bool eeze_udev_syspath_is_joystick (const char *syspath)
 Checks whether the device is a joystick.
EAPI Eina_Bool eeze_udev_walk_check_sysattr (const char *syspath, const char *sysattr, const char *value)
 Walks up the device chain starting at syspath, checking each device for sysattr with (optional) value.
EAPI const char * eeze_udev_walk_get_sysattr (const char *syspath, const char *sysattr)
 Walks up the device chain starting at syspath, checking each device for sysattr, and returns the value if found.
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.
EAPI void * eeze_udev_watch_del (Eeze_Udev_Watch *watch)
 Deletes a watch.

Detailed Description

Easy device manipulation.

Eeze is a library for manipulating devices through udev with a simple and fast api. It interfaces directly with libudev, avoiding such middleman daemons as udisks/upower or hal, to immediately gather device information the instant it becomes known to the system. This can be used to determine such things as:

  • If a cdrom has a disk inserted
  • The temperature of a cpu core
  • The remaining power left in a battery
  • The current power consumption of various parts
  • Monitor in realtime the status of peripheral devices Each of the above examples can be performed by using only a single eeze function, as one of the primary focuses of the library is to reduce the complexity of managing devices.

For udev functions, see udev.


Enumeration Type Documentation

Flags for watch events.

These events are used to specify the events to watch in a Eeze_Udev_Watch. They can be ORed together.

Enumerator:
EEZE_UDEV_EVENT_NONE 
  • No event specified
EEZE_UDEV_EVENT_ADD 
  • Device added
EEZE_UDEV_EVENT_REMOVE 
  • Device removed
EEZE_UDEV_EVENT_CHANGE 
  • Device changed
EEZE_UDEV_EVENT_ONLINE 
  • Device has come online
EEZE_UDEV_EVENT_OFFLINE 
  • Device has gone offline

Convenience types to simplify udev access.

These types allow easy access to certain udev device types. They may only be used in specified functions.

Enumerator:
EEZE_UDEV_TYPE_NONE 
  • No type
EEZE_UDEV_TYPE_KEYBOARD 
  • Keyboard device
EEZE_UDEV_TYPE_MOUSE 
  • Mouse device
EEZE_UDEV_TYPE_TOUCHPAD 
  • Touchpad device
EEZE_UDEV_TYPE_DRIVE_MOUNTABLE 
  • Mountable drive
EEZE_UDEV_TYPE_DRIVE_INTERNAL 
  • Internal drive
EEZE_UDEV_TYPE_DRIVE_REMOVABLE 
  • Removable drive
EEZE_UDEV_TYPE_DRIVE_CDROM 
  • cd drive
EEZE_UDEV_TYPE_POWER_AC 
  • AC adapter
EEZE_UDEV_TYPE_POWER_BAT 
  • Battery
EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR 
  • Temperature sensor
EEZE_UDEV_TYPE_NET 
  • Network devices
EEZE_UDEV_TYPE_V4L 
  • WebCam
EEZE_UDEV_TYPE_BLUETOOTH 
  • Bluetooth
EEZE_UDEV_TYPE_JOYSTICK 
  • Joystick
    Since:
    1.7