--- hal-0.5.13.orig/hald/linux/device.c +++ hal-0.5.13/hald/linux/device.c @@ -4002,18 +4002,19 @@ d = NULL; - if (parent_dev == NULL || parent_path == NULL) - goto out; - d = hal_device_new (); hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path); - hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev)); hal_device_property_set_string (d, "info.category", "video4linux"); hal_device_add_capability (d, "video4linux"); hal_device_property_set_string (d, "info.product", "Multimedia Device"); hal_device_property_set_string (d, "video4linux.device", device_file); -out: + if (parent_dev == NULL || parent_path == NULL) { + hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer"); + } else { + hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev)); + } + return d; } @@ -4034,9 +4035,16 @@ video4linux_compute_udi (HalDevice *d) { gchar udi[256]; + const gchar *id; - hald_compute_udi (udi, sizeof (udi), "%s_video4linux", - hal_device_property_get_string (d, "info.parent")); + id = hal_util_get_last_element(hal_device_property_get_string(d, "info.parent")); + if (!strcmp(id, "computer")) { + hald_compute_udi (udi, sizeof (udi), "/org/freedesktop/Hal/devices/video4linux_virtual_%s", + hal_util_get_last_element(hal_device_property_get_string (d, "linux.sysfs_path"))); + } else { + hald_compute_udi (udi, sizeof (udi), "%s_video4linux", + hal_device_property_get_string (d, "info.parent")); + } hal_device_set_udi (d, udi); return TRUE;