diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index 4f03617..a355114 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -7563,12 +7563,12 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
- video4linux.version (string)
+ video4linux.versions (list of string)
- Example: 2
+ Example: 1, 2
Yes
- The highest Video4Linux API version supported by the device.
+ The Video4Linux API versions supported by the device.
@@ -7789,6 +7789,12 @@ org.freedesktop.Hal.Device.Volume.method_signatures = {'ssas', 'as', 'as'}
2007-05-01
+
+ video4linux.version (string)
+ video4linux.versions
+ 2008-08-23
+ The new field allows separation between v4l2-only and v4l1-and-v4l2
+
diff --git a/hald/linux/probing/probe-video4linux.c b/hald/linux/probing/probe-video4linux.c
index ffc2f37..4dd02ba 100644
--- a/hald/linux/probing/probe-video4linux.c
+++ b/hald/linux/probing/probe-video4linux.c
@@ -55,6 +55,7 @@ main (int argc, char *argv[])
LibHalContext *ctx = NULL;
LibHalChangeSet *cset;
DBusError error;
+ int versions[2] = {0, 0};
setup_logger ();
@@ -81,6 +82,27 @@ main (int argc, char *argv[])
goto out;
}
+ if (ioctl (fd, VIDIOCGCAP, &v1cap) == 0) {
+ libhal_changeset_set_property_string (cset,
+ "video4linux.version", "1");
+
+ libhal_changeset_set_property_string (cset,
+ "info.product", v1cap.name);
+
+ if ((v1cap.type & VID_TYPE_CAPTURE) > 0)
+ libhal_device_add_capability (ctx, udi, "video4linux.video_capture", &error);
+ if ((v1cap.type & VID_TYPE_OVERLAY) > 0)
+ libhal_device_add_capability (ctx, udi, "video4linux.video_overlay", &error);
+ if (v1cap.audios > 0)
+ libhal_device_add_capability (ctx, udi, "video4linux.audio", &error);
+ if ((v1cap.type & VID_TYPE_TUNER) > 0)
+ libhal_device_add_capability (ctx, udi, "video4linux.tuner", &error);
+
+ versions[0] = 1;
+ } else {
+ HAL_DEBUG (("ioctl VIDIOCGCAP failed"));
+ }
+
if (ioctl (fd, VIDIOC_QUERYCAP, &v2cap) == 0) {
libhal_changeset_set_property_string (cset,
"video4linux.version", "2");
@@ -100,27 +122,28 @@ main (int argc, char *argv[])
libhal_device_add_capability (ctx, udi, "video4linux.tuner", &error);
if ((v2cap.capabilities & V4L2_CAP_RADIO) > 0)
libhal_device_add_capability (ctx, udi, "video4linux.radio", &error);
+
+ versions[1] = 1;
} else {
HAL_DEBUG (("ioctl VIDIOC_QUERYCAP failed"));
+ }
- if (ioctl (fd, VIDIOCGCAP, &v1cap) == 0) {
- libhal_changeset_set_property_string (cset,
- "video4linux.version", "1");
-
- libhal_changeset_set_property_string (cset,
- "info.product", v1cap.name);
-
- if ((v1cap.type & VID_TYPE_CAPTURE) > 0)
- libhal_device_add_capability (ctx, udi, "video4linux.video_capture", &error);
- if ((v1cap.type & VID_TYPE_OVERLAY) > 0)
- libhal_device_add_capability (ctx, udi, "video4linux.video_overlay", &error);
- if (v1cap.audios > 0)
- libhal_device_add_capability (ctx, udi, "video4linux.audio", &error);
- if ((v1cap.type & VID_TYPE_TUNER) > 0)
- libhal_device_add_capability (ctx, udi, "video4linux.tuner", &error);
- } else {
- HAL_DEBUG (("ioctl VIDIOCGCAP failed"));
- }
+ if (versions[0] && versions[1]) {
+ char const* versions[] = {"1", "2", NULL};
+ libhal_changeset_set_property_strlist (cset,
+ "video4linux.versions", versions);
+ } else if (versions[0]) {
+ char const* versions[] = {"1", NULL};
+ libhal_changeset_set_property_strlist (cset,
+ "video4linux.versions", versions);
+ } else if (versions[1]) {
+ char const* versions[] = {"2", NULL};
+ libhal_changeset_set_property_strlist (cset,
+ "video4linux.versions", versions);
+ } else {
+ char const* versions[] = {NULL};
+ libhal_changeset_set_property_strlist (cset,
+ "video4linux.versions", versions);
}
libhal_device_commit_changeset (ctx, cset, &error);