Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] uvcvideo: Mark first output terminal as default video node

The MEDIA_ENT_FL_DEFAULT identifies entities that are considered as
default for their group and type. For video nodes, it identifies the
node that application should use by default.
UVC devices don't report which output terminal should be considered as
the default, use the first one. Most devices have a single output
terminal anyway.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
8be8ec6e 0550513c

+8
+2
drivers/media/usb/uvc/uvc_driver.c
··· 1564 1564 chain->dev = dev; 1565 1565 v4l2_prio_init(&chain->prio); 1566 1566 1567 + term->flags |= UVC_ENTITY_FLAG_DEFAULT; 1568 + 1567 1569 if (uvc_scan_chain(chain, term) < 0) { 1568 1570 kfree(chain); 1569 1571 continue;
+2
drivers/media/usb/uvc/uvc_entity.c
··· 93 93 } else if (entity->vdev != NULL) { 94 94 ret = media_entity_init(&entity->vdev->entity, 95 95 entity->num_pads, entity->pads, 0); 96 + if (entity->flags & UVC_ENTITY_FLAG_DEFAULT) 97 + entity->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT; 96 98 } else 97 99 ret = 0; 98 100
+4
drivers/media/usb/uvc/uvcvideo.h
··· 225 225 * always be accessed with the UVC_ENTITY_* macros and never directly. 226 226 */ 227 227 228 + #define UVC_ENTITY_FLAG_DEFAULT (1 << 0) 229 + 228 230 struct uvc_entity { 229 231 struct list_head list; /* Entity as part of a UVC device. */ 230 232 struct list_head chain; /* Entity as part of a video device 231 233 * chain. */ 234 + unsigned int flags; 235 + 232 236 __u8 id; 233 237 __u16 type; 234 238 char name[64];