This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 configure.ac |    9 +++++----
 src/udev.c   |   24 +++++++++++++++---------
 2 files changed, 20 insertions(+), 13 deletions(-)

New commits:
commit 7821ba72b7eed428523c54db877397c0f6bdff57
Author: Marcel Holtmann <[email protected]>
Date:   Sat Jan 3 11:32:00 2009 +0100

    Use udev_device_get_parent_with_subsystem_devtype() function


Diff in this email is a maximum of 400 lines.
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, "    ");
 }
 
_______________________________________________
Commits mailing list
[email protected]
https://lists.moblin.org/mailman/listinfo/commits

Reply via email to