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)
#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
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, " ");
}