Skip to content

Commit f4037b9

Browse files
ribaldagregkh
authored andcommitted
media: uvcvideo: Set unique vdev name based in type
[ Upstream commit e3f60e7 ] All the entities must have a unique name. We can have a descriptive and unique name by appending the function and the entity->id. This is even resilent to multi chain devices. 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 Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d934941 commit f4037b9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎drivers/media/usb/uvc/uvc_driver.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2065,6 +2065,7 @@ int uvc_register_video_device(struct uvc_device *dev,
20652065
const struct v4l2_file_operations *fops,
20662066
const struct v4l2_ioctl_ops *ioctl_ops)
20672067
{
2068+
const char *name;
20682069
int ret;
20692070

20702071
/* Initialize the video buffers queue. */
@@ -2093,16 +2094,20 @@ int uvc_register_video_device(struct uvc_device *dev,
20932094
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
20942095
default:
20952096
vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING;
2097+
name = "Video Capture";
20962098
break;
20972099
case V4L2_BUF_TYPE_VIDEO_OUTPUT:
20982100
vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
2101+
name = "Video Output";
20992102
break;
21002103
case V4L2_BUF_TYPE_META_CAPTURE:
21012104
vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING;
2105+
name = "Metadata";
21022106
break;
21032107
}
21042108

2105-
strscpy(vdev->name, dev->name, sizeof(vdev->name));
2109+
snprintf(vdev->name, sizeof(vdev->name), "%s %u", name,
2110+
stream->header.bTerminalLink);
21062111

21072112
/*
21082113
* Set the driver data before calling video_register_device, otherwise

0 commit comments

Comments
 (0)