ecrustified for formatting

SVN revision: 55898
This commit is contained in:
Mike Blumenkrantz 2011-01-05 18:46:32 +00:00
parent 961244f70a
commit 1707697d8a
7 changed files with 437 additions and 386 deletions

View File

@ -2,7 +2,6 @@
#include <Ecore.h> #include <Ecore.h>
#include <stdio.h> #include <stdio.h>
/** /**
* This demo program shows how to use some eeze_udev functions. It roughly * This demo program shows how to use some eeze_udev functions. It roughly
* 1kb as of now, TODO is to fix this but I'm too lazy now and it's only * 1kb as of now, TODO is to fix this but I'm too lazy now and it's only
@ -18,7 +17,10 @@ typedef struct kbdmouse
static void static void
/* event will always be a syspath starting with /sys */ /* event will always be a syspath starting with /sys */
catch_events(const char *device, Eeze_Udev_Event event, void *data, Eeze_Udev_Watch *watch) catch_events(const char *device,
Eeze_Udev_Event event,
void *data,
Eeze_Udev_Watch *watch)
{ {
kbdmouse *akbdmouse = data; kbdmouse *akbdmouse = data;
Eina_List *l; Eina_List *l;
@ -80,7 +82,8 @@ hash_free(void *data)
eina_stringshare_del(data); eina_stringshare_del(data);
} }
int main() int
main()
{ {
Eina_List *type, *l; Eina_List *type, *l;
const char *name, *check, *check2; const char *name, *check, *check2;
@ -104,9 +107,9 @@ int main()
EINA_LIST_FOREACH(type, l, name) EINA_LIST_FOREACH(type, l, name)
{ {
/* add the devpath to the hash for use in the cb later */ /* add the devpath to the hash for use in the cb later */
if ((check = eeze_udev_syspath_get_devpath(name))) if ((check = eeze_udev_syspath_get_devpath(name)))
eina_hash_direct_add(hash, name, check); eina_hash_direct_add(hash, name, check);
printf("Found keyboard: %s\n", name); printf("Found keyboard: %s\n", name);
} }
/* we save this list for later, because once a device is unplugged it can /* we save this list for later, because once a device is unplugged it can
* no longer be detected by udev, and any related properties are unusable unless * no longer be detected by udev, and any related properties are unusable unless
@ -121,7 +124,7 @@ int main()
EINA_LIST_FOREACH(type, l, name) EINA_LIST_FOREACH(type, l, name)
{ /* add the devpath to the hash for use in the cb later */ { /* add the devpath to the hash for use in the cb later */
if ((check = eeze_udev_syspath_get_devpath(name))) if ((check = eeze_udev_syspath_get_devpath(name)))
eina_hash_direct_add(hash, name, check); /* get a property using the device's syspath */ eina_hash_direct_add(hash, name, check); /* get a property using the device's syspath */
printf("Found mouse %s with vendor: %s\n", name, eeze_udev_walk_get_sysattr(name, "manufacturer")); printf("Found mouse %s with vendor: %s\n", name, eeze_udev_walk_get_sysattr(name, "manufacturer"));
} }
/* we save this list for later, because once a device is unplugged it can /* we save this list for later, because once a device is unplugged it can
@ -135,27 +138,27 @@ int main()
type = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRIVE_MOUNTABLE, NULL); type = eeze_udev_find_by_type(EEZE_UDEV_TYPE_DRIVE_MOUNTABLE, NULL);
type = eeze_udev_find_unlisted_similar(type); type = eeze_udev_find_unlisted_similar(type);
EINA_LIST_FREE(type, name) EINA_LIST_FREE(type, name)
{ {
printf("Found device: %s\n", name); /* get a property using the device's syspath */ printf("Found device: %s\n", name); /* get a property using the device's syspath */
if ((check = eeze_udev_syspath_get_property(name, "DEVNAME"))) if ((check = eeze_udev_syspath_get_property(name, "DEVNAME")))
{ {
printf("\tYou probably know it better as %s\n", check); printf("\tYou probably know it better as %s\n", check);
eina_stringshare_del(check); eina_stringshare_del(check);
} }
if ((check = eeze_udev_syspath_get_property(name, "ID_FS_TYPE"))) if ((check = eeze_udev_syspath_get_property(name, "ID_FS_TYPE")))
{ {
printf("\tIt's formatted as %s", check); printf("\tIt's formatted as %s", check);
eina_stringshare_del(check); eina_stringshare_del(check);
check = eeze_udev_syspath_get_property(name, "FSTAB_DIR"); check = eeze_udev_syspath_get_property(name, "FSTAB_DIR");
if (check) if (check)
{ {
printf(", and gets mounted at %s", check); printf(", and gets mounted at %s", check);
eina_stringshare_del(check); eina_stringshare_del(check);
} }
printf("!\n"); printf("!\n");
} }
eina_stringshare_del(name); eina_stringshare_del(name);
} }
printf("\nInternal drives, anyone? With serial numbers?\n"); printf("\nInternal drives, anyone? With serial numbers?\n");
/* find all internal drives using type EEZE_UDEV_TYPE_DRIVE_INTERNAL */ /* find all internal drives using type EEZE_UDEV_TYPE_DRIVE_INTERNAL */
@ -187,7 +190,6 @@ int main()
eina_stringshare_del(name); eina_stringshare_del(name);
} }
/* set a udev watch, grab all events because no EEZE_UDEV_TYPE filter is specified, /* set a udev watch, grab all events because no EEZE_UDEV_TYPE filter is specified,
* set the events to be sent to callback function catch_events(), and attach * set the events to be sent to callback function catch_events(), and attach
* kbdmouse to the watch as associated data * kbdmouse to the watch as associated data
@ -200,3 +202,4 @@ int main()
return 0; return 0;
} }

View File

@ -17,10 +17,9 @@ _udev *udev;
int _eeze_udev_log_dom = -1; int _eeze_udev_log_dom = -1;
int _eeze_init_count = 0; int _eeze_init_count = 0;
/** /**
* @defgroup main main * @defgroup main main
* *
* These are general eeze functions which include init and shutdown. * These are general eeze functions which include init and shutdown.
*/ */
@ -30,10 +29,10 @@ EAPI Eeze_Version *eeze_version = &_version;
/** /**
* Initialize the eeze library. * Initialize the eeze library.
* @return The number of times the function has been called, or -1 on failure. * @return The number of times the function has been called, or -1 on failure.
* *
* This function should be called prior to using any eeze functions, and MUST * This function should be called prior to using any eeze functions, and MUST
* be called prior to using any udev functions to avoid a segv. * be called prior to using any udev functions to avoid a segv.
* *
* @ingroup main * @ingroup main
*/ */
EAPI int EAPI int
@ -46,7 +45,7 @@ eeze_init(void)
return 0; return 0;
_eeze_udev_log_dom = eina_log_domain_register _eeze_udev_log_dom = eina_log_domain_register
("eeze_udev", EEZE_UDEV_COLOR_DEFAULT); ("eeze_udev", EEZE_UDEV_COLOR_DEFAULT);
if (_eeze_udev_log_dom < 0) if (_eeze_udev_log_dom < 0)
{ {
@ -76,11 +75,11 @@ eina_fail:
/** /**
* Shut down the eeze library. * Shut down the eeze library.
* @return The number of times the eeze_init has been called, or -1 when * @return The number of times the eeze_init has been called, or -1 when
* all occurrences of eeze have been shut down. * all occurrences of eeze have been shut down.
* *
* This function should be called when no further eeze functions will be called. * This function should be called when no further eeze functions will be called.
* *
* @ingroup main * @ingroup main
*/ */
EAPI int EAPI int
@ -96,3 +95,4 @@ eeze_shutdown(void)
eina_shutdown(); eina_shutdown();
return _eeze_init_count; return _eeze_init_count;
} }

