#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
if (type == NULL || interface == NULL)
return;
- if (g_str_equal(interface, "ttyUSB0") == FALSE)
+ if (g_str_equal(interface, "ttyUSB0") == FALSE &&
+ g_str_equal(interface, "noz0") == FALSE)
return;
- if (g_str_equal(type, "huawei") == TRUE)
+ if (g_str_equal(type, "nozomi") == TRUE)
+ devtype = CONNMAN_DEVICE_TYPE_NOZOMI;
+ else if (g_str_equal(type, "huawei") == TRUE)
devtype = CONNMAN_DEVICE_TYPE_HUAWEI;
+ else if (g_str_equal(type, "novatel") == TRUE)
+ devtype = CONNMAN_DEVICE_TYPE_NOVATEL;
else
return;
const char *value = udev_list_entry_get_value(entry);
if (g_str_has_prefix(name, "CONNMAN") == TRUE ||
+ g_str_has_prefix(name, "RFKILL") == TRUE ||
+ g_str_has_prefix(name, "ID_MODEM") == TRUE ||
+ g_str_equal(name, "ID_VENDOR") == TRUE ||
+ g_str_equal(name, "ID_MODEL") == TRUE ||
+ g_str_equal(name, "INTERFACE") == TRUE ||
+ g_str_equal(name, "IFINDEX") == TRUE ||
g_str_equal(name, "DEVNAME") == TRUE ||
- g_str_equal(name, "DEVPATH") == TRUE)
+ g_str_equal(name, "DEVPATH") == TRUE)
connman_debug("%s%s = %s", prefix, name, value);
entry = udev_list_entry_get_next(entry);
static void print_device(struct udev_device *device, const char *action)
{
+ const char *subsystem, *devtype = NULL;
struct udev_device *parent;
connman_debug("=== %s ===", action);
print_properties(device, "");
- parent = udev_device_get_parent_with_devtype(device, "usb_device");
+ parent = udev_device_get_parent(device);
+ if (parent == NULL)
+ return;
+
+ subsystem = udev_device_get_subsystem(parent);
+
+ if (subsystem != NULL &&
+ g_str_equal(subsystem, "usb-serial") == TRUE) {
+ subsystem = "usb";
+ devtype = "usb_device";
+ }
+
+ parent = udev_device_get_parent_with_subsystem_devtype(device,
+ subsystem, devtype);
print_properties(parent, " ");
}