Fix broken service state change signal
[connman] / src / udev.c
index f5c2f30..d38abe6 100644 (file)
 
 #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
 
@@ -168,9 +168,14 @@ static void print_properties(struct udev_device *device, const char *prefix)
                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, "DEVNAME") == TRUE ||
-                                       g_str_equal(name, "DEVPATH") == 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)
                        connman_debug("%s%s = %s", prefix, name, value);
 
                entry = udev_list_entry_get_next(entry);
@@ -179,12 +184,26 @@ 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, *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, "    ");
 }