| Eeze.h | | Eeze.h | |
| /** | | /** | |
| @brief Eeze Device Library | | @brief Eeze Device Library | |
| * | | * | |
| @mainpage Eeze | | @mainpage Eeze | |
| @image html eeze.png | | @image html eeze.png | |
|
| @version 1.1.0 | | @version 1.7.0 | |
| @author Mike Blumenkrantz (zmike/discomfitor) <mike@@zentific.com> | | @author Mike Blumenkrantz (zmike/discomfitor) <michael.blumenkrantz@@gmail | |
| @date 2010-2011 | | .com> | |
| | | @date 2010-2012 | |
| | | | |
| @section intro What is Eeze? | | @section intro What is Eeze? | |
| | | | |
| Eeze is a library for manipulating devices through udev with a simple and
fast | | 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 | | api. It interfaces directly with libudev, avoiding such middleman daemons
as | |
| udisks/upower or hal, to immediately gather device information the instant
it | | 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
: | | becomes known to the system. This can be used to determine such things as
: | |
| @li If a cdrom has a disk inserted | | @li If a cdrom has a disk inserted | |
| @li The temperature of a cpu core | | @li The temperature of a cpu core | |
| @li The remaining power left in a battery | | @li The remaining power left in a battery | |
| | | | |
| skipping to change at line 31 | | skipping to change at line 31 | |
| | | | |
| Each of the above examples can be performed by using only a single eeze | | 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 | | function, as one of the primary focuses of the library is to reduce the | |
| complexity of managing devices. | | complexity of managing devices. | |
| | | | |
| @li @link Eeze.h Eeze functions @endlink | | @li @link Eeze.h Eeze functions @endlink | |
| @li @ref udev UDEV functions | | @li @ref udev UDEV functions | |
| @li @ref watch Functions that watch for events | | @li @ref watch Functions that watch for events | |
| @li @ref syspath Functions that accept a device /sys/ path | | @li @ref syspath Functions that accept a device /sys/ path | |
| @li @ref find Functions which find types of devices | | @li @ref find Functions which find types of devices | |
|
| | | @li @ref disk Disk functions | |
| | | @li @ref net Net functions | |
| @verbatim | | @verbatim | |
| Pants | | Pants | |
| @endverbatim | | @endverbatim | |
| */ | | */ | |
| #ifndef EEZE_UDEV_H | | #ifndef EEZE_UDEV_H | |
| #define EEZE_UDEV_H | | #define EEZE_UDEV_H | |
| | | | |
| #include <Eina.h> | | #include <Eina.h> | |
| | | | |
| #ifdef EAPI | | #ifdef EAPI | |
| | | | |
| skipping to change at line 218 | | skipping to change at line 219 | |
| EEZE_UDEV_TYPE_POWER_AC, | | EEZE_UDEV_TYPE_POWER_AC, | |
| /** - Battery */ | | /** - Battery */ | |
| EEZE_UDEV_TYPE_POWER_BAT, | | EEZE_UDEV_TYPE_POWER_BAT, | |
| /** - Temperature sensor */ | | /** - Temperature sensor */ | |
| EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR, | | EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR, | |
| /** - Network devices */ | | /** - Network devices */ | |
| EEZE_UDEV_TYPE_NET, | | EEZE_UDEV_TYPE_NET, | |
| /** - WebCam */ | | /** - WebCam */ | |
| EEZE_UDEV_TYPE_V4L, | | EEZE_UDEV_TYPE_V4L, | |
| /** - Bluetooth */ | | /** - Bluetooth */ | |
|
| EEZE_UDEV_TYPE_BLUETOOTH | | EEZE_UDEV_TYPE_BLUETOOTH, | |
| | | /** - Joystick | |
| | | * @since 1.7 | |
| | | */ | |
| | | EEZE_UDEV_TYPE_JOYSTICK | |
| } Eeze_Udev_Type; | | } Eeze_Udev_Type; | |
| /**@}*/ | | /**@}*/ | |
| | | | |
| struct Eeze_Udev_Watch; | | struct Eeze_Udev_Watch; | |
|
| | | | |
| | | /** | |
| | | * @addtogroup watch | |
| | | * @typedef Eeze_Udev_Watch Eeze_Udev_Watch | |
| | | * @brief Opaque structure to hold data for a udev watch | |
| | | */ | |
| typedef struct Eeze_Udev_Watch Eeze_Udev_Watch; | | typedef struct Eeze_Udev_Watch Eeze_Udev_Watch; | |
| | | | |
| #define EEZE_VERSION_MAJOR 1 | | #define EEZE_VERSION_MAJOR 1 | |
|
| #define EEZE_VERSION_MINOR 2 | | #define EEZE_VERSION_MINOR 7 | |
| | | | |
| typedef struct _Eeze_Version | | typedef struct _Eeze_Version | |
| { | | { | |
| int major; | | int major; | |
| int minor; | | int minor; | |
| int micro; | | int micro; | |
| int revision; | | int revision; | |
| } Eeze_Version; | | } Eeze_Version; | |
| | | | |
| EAPI extern Eeze_Version *eeze_version; | | EAPI extern Eeze_Version *eeze_version; | |
| | | | |
| /** | | /** | |
| * @addtogroup watch | | * @addtogroup watch | |
|
| | | * @typedef Eeze_Udev_Watch_Cb Eeze_Udev_Watch_Cb | |
| * @brief Callback type for use with #Eeze_Udev_Watch | | * @brief Callback type for use with #Eeze_Udev_Watch | |
| */ | | */ | |
| typedef void(*Eeze_Udev_Watch_Cb)(const char *, Eeze_Udev_Event, void *, Ee
ze_Udev_Watch *); | | typedef void(*Eeze_Udev_Watch_Cb)(const char *, Eeze_Udev_Event, void *, Ee
ze_Udev_Watch *); | |
| | | | |
| /** | | /** | |
| * Initialize the eeze library. | | * Initialize the eeze library. | |
| * @return The number of times the function has been called, or -1 on failu
re. | | * @return The number of times the function has been called, or -1 on failu
re. | |
| * | | * | |
| * This function should be called prior to using any eeze functions, and MU
ST | | * This function should be called prior to using any eeze functions, and MU
ST | |
| * be called prior to using any udev functions to avoid a segv. | | * be called prior to using any udev functions to avoid a segv. | |
| | | | |
| skipping to change at line 450 | | skipping to change at line 462 | |
| */ | | */ | |
| EAPI Eina_Bool eeze_udev_syspath_is_kbd(const char *syspath); | | EAPI Eina_Bool eeze_udev_syspath_is_kbd(const char *syspath); | |
| | | | |
| /** | | /** | |
| * Checks whether the device is a touchpad. | | * Checks whether the device is a touchpad. | |
| * | | * | |
| * @param syspath The /sys/ path with or without the /sys/ | | * @param syspath The /sys/ path with or without the /sys/ | |
| * @return If true, the device is a touchpad | | * @return If true, the device is a touchpad | |
| */ | | */ | |
| EAPI Eina_Bool eeze_udev_syspath_is_touchpad(const char *syspath); | | EAPI Eina_Bool eeze_udev_syspath_is_touchpad(const char *syspath); | |
|
| | | | |
| | | /** | |
| | | * Checks whether the device is a joystick. | |
| | | * | |
| | | * @param syspath The /sys/ path with or without the /sys/ | |
| | | * @return If true, the device is a joystick | |
| | | * @since 1.7 | |
| | | */ | |
| | | EAPI Eina_Bool eeze_udev_syspath_is_joystick(const char *syspath); | |
| /** | | /** | |
| * @} | | * @} | |
| */ | | */ | |
| | | | |
| /** | | /** | |
| * @addtogroup walks Walks | | * @addtogroup walks Walks | |
| * | | * | |
| * These are functions which walk up the device chain. | | * These are functions which walk up the device chain. | |
| * | | * | |
| * @ingroup udev | | * @ingroup udev | |
| | | | |
End of changes. 7 change blocks. |
| 6 lines changed or deleted | | 28 lines changed or added | |
|
| Eeze_Disk.h | | Eeze_Disk.h | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| * through simple function calls. | | * through simple function calls. | |
| * | | * | |
| * @addtogroup disk Disk | | * @addtogroup disk Disk | |
| * @{ | | * @{ | |
| */ | | */ | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
|
| | | /** | |
| | | * @enum Eeze_Disk_Type | |
| | | * @since 1.1 | |
| | | * | |
| | | * All disk types known to Eeze. | |
| | | */ | |
| typedef enum | | typedef enum | |
| { | | { | |
| EEZE_DISK_TYPE_UNKNOWN = 0, /**< type could not be determined */ | | EEZE_DISK_TYPE_UNKNOWN = 0, /**< type could not be determined */ | |
| EEZE_DISK_TYPE_INTERNAL = (1 << 0), /**< internal drive */ | | EEZE_DISK_TYPE_INTERNAL = (1 << 0), /**< internal drive */ | |
| EEZE_DISK_TYPE_CDROM = (1 << 1), /**< cdrom drive */ | | EEZE_DISK_TYPE_CDROM = (1 << 1), /**< cdrom drive */ | |
| EEZE_DISK_TYPE_USB = (1 << 2), /**< usb drive */ | | EEZE_DISK_TYPE_USB = (1 << 2), /**< usb drive */ | |
| EEZE_DISK_TYPE_FLASH = (1 << 3) /**< flash disk */ | | EEZE_DISK_TYPE_FLASH = (1 << 3) /**< flash disk */ | |
| } Eeze_Disk_Type; | | } Eeze_Disk_Type; | |
| | | | |
|
| | | /** | |
| | | * @enum Eeze_Mount_Opts | |
| | | * @since 1.1 | |
| | | * | |
| | | * All mount options known to Eeze. | |
| | | */ | |
| typedef enum | | typedef enum | |
| { | | { | |
| #define EEZE_DISK_MOUNTOPT_DEFAULTS (EEZE_DISK_MOUNTOPT_UTF8 | EEZE_DISK_MO
UNTOPT_NOEXEC | EEZE_DISK_MOUNTOPT_NOSUID) | | #define EEZE_DISK_MOUNTOPT_DEFAULTS (EEZE_DISK_MOUNTOPT_UTF8 | EEZE_DISK_MO
UNTOPT_NOEXEC | EEZE_DISK_MOUNTOPT_NOSUID) | |
| EEZE_DISK_MOUNTOPT_LOOP = (1 << 1), | | EEZE_DISK_MOUNTOPT_LOOP = (1 << 1), | |
| EEZE_DISK_MOUNTOPT_UTF8 = (1 << 2), | | EEZE_DISK_MOUNTOPT_UTF8 = (1 << 2), | |
| EEZE_DISK_MOUNTOPT_NOEXEC = (1 << 3), | | EEZE_DISK_MOUNTOPT_NOEXEC = (1 << 3), | |
| EEZE_DISK_MOUNTOPT_NOSUID = (1 << 4), | | EEZE_DISK_MOUNTOPT_NOSUID = (1 << 4), | |
| EEZE_DISK_MOUNTOPT_REMOUNT = (1 << 5), | | EEZE_DISK_MOUNTOPT_REMOUNT = (1 << 5), | |
|
| EEZE_DISK_MOUNTOPT_UID = (1 << 6) /**< use current user's uid */ | | EEZE_DISK_MOUNTOPT_UID = (1 << 6), /**< use current user's uid */ | |
| | | EEZE_DISK_MOUNTOPT_NODEV = (1 << 7) /**< @since 1.7 */ | |
| } Eeze_Mount_Opts; | | } Eeze_Mount_Opts; | |
| | | | |
| EAPI extern int EEZE_EVENT_DISK_MOUNT; | | EAPI extern int EEZE_EVENT_DISK_MOUNT; | |
| EAPI extern int EEZE_EVENT_DISK_UNMOUNT; | | EAPI extern int EEZE_EVENT_DISK_UNMOUNT; | |
| EAPI extern int EEZE_EVENT_DISK_EJECT; | | EAPI extern int EEZE_EVENT_DISK_EJECT; | |
| EAPI extern int EEZE_EVENT_DISK_ERROR; | | EAPI extern int EEZE_EVENT_DISK_ERROR; | |
| | | | |
| typedef struct _Eeze_Event_Disk Eeze_Event_Disk_Mount; | | typedef struct _Eeze_Event_Disk Eeze_Event_Disk_Mount; | |
| typedef struct _Eeze_Event_Disk Eeze_Event_Disk_Unmount; | | typedef struct _Eeze_Event_Disk Eeze_Event_Disk_Unmount; | |
| typedef struct _Eeze_Event_Disk Eeze_Event_Disk_Eject; | | typedef struct _Eeze_Event_Disk Eeze_Event_Disk_Eject; | |
|
| | | | |
| | | /** | |
| | | * @typedef Eeze_Disk | |
| | | * @since 1.1 | |
| | | * | |
| | | * Handle for an Eeze Disk. | |
| | | */ | |
| typedef struct _Eeze_Disk Eeze_Disk; | | typedef struct _Eeze_Disk Eeze_Disk; | |
| | | | |
| struct _Eeze_Event_Disk | | struct _Eeze_Event_Disk | |
| { | | { | |
| Eeze_Disk *disk; | | Eeze_Disk *disk; | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * @typedef Eeze_Event_Disk_Error | |
| | | * @since 1.1 | |
| | | * | |
| | | * Contains the human readable error message. | |
| | | */ | |
| typedef struct _Eeze_Event_Disk_Error Eeze_Event_Disk_Error; | | typedef struct _Eeze_Event_Disk_Error Eeze_Event_Disk_Error; | |
| | | | |
| struct _Eeze_Event_Disk_Error | | struct _Eeze_Event_Disk_Error | |
| { | | { | |
| Eeze_Disk *disk; | | Eeze_Disk *disk; | |
| const char *message; | | const char *message; | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * @brief Use this function to determine whether your eeze is disk-capable | | * @brief Use this function to determine whether your eeze is disk-capable | |
| | | | |
| skipping to change at line 514 | | skipping to change at line 540 | |
| | | | |
| /** | | /** | |
| * Walks up the device chain using the device from @p disk, | | * Walks up the device chain using the device from @p disk, | |
| * checking each device for @p sysattr with (optional) @p value. | | * checking each device for @p sysattr with (optional) @p value. | |
| * | | * | |
| * @param disk The disk to walk | | * @param disk The disk to walk | |
| * @param sysattr The attribute to find | | * @param sysattr The attribute to find | |
| * @param value OPTIONAL: The value that @p sysattr should have, or @c NULL
. | | * @param value OPTIONAL: The value that @p sysattr should have, or @c NULL
. | |
| * | | * | |
| * @return If the sysattr (with value) is found, returns @c EINA_TRUE, | | * @return If the sysattr (with value) is found, returns @c EINA_TRUE, | |
|
| * @EINA_FALSE otherwise. | | * @c EINA_FALSE otherwise. | |
| * @since 1.1 | | * @since 1.1 | |
| */ | | */ | |
| EAPI Eina_Bool eeze_disk_udev_walk_check_sysattr(Eeze_Disk *disk, cons
t char *sysattr, const char *value); | | EAPI Eina_Bool eeze_disk_udev_walk_check_sysattr(Eeze_Disk *disk, cons
t char *sysattr, const char *value); | |
| | | | |
| /** | | /** | |
| * @brief Walks up the device chain of @p disk | | * @brief Walks up the device chain of @p disk | |
| * checking each device for @p sysattr and returns the value if found. | | * checking each device for @p sysattr and returns the value if found. | |
| * | | * | |
| * @param disk The disk | | * @param disk The disk | |
| * @param sysattr The attribute to find | | * @param sysattr The attribute to find | |
| | | | |
End of changes. 6 change blocks. |
| 2 lines changed or deleted | | 28 lines changed or added | |
|