Add Meta: to Metadata devices
Subsystems (2)
v3 cover Add Meta: to Metadata devices
Metadata devices usually companion "real" devices. In order to distinguish them properly, add the Meta: prefix to their names.
Also, add a unique suffix to all the uvc devices, to multisensor cameras do not show the same names for all their devices (IR, RBG....).
v3:
- Add the meta logic to the core
v2: uvc: Restore old vdev name
Ricardo Ribalda (3):
media: v4l2-dev.c: Add Meta: to the name of metadata devices
media: Documentation/driver-api: Document device name
media: uvcvideo: Add a unique suffix to camera names
Documentation/driver-api/media/v4l2-dev.rst | 4 +++- drivers/media/usb/uvc/uvc_driver.c | 3 ++- drivers/media/v4l2-core/v4l2-dev.c | 9 +++++++++ 3 files changed, 14 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog
PATCH v3 1/3 media: v4l2-dev.c: Add Meta: to the name of metadata devices
Devices with Metadata output (like uvc), create two video devices, one for the data itself and another one for the metadata.
Add a "Meta: " to the beginning of the device name, as suggested by Mauro, to avoid having multiple devices with the same name.
Fixes v4l2-compliance:
Media Controller ioctls:
fail: v4l2-test-media.cpp(205): v2_entity_names_set.find(key) != v2_entity_names_set.end()
test MEDIA_IOC_G_TOPOLOGY: FAIL
fail: v4l2-test-media.cpp(394): num_data_links != num_linkstest MEDIA_IOC_ENUM_ENTITIES/LINKS: FAIL
--- drivers/media/v4l2-core/v4l2-dev.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/media/v4l2-core/v4l2-dev.c +9 -0
@@ -901,6 +901,15 @@ int __video_register_device(struct video_device *vdev,if (WARN_ON (type !=VFL_TYPE_SUBDEV && !vdev->device_caps))return -EINVAL ; +/* Add Meta: to metadata device names */ +if (vdev->device_caps & + (V4L2_CAP_META_CAPTURE |V4L2_CAP_META_OUTPUT )) { +char aux[sizeof (vdev->name)]; + +snprintf (aux,sizeof (aux),"Meta: %s" , vdev->name); +strscpy (vdev->name, aux,sizeof (aux)); + } +/* v4l2_fh support */ spin_lock_init (&vdev->fh_lock);INIT_LIST_HEAD (&vdev->fh_list);
Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog
PATCH v3 2/3 media: Documentation/driver-api: Document device name
In reply to Ricardo RibaldaDocument how the name of the metadata devices is modified.
--- Documentation/driver-api/media/v4l2-dev.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Documentation/driver-api/media/v4l2-dev.rst +3 -1
@@ -42,7 +42,9 @@ You should also set these fields of :c:type:`video_device`: - :c:type:`video_device`->v4l2_dev: must be set to the :c:type:`v4l2_device` parent device. -- :c:type:`video_device`->name: set to something descriptive and unique. +- :c:type:`video_device`->name: set to something descriptive and unique. If the + device has the `V4L2_CAP_META_CAPTURE` or `V4L2_CAP_META_OUTPUT` capabilities, + the string `Meta:` will be inserted before the original name. - :c:type:`video_device`->vfl_dir: set this to ``VFL_DIR_RX`` for capture devices (``VFL_DIR_RX`` has value 0, so this is normally already the
Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog
PATCH v3 3/3 media: uvcvideo: Add a unique suffix to camera names
In reply to Ricardo RibaldaSome cameras have multiple data inputs (i.e. IR sensor and RGB sensor), append a unique number to the device name.
Fixes v4l2-compliance:
Media Controller ioctls:
fail: v4l2-test-media.cpp(205): v2_entity_names_set.find(key) != v2_entity_names_set.end()
test MEDIA_IOC_G_TOPOLOGY: FAIL
fail: v4l2-test-media.cpp(394): num_data_links != num_links
test MEDIA_IOC_ENUM_ENTITIES/LINKS: FAIL
--- drivers/media/usb/uvc/uvc_driver.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/usb/uvc/uvc_driver.c +2 -1
@@ -2232,7 +2232,8 @@ int uvc_register_video_device(struct uvc_device *dev,break ; } -strscpy (vdev->name, dev->name,sizeof (vdev->name)); +snprintf (vdev->name,sizeof (vdev->name),"%s %u" , dev->name, + stream->header.bTerminalLink);/* * Set the driver data before calling video_register_device, otherwise
Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog