forked from enlightenment/efl
+eeze_udev_syspath_get_devname, thanks to Clement Battin
SVN revision: 57854
This commit is contained in:
parent
e2ca5e51f4
commit
a02ceb683c
|
@ -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
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue