[gnome-color-manager] Add detection support for connected video4linux devices



commit c0d0611ec9df439dd047a1aa23c9ac6e96acbecd
Author: Richard Hughes <richard hughsie com>
Date:   Fri Dec 4 08:58:19 2009 +0000

    Add detection support for connected video4linux devices

 src/gcm-client.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/gcm-client.c b/src/gcm-client.c
index a610156..143e534 100644
--- a/src/gcm-client.c
+++ b/src/gcm-client.c
@@ -304,7 +304,14 @@ gcm_client_gudev_add (GcmClient *client, GUdevDevice *udev_device)
 	/* only matches cameras with gphoto drivers */
 	value = g_udev_device_get_property (udev_device, "ID_GPHOTO2");
 	if (value != NULL) {
-		egg_debug ("found camera device: %s", g_udev_device_get_sysfs_path (udev_device));
+		egg_debug ("found gphoto camera device: %s", g_udev_device_get_sysfs_path (udev_device));
+		gcm_client_gudev_add_type (client, udev_device, GCM_DEVICE_TYPE_CAMERA);
+	}
+
+	/* only matches cameras with v4l devices */
+	value = g_udev_device_get_property (udev_device, "ID_V4L_PRODUCT");
+	if (value != NULL) {
+		egg_debug ("found v4l camera device: %s", g_udev_device_get_sysfs_path (udev_device));
 		gcm_client_gudev_add_type (client, udev_device, GCM_DEVICE_TYPE_CAMERA);
 	}
 }
@@ -339,6 +346,13 @@ gcm_client_add_connected_devices_usb (GcmClient *client, GError **error)
 		gcm_client_gudev_add (client, udev_device);
 	}
 
+	/* get all video4linux devices */
+	devices = g_udev_client_query_by_subsystem (priv->gudev_client, "video4linux");
+	for (l = devices; l != NULL; l = l->next) {
+		udev_device = l->data;
+		gcm_client_gudev_add (client, udev_device);
+	}
+
 	g_list_foreach (devices, (GFunc) g_object_unref, NULL);
 	g_list_free (devices);
 	return TRUE;
@@ -953,7 +967,7 @@ static void
 gcm_client_init (GcmClient *client)
 {
 	GError *error = NULL;
-	const gchar *subsystems[] = {"usb", NULL};
+	const gchar *subsystems[] = {"usb", "video4linux", NULL};
 
 	client->priv = GCM_CLIENT_GET_PRIVATE (client);
 	client->priv->display_name = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]