diff options
-rw-r--r-- | gudev/gudevclient.c | 39 | ||||
-rw-r--r-- | gudev/gudevenumerator.c | 2 | ||||
-rw-r--r-- | gudev/gudevprivate.h | 2 |
3 files changed, 37 insertions, 6 deletions
diff --git a/gudev/gudevclient.c b/gudev/gudevclient.c index 587b57a..39a8040 100644 --- a/gudev/gudevclient.c +++ b/gudev/gudevclient.c @@ -524,9 +524,40 @@ g_udev_client_query_by_subsystem_and_name (GUdevClient *client, return device; } -struct udev * -_g_udev_client_get_udev (GUdevClient *client) +struct udev_enumerate * +_g_udev_client_new_enumerate (GUdevClient *client) { - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - return client->priv->udev; + struct udev_enumerate *enumerate; + + enumerate = udev_enumerate_new (client->priv->udev); + + if (client->priv->subsystems != NULL) + { + guint n; + for (n = 0; client->priv->subsystems[n] != NULL; n++) + { + gchar *subsystem; + gchar *devtype; + gchar *s; + + subsystem = g_strdup (client->priv->subsystems[n]); + devtype = NULL; + + s = strstr (subsystem, "/"); + if (s != NULL) + { + devtype = s + 1; + *s = '\0'; + } + + udev_enumerate_add_match_subsystem (enumerate, subsystem); + + if (devtype != NULL) + udev_enumerate_add_match_property (enumerate, "DEVTYPE", devtype); + + g_free (subsystem); + } + } + + return enumerate; } diff --git a/gudev/gudevenumerator.c b/gudev/gudevenumerator.c index e6cdc67..1c70049 100644 --- a/gudev/gudevenumerator.c +++ b/gudev/gudevenumerator.c @@ -124,7 +124,7 @@ g_udev_enumerator_constructed (GObject *object) g_assert (G_UDEV_IS_CLIENT (enumerator->priv->client)); - enumerator->priv->e = udev_enumerate_new (_g_udev_client_get_udev (enumerator->priv->client)); + enumerator->priv->e = _g_udev_client_new_enumerate (enumerator->priv->client); if (G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed != NULL) G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed (object); diff --git a/gudev/gudevprivate.h b/gudev/gudevprivate.h index 52e272b..1861d8d 100644 --- a/gudev/gudevprivate.h +++ b/gudev/gudevprivate.h @@ -33,7 +33,7 @@ G_BEGIN_DECLS GUdevDevice * _g_udev_device_new (struct udev_device *udevice); -struct udev *_g_udev_client_get_udev (GUdevClient *client); +struct udev_enumerate *_g_udev_client_new_enumerate (GUdevClient *client); G_END_DECLS |