From: Marcel Holtmann Date: Sat, 3 Jan 2009 10:32:00 +0000 (+0100) Subject: Use udev_device_get_parent_with_subsystem_devtype() function X-Git-Tag: 0.6~18 X-Git-Url: http://git.maemo.org/git/?p=connman;a=commitdiff_plain;h=7821ba72b7eed428523c54db877397c0f6bdff57 Use udev_device_get_parent_with_subsystem_devtype() function --- diff --git a/configure.ac b/configure.ac index adee2fe..2a4900c 100644 --- a/configure.ac +++ b/configure.ac @@ -148,14 +148,15 @@ if (test "${enable_udev}" = "yes"); then AC_DEFINE(HAVE_UDEV, 1, [Define if udev support is available]) PKG_CHECK_MODULES(UDEV, libudev >= 129, enable_udev=yes, AC_MSG_ERROR(udev >= 129 is required)) - AC_CHECK_LIB(udev, udev_device_get_parent_with_devtype, dummy=yes, - AC_DEFINE(NEED_UDEV_DEVICE_GET_PARENT_WITH_DEVTYPE, 1, - [Define to 1 if you need the - udev_device_get_parent_with_devtype() function.])) AC_CHECK_LIB(udev, udev_enumerate_add_match_property, dummy=yes, AC_DEFINE(NEED_UDEV_ENUMERATE_ADD_MATCH_PROPERTY, 1, [Define to 1 if you need the udev_enumerate_add_match_property() function.])) + AC_CHECK_LIB(udev, udev_device_get_parent_with_subsystem_devtype, dummy=yes, + AC_DEFINE(NEED_UDEV_DEVICE_GET_PARENT_WITH_SUBSYSTEM_DEVTYPE, 1, + [Define to 1 if you need the + udev_device_get_parent_with_subsystem_devtype() + function.])) fi AC_SUBST(UDEV_CFLAGS) AC_SUBST(UDEV_LIBS) diff --git a/src/udev.c b/src/udev.c index f5c2f30..4ce3f4e 100644 --- a/src/udev.c +++ b/src/udev.c @@ -32,19 +32,19 @@ #include "connman.h" -#ifdef NEED_UDEV_DEVICE_GET_PARENT_WITH_DEVTYPE -static struct udev_device *udev_device_get_parent_with_devtype(struct udev_device *device, - const char *devtype) +#ifdef NEED_UDEV_ENUMERATE_ADD_MATCH_PROPERTY +static int udev_enumerate_add_match_property(struct udev_enumerate *enumerate, + const char *property, const char *value) { - return NULL; + return -EINVAL; } #endif -#ifdef NEED_UDEV_ENUMERATE_ADD_MATCH_PROPERTY -static int udev_enumerate_add_match_property(struct udev_enumerate *enumerate, - const char *property, const char *value) +#ifdef NEED_UDEV_DEVICE_GET_PARENT_WITH_SUBSYSTEM_DEVTYPE +static struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *device, + const char *subsystem, const char *devtype) { - return 0; + return NULL; } #endif @@ -179,12 +179,18 @@ static void print_properties(struct udev_device *device, const char *prefix) static void print_device(struct udev_device *device, const char *action) { + const char *subsystem = udev_device_get_subsystem(device); + const char *devtype = NULL; struct udev_device *parent; connman_debug("=== %s ===", action); print_properties(device, ""); - parent = udev_device_get_parent_with_devtype(device, "usb_device"); + if (subsystem != NULL && g_str_equal(subsystem, "usb") == TRUE) + devtype = "usb_device"; + + parent = udev_device_get_parent_with_subsystem_devtype(device, + subsystem, devtype); print_properties(parent, " "); }