View File

@ -14,7 +14,7 @@
* @addtogroup find Find * @addtogroup find Find
* *
* These are functions which find/supplement lists of devices. * These are functions which find/supplement lists of devices.
* *
* @ingroup udev * @ingroup udev
* *
* @{ * @{
@ -68,7 +68,7 @@ eeze_udev_find_similar_from_syspath(const char *syspath)
udev_list_entry_foreach(cur, devs) udev_list_entry_foreach(cur, devs)
{ {
devname = udev_list_entry_get_name(cur); devname = udev_list_entry_get_name(cur);
/* verify unlisted device */ /* verify unlisted device */
EINA_LIST_FOREACH(ret, l, dev) EINA_LIST_FOREACH(ret, l, dev)
if (!strcmp(dev, devname)) if (!strcmp(dev, devname))
@ -77,9 +77,9 @@ eeze_udev_find_similar_from_syspath(const char *syspath)
ret = eina_list_prepend(ret, eina_stringshare_add(devname)); ret = eina_list_prepend(ret, eina_stringshare_add(devname));
device = udev_device_new_from_syspath(udev, devname); device = udev_device_new_from_syspath(udev, devname);
/* only device roots have this sysattr, /* only device roots have this sysattr,
* and we only need to check parents of the roots * and we only need to check parents of the roots
*/ */
if (udev_device_get_sysattr_value(device, "idVendor")) if (udev_device_get_sysattr_value(device, "idVendor"))
ret = _get_unlisted_parents(ret, device); ret = _get_unlisted_parents(ret, device);
@ -101,7 +101,7 @@ eeze_udev_find_similar_from_syspath(const char *syspath)
* stringshared. * stringshared.
*/ */
EAPI Eina_List * EAPI Eina_List *
eeze_udev_find_unlisted_similar(Eina_List * list) eeze_udev_find_unlisted_similar(Eina_List *list)
{ {
_udev_device *device; _udev_device *device;
_udev_list_entry *devs, *cur; _udev_list_entry *devs, *cur;
@ -117,7 +117,7 @@ eeze_udev_find_unlisted_similar(Eina_List * list)
en = udev_enumerate_new((udev)); en = udev_enumerate_new((udev));
if (!en) if (!en)
return NULL; return NULL;
device = _new_device(dev); device = _new_device(dev);
if (!device) continue; if (!device) continue;
@ -125,14 +125,14 @@ eeze_udev_find_unlisted_similar(Eina_List * list)
if ((vendor = udev_device_get_property_value(device, "ID_VENDOR_ID"))) if ((vendor = udev_device_get_property_value(device, "ID_VENDOR_ID")))
udev_enumerate_add_match_property(en, "ID_VENDOR_ID", vendor); udev_enumerate_add_match_property(en, "ID_VENDOR_ID", vendor);
else else
if ((vendor = udev_device_get_property_value(device, "ID_VENDOR"))) if ((vendor = udev_device_get_property_value(device, "ID_VENDOR")))
udev_enumerate_add_match_property(en, "ID_VENDOR", vendor); udev_enumerate_add_match_property(en, "ID_VENDOR", vendor);
if ((model = udev_device_get_property_value(device, "ID_MODEL_ID"))) if ((model = udev_device_get_property_value(device, "ID_MODEL_ID")))
udev_enumerate_add_match_property(en, "ID_MODEL_ID", model); udev_enumerate_add_match_property(en, "ID_MODEL_ID", model);
else else
if ((model = udev_device_get_property_value(device, "ID_MODEL"))) if ((model = udev_device_get_property_value(device, "ID_MODEL")))
udev_enumerate_add_match_property(en, "ID_MODEL", model); udev_enumerate_add_match_property(en, "ID_MODEL", model);
if ((revision = udev_device_get_property_value(device, "ID_REVISION"))) if ((revision = udev_device_get_property_value(device, "ID_REVISION")))
udev_enumerate_add_match_property(en, "ID_REVISION", revision); udev_enumerate_add_match_property(en, "ID_REVISION", revision);
@ -168,7 +168,8 @@ eeze_udev_find_unlisted_similar(Eina_List * list)
* Return a list of syspaths (/sys/$syspath) for matching udev devices. * Return a list of syspaths (/sys/$syspath) for matching udev devices.
*/ */
EAPI Eina_List * EAPI Eina_List *
eeze_udev_find_by_type(Eeze_Udev_Type etype, const char *name) eeze_udev_find_by_type(Eeze_Udev_Type etype,
const char *name)
{ {
_udev_enumerate *en; _udev_enumerate *en;
_udev_list_entry *devs, *cur; _udev_list_entry *devs, *cur;
@ -186,69 +187,80 @@ eeze_udev_find_by_type(Eeze_Udev_Type etype, const char *name)
switch (etype) switch (etype)
{ {
case EEZE_UDEV_TYPE_NONE: case EEZE_UDEV_TYPE_NONE:
break; break;
case EEZE_UDEV_TYPE_KEYBOARD:
udev_enumerate_add_match_subsystem(en, "input"); case EEZE_UDEV_TYPE_KEYBOARD:
udev_enumerate_add_match_subsystem(en, "input");
#ifndef OLD_UDEV_RRRRRRRRRRRRRR #ifndef OLD_UDEV_RRRRRRRRRRRRRR
udev_enumerate_add_match_property(en, "ID_INPUT_KEYBOARD", "1"); udev_enumerate_add_match_property(en, "ID_INPUT_KEYBOARD", "1");
#else #else
udev_enumerate_add_match_property(en, "ID_CLASS", "kbd"); udev_enumerate_add_match_property(en, "ID_CLASS", "kbd");
#endif #endif
break; break;
case EEZE_UDEV_TYPE_MOUSE:
udev_enumerate_add_match_subsystem(en, "input"); case EEZE_UDEV_TYPE_MOUSE:
udev_enumerate_add_match_subsystem(en, "input");
#ifndef OLD_UDEV_RRRRRRRRRRRRRR #ifndef OLD_UDEV_RRRRRRRRRRRRRR
udev_enumerate_add_match_property(en, "ID_INPUT_MOUSE", "1"); udev_enumerate_add_match_property(en, "ID_INPUT_MOUSE", "1");
#else #else
udev_enumerate_add_match_property(en, "ID_CLASS", "mouse"); udev_enumerate_add_match_property(en, "ID_CLASS", "mouse");
#endif #endif
break; break;
case EEZE_UDEV_TYPE_TOUCHPAD:
udev_enumerate_add_match_subsystem(en, "input"); case EEZE_UDEV_TYPE_TOUCHPAD:
udev_enumerate_add_match_subsystem(en, "input");
#ifndef OLD_UDEV_RRRRRRRRRRRRRR #ifndef OLD_UDEV_RRRRRRRRRRRRRR
udev_enumerate_add_match_property(en, "ID_INPUT_TOUCHPAD", "1"); udev_enumerate_add_match_property(en, "ID_INPUT_TOUCHPAD", "1");
#endif #endif
break; break;
case EEZE_UDEV_TYPE_DRIVE_MOUNTABLE:
udev_enumerate_add_match_subsystem(en, "block"); case EEZE_UDEV_TYPE_DRIVE_MOUNTABLE:
udev_enumerate_add_match_property(en, "ID_FS_USAGE", "filesystem"); udev_enumerate_add_match_subsystem(en, "block");
/* parent node */ udev_enumerate_add_match_property(en, "ID_FS_USAGE", "filesystem");
udev_enumerate_add_nomatch_sysattr(en, "capability", "50"); /* parent node */
break; udev_enumerate_add_nomatch_sysattr(en, "capability", "50");
case EEZE_UDEV_TYPE_DRIVE_INTERNAL: break;
udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_property(en, "ID_TYPE", "disk"); case EEZE_UDEV_TYPE_DRIVE_INTERNAL:
udev_enumerate_add_match_property(en, "ID_BUS", "ata"); udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_sysattr(en, "removable", "0"); udev_enumerate_add_match_property(en, "ID_TYPE", "disk");
break; udev_enumerate_add_match_property(en, "ID_BUS", "ata");
case EEZE_UDEV_TYPE_DRIVE_REMOVABLE: udev_enumerate_add_match_sysattr(en, "removable", "0");
udev_enumerate_add_match_subsystem(en, "block"); break;
udev_enumerate_add_match_property(en, "ID_TYPE", "disk");
break; case EEZE_UDEV_TYPE_DRIVE_REMOVABLE:
case EEZE_UDEV_TYPE_DRIVE_CDROM: udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_subsystem(en, "block"); udev_enumerate_add_match_property(en, "ID_TYPE", "disk");
udev_enumerate_add_match_property(en, "ID_CDROM", "1"); break;
break;
case EEZE_UDEV_TYPE_POWER_AC: case EEZE_UDEV_TYPE_DRIVE_CDROM:
udev_enumerate_add_match_subsystem(en, "power_supply"); udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_sysattr(en, "type", "Mains"); udev_enumerate_add_match_property(en, "ID_CDROM", "1");
break; break;
case EEZE_UDEV_TYPE_POWER_BAT:
udev_enumerate_add_match_subsystem(en, "power_supply"); case EEZE_UDEV_TYPE_POWER_AC:
udev_enumerate_add_match_sysattr(en, "type", "Battery"); udev_enumerate_add_match_subsystem(en, "power_supply");
break; udev_enumerate_add_match_sysattr(en, "type", "Mains");
case EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR: break;
udev_enumerate_add_match_subsystem(en, "hwmon");
break; case EEZE_UDEV_TYPE_POWER_BAT:
/* udev_enumerate_add_match_subsystem(en, "power_supply");
case EEZE_UDEV_TYPE_ANDROID: udev_enumerate_add_match_sysattr(en, "type", "Battery");
udev_enumerate_add_match_subsystem(en, "block"); break;
udev_enumerate_add_match_property(en, "ID_MODEL", "Android_*");
break; case EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR:
*/ udev_enumerate_add_match_subsystem(en, "hwmon");
default: break;
break;
/*
case EEZE_UDEV_TYPE_ANDROID:
udev_enumerate_add_match_subsystem(en, "block");
udev_enumerate_add_match_property(en, "ID_MODEL", "Android_*");
break;
*/
default:
break;
} }
udev_enumerate_scan_devices(en); udev_enumerate_scan_devices(en);
@ -258,53 +270,53 @@ eeze_udev_find_by_type(Eeze_Udev_Type etype, const char *name)
devname = udev_list_entry_get_name(cur); devname = udev_list_entry_get_name(cur);
device = udev_device_new_from_syspath(udev, devname); device = udev_device_new_from_syspath(udev, devname);
if (etype == EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR) if (etype == EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR) /* ensure that temp input exists somewhere in this device chain */
{ /* ensure that temp input exists somewhere in this device chain */ {
if (!_walk_parents_test_attr(device, "temp1_input", NULL)) if (!_walk_parents_test_attr(device, "temp1_input", NULL))
goto out; goto out;
/* if device is not the one which has the temp input, we must go up the chain */ /* if device is not the one which has the temp input, we must go up the chain */
if (!(test = udev_device_get_sysattr_value(device, "temp1_input"))) if (!(test = udev_device_get_sysattr_value(device, "temp1_input")))
{ {
devname = NULL; devname = NULL;
for (parent = udev_device_get_parent(device); parent; parent = udev_device_get_parent(parent)) /*check for parent */ for (parent = udev_device_get_parent(device); parent; parent = udev_device_get_parent(parent)) /*check for parent */
if (((test = udev_device_get_sysattr_value(parent, "temp1_input")))) if (((test = udev_device_get_sysattr_value(parent, "temp1_input"))))
{ {
devname = udev_device_get_syspath(parent); devname = udev_device_get_syspath(parent);
break; break;
} }
if (!devname) if (!devname)
goto out; goto out;
} }
} }
else if (etype == EEZE_UDEV_TYPE_DRIVE_INTERNAL) else if (etype == EEZE_UDEV_TYPE_DRIVE_INTERNAL)
{ {
if (udev_device_get_property_value(device, "ID_USB_DRIVER")) if (udev_device_get_property_value(device, "ID_USB_DRIVER"))
goto out; goto out;
} }
else if (etype == EEZE_UDEV_TYPE_DRIVE_REMOVABLE) else if (etype == EEZE_UDEV_TYPE_DRIVE_REMOVABLE)
{ {
if (!(test = udev_device_get_property_value(device, "ID_USB_DRIVER"))) if (!(test = udev_device_get_property_value(device, "ID_USB_DRIVER")))
goto out; goto out;
} }
else if (etype == EEZE_UDEV_TYPE_DRIVE_MOUNTABLE) else if (etype == EEZE_UDEV_TYPE_DRIVE_MOUNTABLE)
{ {
int devcheck; int devcheck;
devcheck = open(udev_device_get_devnode(device), O_RDONLY | O_EXCL); devcheck = open(udev_device_get_devnode(device), O_RDONLY | O_EXCL);
if (errno) if (errno)
{ {
if (devcheck >= 0) close(devcheck); if (devcheck >= 0) close(devcheck);
goto out; goto out;
} }
if (devcheck < 0) goto out; if (devcheck < 0) goto out;
close(devcheck); close(devcheck);
} }
if (name && (!strstr(devname, name))) if (name && (!strstr(devname, name)))
goto out; goto out;
ret = eina_list_append(ret, eina_stringshare_add(devname)); ret = eina_list_append(ret, eina_stringshare_add(devname));
out: out:
@ -326,7 +338,8 @@ out:
* Requires at least one filter. * Requires at least one filter.
*/ */
EAPI Eina_List * EAPI Eina_List *
eeze_udev_find_by_filter(const char *subsystem, const char *type, eeze_udev_find_by_filter(const char *subsystem,
const char *type,
const char *name) const char *name)
{ {
_udev_enumerate *en; _udev_enumerate *en;
@ -373,11 +386,12 @@ out:
* @param value Optional: the value that the attribute should have * @param value Optional: the value that the attribute should have
* *
* @return A stringshared list of the devices found with the attribute * @return A stringshared list of the devices found with the attribute
* *
* @ingroup find * @ingroup find
*/ */
EAPI Eina_List * EAPI Eina_List *
eeze_udev_find_by_sysattr(const char *sysattr, const char *value) eeze_udev_find_by_sysattr(const char *sysattr,
const char *value)
{ {
_udev_enumerate *en; _udev_enumerate *en;
_udev_list_entry *devs, *cur; _udev_list_entry *devs, *cur;

View File

@ -32,7 +32,7 @@ _new_device(const char *syspath)
* copies a device * copies a device
*/ */
_udev_device * _udev_device *
_copy_device(_udev_device * device) _copy_device(_udev_device *device)
{ {
const char *syspath; const char *syspath;
@ -48,8 +48,9 @@ _copy_device(_udev_device * device)
* with value $value * with value $value
*/ */
Eina_Bool Eina_Bool
_walk_parents_test_attr(_udev_device * device, const char *sysattr, _walk_parents_test_attr(_udev_device *device,
const char *value) const char *sysattr,
const char *value)
{ {
_udev_device *parent, *child = device; _udev_device *parent, *child = device;
const char *test; const char *test;
@ -67,15 +68,16 @@ _walk_parents_test_attr(_udev_device * device, const char *sysattr,
if (!value) if (!value)
return EINA_TRUE; return EINA_TRUE;
else else
if (!strcmp(test, value)) if (!strcmp(test, value))
return EINA_TRUE; return EINA_TRUE;
} }
return EINA_TRUE; return EINA_TRUE;
} }
const char * const char *
_walk_parents_get_attr(_udev_device * device, const char *sysattr) _walk_parents_get_attr(_udev_device *device,
const char *sysattr)
{ {
_udev_device *parent, *child = device; _udev_device *parent, *child = device;
const char *test; const char *test;
@ -99,7 +101,8 @@ _walk_parents_get_attr(_udev_device * device, const char *sysattr)
* stringshare adding all devices that are not in the list * stringshare adding all devices that are not in the list
*/ */
Eina_List * Eina_List *
_get_unlisted_parents(Eina_List * list, _udev_device * device) _get_unlisted_parents(Eina_List *list,
_udev_device *device)
{ {
_udev_device *parent, *child = device; _udev_device *parent, *child = device;
const char *test, *devname, *vendor, *vendor2, *model, *model2; const char *test, *devname, *vendor, *vendor2, *model, *model2;
@ -128,9 +131,9 @@ _get_unlisted_parents(Eina_List * list, _udev_device * device)
|| (vendor2 && !vendor)) || (vendor2 && !vendor))
break; break;
else else
if (((model && model2) && (strcmp(model, model2))) || if (((model && model2) && (strcmp(model, model2))) ||
((vendor && vendor2) && (strcmp(vendor, vendor2)))) ((vendor && vendor2) && (strcmp(vendor, vendor2))))
break; break;
devname = udev_device_get_syspath(parent); devname = udev_device_get_syspath(parent);
EINA_LIST_FOREACH(list, l, test) EINA_LIST_FOREACH(list, l, test)
@ -148,3 +151,4 @@ _get_unlisted_parents(Eina_List * list, _udev_device * device)
return list; return list;
} }

View File

@ -8,9 +8,9 @@
/** /**
* @addtogroup syspath Syspath * @addtogroup syspath Syspath
* *
* These are functions which interact with the syspath (/sys/$PATH) of * These are functions which interact with the syspath (/sys/$PATH) of
* a device. * a device.
* *
* @ingroup udev * @ingroup udev
* *
* @{ * @{
@ -134,7 +134,8 @@ eeze_udev_syspath_get_subsystem(const char *syspath)
* @return A stringshared char* with the property or NULL on failure * @return A stringshared char* with the property or NULL on failure
*/ */
EAPI const char * EAPI const char *
eeze_udev_syspath_get_property(const char *syspath, const char *property) eeze_udev_syspath_get_property(const char *syspath,
const char *property)
{ {
_udev_device *device; _udev_device *device;
const char *value = NULL, *test; const char *value = NULL, *test;
@ -159,7 +160,8 @@ eeze_udev_syspath_get_property(const char *syspath, const char *property)
* @return A stringshared char* with the sysattr or NULL on failure * @return A stringshared char* with the sysattr or NULL on failure
*/ */
EAPI const char * EAPI const char *
eeze_udev_syspath_get_sysattr(const char *syspath, const char *sysattr) eeze_udev_syspath_get_sysattr(const char *syspath,
const char *sysattr)
{ {
_udev_device *device; _udev_device *device;
const char *value = NULL, *test; const char *value = NULL, *test;
@ -317,7 +319,7 @@ eeze_udev_devpath_get_syspath(const char *devpath)
udev_list_entry_foreach(cur, devs) udev_list_entry_foreach(cur, devs)
{ {
ret = eina_stringshare_add(udev_list_entry_get_name(cur)); ret = eina_stringshare_add(udev_list_entry_get_name(cur));
break; /*just in case there's more than one somehow */ break; /*just in case there's more than one somehow */
} }
udev_enumerate_unref(en); udev_enumerate_unref(en);
return ret; return ret;

View File

@ -9,7 +9,7 @@
* @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
* *
* @{ * @{
@ -26,7 +26,8 @@
* @return If the sysattr (with value) is found, returns TRUE. Else, false. * @return If the sysattr (with value) is found, returns TRUE. Else, false.
*/ */
EAPI Eina_Bool EAPI Eina_Bool
eeze_udev_walk_check_sysattr(const char *syspath, const char *sysattr, eeze_udev_walk_check_sysattr(const char *syspath,
const char *sysattr,
const char *value) const char *value)
{ {
_udev_device *device, *child, *parent; _udev_device *device, *child, *parent;
@ -40,7 +41,7 @@ eeze_udev_walk_check_sysattr(const char *syspath, const char *sysattr,
return EINA_FALSE; return EINA_FALSE;
for (parent = device; parent; for (parent = device; parent;
child = parent, parent = udev_device_get_parent(child)) child = parent, parent = udev_device_get_parent(child))
{ {
if (!(test = udev_device_get_sysattr_value(parent, sysattr))) if (!(test = udev_device_get_sysattr_value(parent, sysattr)))
continue; continue;
@ -65,7 +66,8 @@ eeze_udev_walk_check_sysattr(const char *syspath, const char *sysattr,
* @return The stringshared value of @p sysattr if found, or NULL * @return The stringshared value of @p sysattr if found, or NULL
*/ */
EAPI const char * EAPI const char *
eeze_udev_walk_get_sysattr(const char *syspath, const char *sysattr) eeze_udev_walk_get_sysattr(const char *syspath,
const char *sysattr)
{ {
_udev_device *device, *child, *parent; _udev_device *device, *child, *parent;
const char *test = NULL; const char *test = NULL;
@ -75,9 +77,9 @@ eeze_udev_walk_get_sysattr(const char *syspath, const char *sysattr)
if (!(device = _new_device(syspath))) if (!(device = _new_device(syspath)))
return NULL; return NULL;
for (parent = device; parent; for (parent = device; parent;
child = parent, parent = udev_device_get_parent(child)) child = parent, parent = udev_device_get_parent(child))
{ {
if ((test = udev_device_get_sysattr_value(parent, sysattr))) if ((test = udev_device_get_sysattr_value(parent, sysattr)))
{ {

View File

@ -14,20 +14,23 @@
/* opaque */ /* opaque */
struct Eeze_Udev_Watch struct Eeze_Udev_Watch
{ {
_udev_monitor *mon; _udev_monitor *mon;
Ecore_Fd_Handler *handler; Ecore_Fd_Handler *handler;
Eeze_Udev_Type type; Eeze_Udev_Type type;
void *data; void *data;
}; };
/* private */ /* private */
struct _store_data struct _store_data
{ {
void (*func)(const char *, Eeze_Udev_Event, void *, Eeze_Udev_Watch *); void (*func)(const char *,
void *data; Eeze_Udev_Event,
int event; void *,
_udev_monitor *mon; Eeze_Udev_Watch *);
Eeze_Udev_Type type; void *data;
int event;
_udev_monitor *mon;
Eeze_Udev_Type type;
Eeze_Udev_Watch *watch; Eeze_Udev_Watch *watch;
}; };
@ -42,7 +45,7 @@ struct _store_data
* the watch object itself in case you want to stop the watch easily in a callback. * the watch object itself in case you want to stop the watch easily in a callback.
* *
* @ingroup udev * @ingroup udev
* *
* @{ * @{
*/ */
@ -50,8 +53,9 @@ struct _store_data
* specified; helpful for new udev versions, but absolutely required for * specified; helpful for new udev versions, but absolutely required for
* old udev, which does not implement filtering in device monitors. * old udev, which does not implement filtering in device monitors.
*/ */
static Eina_Bool static Eina_Bool
_get_syspath_from_watch(void *data, Ecore_Fd_Handler * fd_handler) _get_syspath_from_watch(void *data,
Ecore_Fd_Handler *fd_handler)
{ {
struct _store_data *store = data; struct _store_data *store = data;
_udev_device *device = NULL, *parent, *tmpdev; _udev_device *device = NULL, *parent, *tmpdev;
@ -71,170 +75,180 @@ _get_syspath_from_watch(void *data, Ecore_Fd_Handler * fd_handler)
switch (store->type) switch (store->type)
{ {
case EEZE_UDEV_TYPE_KEYBOARD: case EEZE_UDEV_TYPE_KEYBOARD:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR #ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device))) if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "input"))) || (strcmp(test, "input")))
goto error; goto error;
test = udev_device_get_property_value(device, "ID_CLASS"); test = udev_device_get_property_value(device, "ID_CLASS");
if ((_walk_parents_test_attr(device, "bInterfaceProtocol", "01")) if ((_walk_parents_test_attr(device, "bInterfaceProtocol", "01"))
|| ((test) && (!strcmp(test, "kbd")))) || ((test) && (!strcmp(test, "kbd"))))
break; break;
goto error;
#endif
if ((!udev_device_get_property_value(device, "ID_INPUT_KEYBOARD")) &&
(!udev_device_get_property_value(device, "ID_INPUT_KEY")))
goto error;
break;
case EEZE_UDEV_TYPE_MOUSE:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "input")))
goto error;
test = udev_device_get_property_value(device, "ID_CLASS");
if ((_walk_parents_test_attr(device, "bInterfaceProtocol", "02"))
|| ((test) && (!strcmp(test, "mouse"))))
break;
goto error;
#endif
if (!udev_device_get_property_value(device, "ID_INPUT_MOUSE"))
goto error;
break;
case EEZE_UDEV_TYPE_TOUCHPAD:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "input")))
goto error;
if (_walk_parents_test_attr(device, "resolution", NULL))
break;
goto error;
#endif
if (!udev_device_get_property_value(device, "ID_INPUT_TOUCHPAD"))
goto error;
break;
case EEZE_UDEV_TYPE_DRIVE_MOUNTABLE:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "block")))
goto error; goto error;
#endif #endif
if ((!udev_device_get_property_value(device, "ID_INPUT_KEYBOARD")) && test = udev_device_get_sysattr_value(device, "capability");
(!udev_device_get_property_value(device, "ID_INPUT_KEY")))
goto error;
break; if (test)
case EEZE_UDEV_TYPE_MOUSE: cap = strtol(test, NULL, 10);
if (!(test = (udev_device_get_property_value(device, "ID_FS_USAGE"))) ||
(strcmp("filesystem", test)) || (cap == 50))
goto error;
{
int devcheck;
devcheck = open(udev_device_get_devnode(device), O_RDONLY | O_EXCL);
if ((devcheck < 0) || errno) goto error;
close(devcheck);
}
break;
case EEZE_UDEV_TYPE_DRIVE_INTERNAL:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR #ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device))) if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "input"))) || (strcmp(test, "block")))
goto error;
test = udev_device_get_property_value(device, "ID_CLASS");
if ((_walk_parents_test_attr(device, "bInterfaceProtocol", "02"))
|| ((test) && (!strcmp(test, "mouse"))))
break;
goto error; goto error;
#endif #endif
if (!(test = udev_device_get_property_value(device, "ID_BUS"))
|| (strcmp("ata", test))
|| !(test = udev_device_get_sysattr_value(device, "removable"))
|| (strtol(test, NULL, 10)))
goto error;
if (!udev_device_get_property_value(device, "ID_INPUT_MOUSE")) break;
goto error;
break; case EEZE_UDEV_TYPE_DRIVE_REMOVABLE:
case EEZE_UDEV_TYPE_TOUCHPAD:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR #ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device))) if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "input"))) || (strcmp(test, "block")))
goto error;
if (_walk_parents_test_attr(device, "resolution", NULL))
break;
goto error; goto error;
#endif #endif
if (!udev_device_get_property_value(device, "ID_INPUT_TOUCHPAD")) if ((!(test = udev_device_get_sysattr_value(device, "removable"))
goto error; || (!strtol(test, NULL, 10)))
&& (!(test = udev_device_get_sysattr_value(device, "capability"))
|| (strtol(test, NULL, 10) != 10)))
goto error;
break; break;
case EEZE_UDEV_TYPE_DRIVE_MOUNTABLE:
case EEZE_UDEV_TYPE_DRIVE_CDROM:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR #ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device))) if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "block"))) || (strcmp(test, "block")))
goto error; goto error;
#endif #endif
test = udev_device_get_sysattr_value(device, "capability"); if (!udev_device_get_property_value(device, "ID_CDROM"))
goto error;
if (test) break;
cap = strtol(test, NULL, 10);
if (!(test = (udev_device_get_property_value(device, "ID_FS_USAGE"))) || case EEZE_UDEV_TYPE_POWER_AC:
(strcmp("filesystem", test)) || (cap == 50)) #ifdef OLD_UDEV_RRRRRRRRRRRRRR
goto error; if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "power_supply")))
goto error;
#endif
if (!(test = udev_device_get_property_value(device, "POWER_SUPPLY_TYPE"))
|| (strcmp("Mains", test)))
goto error;
break;
case EEZE_UDEV_TYPE_POWER_BAT:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "power_supply")))
goto error;
#endif
if (!(test = udev_device_get_property_value(device, "POWER_SUPPLY_TYPE"))
|| (strcmp("Battery", test)))
goto error;
break;
case EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "hwmon")))
goto error;
#endif /* have to do stuff up here since we need info from the parent */
if (!_walk_parents_test_attr(device, "temp1_input", NULL))
goto error;
/* if device is not the one which has the temp input, we must go up the chain */
if (!udev_device_get_sysattr_value(device, "temp1_input"))
{ {
int devcheck; for (parent = udev_device_get_parent(device); parent; parent = udev_device_get_parent(parent)) /*check for parent */
if (udev_device_get_sysattr_value(parent, "temp1_input"))
{
tmpdev = device;
devcheck = open(udev_device_get_devnode(device), O_RDONLY | O_EXCL); if (!(device = _copy_device(parent)))
if ((devcheck < 0) || errno) goto error; goto error;
close(devcheck);
udev_device_unref(tmpdev);
break;
}
} }
break; break;
case EEZE_UDEV_TYPE_DRIVE_INTERNAL:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "block")))
goto error;
#endif
if (!(test = udev_device_get_property_value(device, "ID_BUS"))
|| (strcmp("ata", test))
|| !(test = udev_device_get_sysattr_value(device, "removable"))
|| (strtol(test, NULL, 10)))
goto error;
break; default:
case EEZE_UDEV_TYPE_DRIVE_REMOVABLE: break;
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "block")))
goto error;
#endif
if ((!(test = udev_device_get_sysattr_value(device, "removable"))
|| (!strtol(test, NULL, 10)))
&& (!(test = udev_device_get_sysattr_value(device, "capability"))
|| (strtol(test, NULL, 10) != 10)))
goto error;
break;
case EEZE_UDEV_TYPE_DRIVE_CDROM:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "block")))
goto error;
#endif
if (!udev_device_get_property_value(device, "ID_CDROM"))
goto error;
break;
case EEZE_UDEV_TYPE_POWER_AC:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "power_supply")))
goto error;
#endif
if (!(test = udev_device_get_property_value(device, "POWER_SUPPLY_TYPE"))
|| (strcmp("Mains", test)))
goto error;
break;
case EEZE_UDEV_TYPE_POWER_BAT:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "power_supply")))
goto error;
#endif
if (!(test = udev_device_get_property_value(device, "POWER_SUPPLY_TYPE"))
|| (strcmp("Battery", test)))
goto error;
break;
case EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR:
#ifdef OLD_UDEV_RRRRRRRRRRRRRR
if ((!(test = udev_device_get_subsystem(device)))
|| (strcmp(test, "hwmon")))
goto error;
#endif /* have to do stuff up here since we need info from the parent */
if (!_walk_parents_test_attr(device, "temp1_input", NULL))
goto error;
/* if device is not the one which has the temp input, we must go up the chain */
if (!udev_device_get_sysattr_value(device, "temp1_input"))
{
for (parent = udev_device_get_parent(device); parent; parent = udev_device_get_parent(parent)) /*check for parent */
if (udev_device_get_sysattr_value(parent, "temp1_input"))
{
tmpdev = device;
if (!(device = _copy_device(parent)))
goto error;
udev_device_unref(tmpdev);
break;
}
}
break;
default:
break;
} }
if ((!(test = udev_device_get_action(device))) if ((!(test = udev_device_get_action(device)))
|| (!(ret = udev_device_get_syspath(device)))) || (!(ret = udev_device_get_syspath(device))))
goto error; goto error;
if (store->event) if (store->event)
@ -247,48 +261,49 @@ _get_syspath_from_watch(void *data, Ecore_Fd_Handler * fd_handler)
event |= EEZE_UDEV_EVENT_ADD; event |= EEZE_UDEV_EVENT_ADD;
} }
else else
if (!strcmp(test, "remove")) if (!strcmp(test, "remove"))
{ {
if ((store->event & EEZE_UDEV_EVENT_REMOVE) != if ((store->event & EEZE_UDEV_EVENT_REMOVE) !=
EEZE_UDEV_EVENT_REMOVE) EEZE_UDEV_EVENT_REMOVE)
goto error; goto error;
event |= EEZE_UDEV_EVENT_REMOVE; event |= EEZE_UDEV_EVENT_REMOVE;
} }
else else
if (!strcmp(test, "change")) if (!strcmp(test, "change"))
{ {
if ((store->event & EEZE_UDEV_EVENT_CHANGE) != if ((store->event & EEZE_UDEV_EVENT_CHANGE) !=
EEZE_UDEV_EVENT_CHANGE) EEZE_UDEV_EVENT_CHANGE)
goto error; goto error;
event |= EEZE_UDEV_EVENT_CHANGE; event |= EEZE_UDEV_EVENT_CHANGE;
} }
else else
if (!strcmp(test, "online")) if (!strcmp(test, "online"))
{ {
if ((store->event & EEZE_UDEV_EVENT_ONLINE) != if ((store->event & EEZE_UDEV_EVENT_ONLINE) !=
EEZE_UDEV_EVENT_ONLINE) EEZE_UDEV_EVENT_ONLINE)
goto error; goto error;
event |= EEZE_UDEV_EVENT_ONLINE; event |= EEZE_UDEV_EVENT_ONLINE;
} }
else else
{ {
if ((store->event & EEZE_UDEV_EVENT_OFFLINE) != if ((store->event & EEZE_UDEV_EVENT_OFFLINE) !=
EEZE_UDEV_EVENT_OFFLINE) EEZE_UDEV_EVENT_OFFLINE)
goto error; goto error;
event |= EEZE_UDEV_EVENT_OFFLINE; event |= EEZE_UDEV_EVENT_OFFLINE;
} }
} }
(*func)(eina_stringshare_add(ret), event, sdata, watch); (*func)(eina_stringshare_add(ret), event, sdata, watch);
error: error:
if (device) if (device)
udev_device_unref(device); udev_device_unref(device);
return EINA_TRUE; return EINA_TRUE;
} }
/** /**
* Add a watch for a device type * Add a watch for a device type
* *
@ -304,8 +319,10 @@ error:
* binary &. * binary &.
*/ */
EAPI Eeze_Udev_Watch * EAPI Eeze_Udev_Watch *
eeze_udev_watch_add(Eeze_Udev_Type type, int event, eeze_udev_watch_add(Eeze_Udev_Type type,
Eeze_Udev_Watch_Cb cb, void *user_data) int event,
Eeze_Udev_Watch_Cb cb,
void *user_data)
{ {
_udev_monitor *mon = NULL; _udev_monitor *mon = NULL;
int fd; int fd;
@ -326,42 +343,51 @@ eeze_udev_watch_add(Eeze_Udev_Type type, int event,
switch (type) switch (type)
{ {
case EEZE_UDEV_TYPE_KEYBOARD: case EEZE_UDEV_TYPE_KEYBOARD:
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL); udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL);
break; break;
case EEZE_UDEV_TYPE_MOUSE:
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL); case EEZE_UDEV_TYPE_MOUSE:
break; udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL);
case EEZE_UDEV_TYPE_TOUCHPAD: break;
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL);
break; case EEZE_UDEV_TYPE_TOUCHPAD:
case EEZE_UDEV_TYPE_DRIVE_MOUNTABLE: udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL);
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL); break;
break;
case EEZE_UDEV_TYPE_DRIVE_INTERNAL: case EEZE_UDEV_TYPE_DRIVE_MOUNTABLE:
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL); udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL);
break; break;
case EEZE_UDEV_TYPE_DRIVE_REMOVABLE:
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL); case EEZE_UDEV_TYPE_DRIVE_INTERNAL:
break; udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL);
case EEZE_UDEV_TYPE_DRIVE_CDROM: break;
udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL);
break; case EEZE_UDEV_TYPE_DRIVE_REMOVABLE:
case EEZE_UDEV_TYPE_POWER_AC: udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL);
case EEZE_UDEV_TYPE_POWER_BAT: break;
udev_monitor_filter_add_match_subsystem_devtype(mon, "power_supply",
NULL); case EEZE_UDEV_TYPE_DRIVE_CDROM:
break; udev_monitor_filter_add_match_subsystem_devtype(mon, "block", NULL);
case EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR: break;
udev_monitor_filter_add_match_subsystem_devtype(mon, "hwmon", NULL);
break; case EEZE_UDEV_TYPE_POWER_AC:
/* case EEZE_UDEV_TYPE_POWER_BAT:
case EEZE_UDEV_TYPE_ANDROID: udev_monitor_filter_add_match_subsystem_devtype(mon, "power_supply",
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", "usb_interface"); NULL);
break; break;
*/
default: case EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR:
break; udev_monitor_filter_add_match_subsystem_devtype(mon, "hwmon", NULL);
break;
/*
case EEZE_UDEV_TYPE_ANDROID:
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", "usb_interface");
break;
*/
default:
break;
} }
#endif #endif
@ -377,8 +403,8 @@ eeze_udev_watch_add(Eeze_Udev_Type type, int event,
store->watch = watch; store->watch = watch;
store->event = event; store->event = event;
if (!(handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ, if (!(handler = ecore_main_fd_handler_add(fd, ECORE_FD_READ,
_get_syspath_from_watch, store, NULL, NULL))) _get_syspath_from_watch, store, NULL, NULL)))
goto error; goto error;
watch->mon = mon; watch->mon = mon;
@ -404,7 +430,7 @@ error:
* Deletes a watch, closing file descriptors and freeing related udev memory. * Deletes a watch, closing file descriptors and freeing related udev memory.
*/ */
EAPI void * EAPI void *
eeze_udev_watch_del(Eeze_Udev_Watch * watch) eeze_udev_watch_del(Eeze_Udev_Watch *watch)
{ {
struct _store_data *sdata; struct _store_data *sdata;
void *ret = NULL; void *ret = NULL;