+eeze_udev_syspath_get_devname, thanks to Clement Battin

SVN revision: 57854
This commit is contained in:
Mike Blumenkrantz 2011-03-18 17:10:50 +00:00
parent e2ca5e51f4
commit a02ceb683c
3 changed files with 32 additions and 0 deletions

View File

@ -1,3 +1,6 @@
2011-03-12 Mike Blumenkrantz (discomfitor/zmike)
+eeze_udev_syspath_get_devname, added from patch sent by Clement Battin
2011-03-12 Mike Blumenkrantz (discomfitor/zmike)
+EEZE_UDEV_TYPE_NET, added from patch sent by Clement Battin

View File

@ -205,6 +205,7 @@ typedef void(*Eeze_Udev_Watch_Cb)(const char *, Eeze_Udev_Event, void *, Eeze_Ud
EAPI const char *eeze_udev_syspath_get_parent(const char *syspath);
EAPI Eina_List *eeze_udev_syspath_get_parents(const char *syspath);
EAPI const char *eeze_udev_syspath_get_devpath(const char *syspath);
EAPI const char *eeze_udev_syspath_get_devname(const char *syspath);
EAPI const char *eeze_udev_syspath_get_subsystem(const char *syspath);
EAPI const char *eeze_udev_syspath_get_property(const char *syspath, const char *property);
EAPI const char *eeze_udev_syspath_get_sysattr(const char *syspath, const char *sysattr);

View File

@ -101,6 +101,34 @@ eeze_udev_syspath_get_devpath(const char *syspath)
return name;
}
/**
* Get the /dev/ name from the /sys/ path.
*
* @param syspath The /sys/ path with or without the /sys/
* @return A stringshared char* of the device name without the /dev/ path, or NULL on failure
*
* Takes /sys/$PATH and turns it into the corresponding /dev/x/"y".
*/
EAPI const char *
eeze_udev_syspath_get_devname(const char *syspath)
{
_udev_device *device;
const char *name = NULL;
if (!syspath)
return NULL;
if (!(device = _new_device(syspath)))
return NULL;
if (!(name = udev_device_get_sysname(device)))
return NULL;
name = eina_stringshare_add(name);
udev_device_unref(device);
return name;
}
/**
* Get the subsystem of a device from the /sys/ path.
*