some long overdue updates:
switch some variables to enum for debugging readability doxy updates some small leak fixes SVN revision: 50690
This commit is contained in:
parent
5d52fce3f6
commit
81644c5029
|
@ -24,112 +24,116 @@
|
|||
* @file Eeze.h
|
||||
* @brief Easy device manipulation.
|
||||
*
|
||||
* This header provides Eeze device handling functions. Included are
|
||||
* This provides Eeze device handling functions. Included are
|
||||
* types and defines for accessing udev, mounting devices, and others.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup subsystems Subsystems
|
||||
* @brief These are the device subsystems of udev.
|
||||
*
|
||||
* - ac97
|
||||
* - acpi
|
||||
* - bdi
|
||||
* - block
|
||||
* - bsg
|
||||
* - dmi
|
||||
* - graphics
|
||||
* - hid
|
||||
* - hwmon
|
||||
* - i2c
|
||||
* - input
|
||||
* - mem
|
||||
* - misc
|
||||
* - net
|
||||
* - pci
|
||||
* - pci_bus
|
||||
* - pci_express
|
||||
* - platform
|
||||
* - pnp
|
||||
* - rtc
|
||||
* - scsi
|
||||
* - scsi_device
|
||||
* - scsi_disk
|
||||
* - scsi_generic
|
||||
* - scsi_host
|
||||
* - serio
|
||||
* - sound
|
||||
* - thermal
|
||||
* - tty
|
||||
* - usb
|
||||
* - usb_device
|
||||
* - vc
|
||||
* - vtconsole
|
||||
*
|
||||
* @ingroup udev
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup devices Device_Types
|
||||
* @brief These are the devtypes of udev.
|
||||
*
|
||||
* - atapi
|
||||
* - audio
|
||||
* - block
|
||||
* - cd
|
||||
* - char
|
||||
* - disk
|
||||
* - floppy
|
||||
* - generic
|
||||
* - hid
|
||||
* - hub
|
||||
* - media
|
||||
* - optical
|
||||
* - printer
|
||||
* - rbc
|
||||
* - scsi
|
||||
* - storage
|
||||
* - tape
|
||||
* - video
|
||||
*
|
||||
* @ingroup udev
|
||||
* For udev functions, see @ref udev.
|
||||
*/
|
||||
/**
|
||||
* @addtogroup udev
|
||||
*
|
||||
* These are the device subsystems of udev:
|
||||
* @li ac97
|
||||
* @li acpi
|
||||
* @li bdi
|
||||
* @li block
|
||||
* @li bsg
|
||||
* @li dmi
|
||||
* @li graphics
|
||||
* @li hid
|
||||
* @li hwmon
|
||||
* @li i2c
|
||||
* @li input
|
||||
* @li mem
|
||||
* @li misc
|
||||
* @li net
|
||||
* @li pci
|
||||
* @li pci_bus
|
||||
* @li pci_express
|
||||
* @li platform
|
||||
* @li pnp
|
||||
* @li rtc
|
||||
* @li scsi
|
||||
* @li scsi_device
|
||||
* @li scsi_disk
|
||||
* @li scsi_generic
|
||||
* @li scsi_host
|
||||
* @li serio
|
||||
* @li sound
|
||||
* @li thermal
|
||||
* @li tty
|
||||
* @li usb
|
||||
* @li usb_device
|
||||
* @li vc
|
||||
* @li vtconsole
|
||||
*
|
||||
* These are the devtypes of udev.
|
||||
* @li atapi
|
||||
* @li audio
|
||||
* @li block
|
||||
* @li cd
|
||||
* @li char
|
||||
* @li disk
|
||||
* @li floppy
|
||||
* @li generic
|
||||
* @li hid
|
||||
* @li hub
|
||||
* @li media
|
||||
* @li optical
|
||||
* @li printer
|
||||
* @li rbc
|
||||
* @li scsi
|
||||
* @li storage
|
||||
* @li tape
|
||||
* @li video
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup event EEZE_UDEV_EVENT
|
||||
* @brief These are event types used in udev functions.
|
||||
* @ingroup udev
|
||||
*
|
||||
* @{
|
||||
* @addtogroup udev
|
||||
* @typedef Eeze_Udev_Event
|
||||
* @enum Eeze_Udev_Event
|
||||
* @brief Flags for watch events
|
||||
*
|
||||
* These events are used to specify the events to watch in a
|
||||
* @ref Eeze_Udev_Watch. They can be OR'ed together.
|
||||
*@{
|
||||
*/
|
||||
|
||||
/** - No event specified */
|
||||
#define EEZE_UDEV_EVENT_NONE 0x0000
|
||||
/** - Device added */
|
||||
#define EEZE_UDEV_EVENT_ADD 0x0001
|
||||
/** - Device removed */
|
||||
#define EEZE_UDEV_EVENT_REMOVE 0x0002
|
||||
/** - Device changed */
|
||||
#define EEZE_UDEV_EVENT_CHANGE 0x0004
|
||||
/** - Device has come online */
|
||||
#define EEZE_UDEV_EVENT_ONLINE 0x0008
|
||||
/** - Device has gone offline */
|
||||
#define EEZE_UDEV_EVENT_OFFLINE 0x0010
|
||||
typedef enum
|
||||
{
|
||||
/** - No event specified */
|
||||
EEZE_UDEV_EVENT_NONE = 0xf0,
|
||||
/** - Device added */
|
||||
EEZE_UDEV_EVENT_ADD = (1 << 1),
|
||||
/** - Device removed */
|
||||
EEZE_UDEV_EVENT_REMOVE = (1 << 2),
|
||||
/** - Device changed */
|
||||
EEZE_UDEV_EVENT_CHANGE = (1 << 3),
|
||||
/** - Device has come online */
|
||||
EEZE_UDEV_EVENT_ONLINE = (1 << 4),
|
||||
/** - Device has gone offline */
|
||||
EEZE_UDEV_EVENT_OFFLINE = (1 << 5)
|
||||
} Eeze_Udev_Event;
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @defgroup type Eeze_Udev_Type
|
||||
* @addtogroup udev udev
|
||||
* @typedef Eeze_Udev_Type Eeze_Udev_Type
|
||||
* @enum Eeze_Udev_Type
|
||||
* @brief Convenience types to simplify udev access.
|
||||
*
|
||||
* These types allow easy access to certain udev device types. They
|
||||
* may only be used in specified functions.
|
||||
*
|
||||
* @ingroup udev
|
||||
* @{
|
||||
*/
|
||||
/*FIXME: these probably need to be bitmasks with categories*/
|
||||
typedef enum
|
||||
{ /** - No type */
|
||||
{
|
||||
/** - No type */
|
||||
EEZE_UDEV_TYPE_NONE,
|
||||
/** - Keyboard device */
|
||||
EEZE_UDEV_TYPE_KEYBOARD,
|
||||
|
@ -157,10 +161,6 @@ typedef enum
|
|||
struct Eeze_Udev_Watch;
|
||||
typedef struct Eeze_Udev_Watch Eeze_Udev_Watch;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _Eeze_Version
|
||||
{
|
||||
int major;
|
||||
|
@ -169,6 +169,12 @@ typedef struct _Eeze_Version
|
|||
int revision;
|
||||
} Eeze_Version;
|
||||
|
||||
/**
|
||||
* @addtogroup watch
|
||||
* @brief Callback type for use with @ref Eeze_Udev_Watch
|
||||
*/
|
||||
typedef void(*Eeze_Udev_Watch_Cb)(const char *, Eeze_Udev_Event, void *, Eeze_Udev_Watch *);
|
||||
|
||||
#define EEZE_VERSION_MAJOR 0
|
||||
#define EEZE_VERSION_MINOR 2
|
||||
|
||||
|
@ -178,9 +184,9 @@ typedef struct _Eeze_Version
|
|||
EAPI int eeze_shutdown(void);
|
||||
|
||||
EAPI Eina_List *eeze_udev_find_similar_from_syspath(const char *syspath);
|
||||
EAPI void eeze_udev_find_unlisted_similar(Eina_List *list);
|
||||
EAPI Eina_List *eeze_udev_find_unlisted_similar(Eina_List *list);
|
||||
EAPI Eina_List *eeze_udev_find_by_sysattr(const char *sysattr, const char *value);
|
||||
EAPI Eina_List *eeze_udev_find_by_type(const Eeze_Udev_Type type, const char *name);
|
||||
EAPI Eina_List *eeze_udev_find_by_type(Eeze_Udev_Type type, const char *name);
|
||||
EAPI Eina_List *eeze_udev_find_by_filter(const char *subsystem, const char *type, const char *name);
|
||||
|
||||
EAPI const char *eeze_udev_devpath_get_syspath(const char *devpath);
|
||||
|
@ -198,7 +204,7 @@ typedef struct _Eeze_Version
|
|||
EAPI Eina_Bool eeze_udev_walk_check_sysattr(const char *syspath, const char *sysattr, const char *value);
|
||||
EAPI const char *eeze_udev_walk_get_sysattr(const char *syspath, const char *sysattr);
|
||||
|
||||
EAPI Eeze_Udev_Watch *eeze_udev_watch_add(Eeze_Udev_Type type, int event, void(*func)(const char *, int, void *, Eeze_Udev_Watch *), void *user_data);
|
||||
EAPI Eeze_Udev_Watch *eeze_udev_watch_add(Eeze_Udev_Type type, int event, Eeze_Udev_Watch_Cb cb, void *user_data);
|
||||
EAPI void *eeze_udev_watch_del(Eeze_Udev_Watch *watch);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -83,7 +83,7 @@ eeze_udev_find_similar_from_syspath(const char *syspath)
|
|||
* and we only need to check parents of the roots
|
||||
*/
|
||||
if (udev_device_get_sysattr_value(device, "idVendor"))
|
||||
_get_unlisted_parents(ret, device);
|
||||
ret = _get_unlisted_parents(ret, device);
|
||||
|
||||
udev_device_unref(device);
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ eeze_udev_find_similar_from_syspath(const char *syspath)
|
|||
* device.
|
||||
*
|
||||
* @param list The list of devices to update
|
||||
* @return The updated list
|
||||
*
|
||||
* This function will update @p list to include all devices matching
|
||||
* devices with syspaths currently stored in @p list. All strings are
|
||||
|
@ -104,7 +105,7 @@ eeze_udev_find_similar_from_syspath(const char *syspath)
|
|||
*
|
||||
* @ingroup find
|
||||
*/
|
||||
EAPI void
|
||||
EAPI Eina_List *
|
||||
eeze_udev_find_unlisted_similar(Eina_List * list)
|
||||
{
|
||||
_udev_device *device;
|
||||
|
@ -152,13 +153,13 @@ eeze_udev_find_unlisted_similar(Eina_List * list)
|
|||
* and we only need to check parents of the roots
|
||||
*/
|
||||
if (udev_device_get_sysattr_value(device, "idVendor"))
|
||||
_get_unlisted_parents(list, device);
|
||||
list = _get_unlisted_parents(list, device);
|
||||
|
||||
udev_device_unref(device);
|
||||
}
|
||||
udev_enumerate_unref(en);
|
||||
}
|
||||
return;
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,7 +174,7 @@ eeze_udev_find_unlisted_similar(Eina_List * list)
|
|||
* @ingroup find
|
||||
*/
|
||||
EAPI Eina_List *
|
||||
eeze_udev_find_by_type(const Eeze_Udev_Type etype, const char *name)
|
||||
eeze_udev_find_by_type(Eeze_Udev_Type etype, const char *name)
|
||||
{
|
||||
_udev_enumerate *en;
|
||||
_udev_list_entry *devs, *cur;
|
||||
|
|
|
@ -78,7 +78,7 @@ _walk_parents_get_attr(_udev_device * device, const char *sysattr)
|
|||
* check a list for all parents of a device,
|
||||
* stringshare adding all devices that are not in the list
|
||||
*/
|
||||
void
|
||||
Eina_List *
|
||||
_get_unlisted_parents(Eina_List * list, _udev_device * device)
|
||||
{
|
||||
_udev_device *parent, *child = device;
|
||||
|
@ -126,5 +126,5 @@ _get_unlisted_parents(Eina_List * list, _udev_device * device)
|
|||
list = eina_list_prepend(list, eina_stringshare_add(devname));
|
||||
}
|
||||
|
||||
return;
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ typedef struct udev_monitor _udev_monitor;
|
|||
|
||||
Eina_Bool _walk_parents_test_attr(_udev_device *device, const char *sysattr, const char* value);
|
||||
const char *_walk_parents_get_attr(_udev_device *device, const char *sysattr);
|
||||
void _get_unlisted_parents(Eina_List *list, _udev_device *device);
|
||||
Eina_List *_get_unlisted_parents(Eina_List *list, _udev_device *device);
|
||||
_udev_device *_copy_device(_udev_device *device);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -19,7 +19,7 @@ struct Eeze_Udev_Watch
|
|||
/* private */
|
||||
struct _store_data
|
||||
{
|
||||
void (*func)(const char *, int, void *, Eeze_Udev_Watch *);
|
||||
void (*func)(const char *, Eeze_Udev_Event, void *, Eeze_Udev_Watch *);
|
||||
void *data;
|
||||
int event;
|
||||
_udev_monitor *mon;
|
||||
|
@ -50,7 +50,7 @@ _get_syspath_from_watch(void *data, Ecore_Fd_Handler * fd_handler)
|
|||
struct _store_data *store = data;
|
||||
_udev_device *device, *parent, *tmpdev;
|
||||
const char *ret, *test;
|
||||
void (*func)(const char *, int, void *, Eeze_Udev_Watch *) = store->func;
|
||||
Eeze_Udev_Watch_Cb func = store->func;
|
||||
void *sdata = store->data;
|
||||
Eeze_Udev_Watch *watch = store->watch;
|
||||
int cap = 0, event = 0;
|
||||
|
@ -295,8 +295,7 @@ error:
|
|||
*/
|
||||
EAPI Eeze_Udev_Watch *
|
||||
eeze_udev_watch_add(Eeze_Udev_Type type, int event,
|
||||
void (*func)(const char *syspath, int event, void *data,
|
||||
Eeze_Udev_Watch * watch), void *user_data)
|
||||
Eeze_Udev_Watch_Cb cb, void *user_data)
|
||||
{
|
||||
_udev_monitor *mon = NULL;
|
||||
int fd;
|
||||
|
@ -361,7 +360,7 @@ eeze_udev_watch_add(Eeze_Udev_Type type, int event,
|
|||
goto error;
|
||||
|
||||
fd = udev_monitor_get_fd(mon);
|
||||
store->func = func;
|
||||
store->func = cb;
|
||||
store->data = user_data;
|
||||
store->mon = mon;
|
||||
store->type = type;
|
||||
|
|
Loading…
Reference in New Issue