public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] V4L: add "function" sysfs attribute to v4l devices
@ 2008-04-17  1:24 Kees Cook
  0 siblings, 0 replies; only message in thread
From: Kees Cook @ 2008-04-17  1:24 UTC (permalink / raw)
  To: video4linux-list; +Cc: Kay Sievers

Add "function" initializers to cpia, cx88, ivtv, and ov511.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Kees Cook <kees@outflux.net>
---
 cpia.c                |    1 +
 cx88/cx88-blackbird.c |    1 +
 cx88/cx88-video.c     |    3 +++
 ivtv/ivtv-streams.c   |   34 ++++++++++++++++++++++++++++++++++
 ov511.c               |    1 +
 5 files changed, 40 insertions(+)
---
diff -r 6aa6656852cb linux/drivers/media/video/cpia.c
--- a/linux/drivers/media/video/cpia.c	Wed Apr 16 13:13:15 2008 -0300
+++ b/linux/drivers/media/video/cpia.c	Wed Apr 16 17:53:13 2008 -0700
@@ -3804,6 +3804,7 @@ static struct video_device cpia_template
 	.owner		= THIS_MODULE,
 	.name		= "CPiA Camera",
 	.type		= VID_TYPE_CAPTURE,
+	.function	= V4L2_FN_VIDEO_CAP,
 	.fops           = &cpia_fops,
 };
 
diff -r 6aa6656852cb linux/drivers/media/video/cx88/cx88-blackbird.c
--- a/linux/drivers/media/video/cx88/cx88-blackbird.c	Wed Apr 16 13:13:15 2008 -0300
+++ b/linux/drivers/media/video/cx88/cx88-blackbird.c	Wed Apr 16 17:53:13 2008 -0700
@@ -1201,6 +1201,7 @@ static struct video_device cx8802_mpeg_t
 {
 	.name                 = "cx8802",
 	.type                 = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES|VID_TYPE_MPEG_ENCODER,
+	.function             = V4L2_FN_MPEG_CAP,
 	.fops                 = &mpeg_fops,
 	.minor                = -1,
 	.vidioc_querymenu     = vidioc_querymenu,
diff -r 6aa6656852cb linux/drivers/media/video/cx88/cx88-video.c
--- a/linux/drivers/media/video/cx88/cx88-video.c	Wed Apr 16 13:13:15 2008 -0300
+++ b/linux/drivers/media/video/cx88/cx88-video.c	Wed Apr 16 17:53:13 2008 -0700
@@ -1974,6 +1974,7 @@ static struct video_device cx8800_video_
 {
 	.name                 = "cx8800-video",
 	.type                 = VID_TYPE_CAPTURE|VID_TYPE_TUNER|VID_TYPE_SCALES,
+	.function             = V4L2_FN_MPEG_CAP,
 	.fops                 = &video_fops,
 	.minor                = -1,
 	.vidioc_querycap      = vidioc_querycap,
@@ -2028,6 +2029,7 @@ static struct video_device cx8800_radio_
 {
 	.name                 = "cx8800-radio",
 	.type                 = VID_TYPE_TUNER,
+	.function             = V4L2_FN_RADIO_CAP,
 	.fops                 = &radio_fops,
 	.minor                = -1,
 	.vidioc_querycap      = radio_querycap,
@@ -2120,6 +2122,7 @@ static int __devinit cx8800_initdev(stru
 		sizeof(cx8800_vbi_template) );
 	strcpy(cx8800_vbi_template.name,"cx8800-vbi");
 	cx8800_vbi_template.type = VID_TYPE_TELETEXT|VID_TYPE_TUNER;
+	cx8800_vbi_template.function = V4L2_FN_VBI_CAP;
 
 	/* initialize driver struct */
 #if 0
diff -r 6aa6656852cb linux/drivers/media/video/ivtv/ivtv-streams.c
--- a/linux/drivers/media/video/ivtv/ivtv-streams.c	Wed Apr 16 13:13:15 2008 -0300
+++ b/linux/drivers/media/video/ivtv/ivtv-streams.c	Wed Apr 16 17:53:13 2008 -0700
@@ -218,6 +218,40 @@ static int ivtv_prep_dev(struct ivtv *it
 	s->v4l2dev->dev = &itv->dev->dev;
 	s->v4l2dev->fops = ivtv_stream_info[type].fops;
 	s->v4l2dev->release = video_device_release;
+
+	/* Map ivtv stream type to v4l2 function type */
+	switch (s->type) {
+	case IVTV_ENC_STREAM_TYPE_MPG:
+		s->v4l2dev->function = V4L2_FN_MPEG_CAP;
+		break;
+	case IVTV_ENC_STREAM_TYPE_YUV:
+		s->v4l2dev->function = V4L2_FN_YUV_CAP;
+		break;
+	case IVTV_ENC_STREAM_TYPE_VBI:
+		s->v4l2dev->function = V4L2_FN_VBI_CAP;
+		break;
+	case IVTV_ENC_STREAM_TYPE_PCM:
+		s->v4l2dev->function = V4L2_FN_PCM_CAP;
+		break;
+	case IVTV_ENC_STREAM_TYPE_RAD:
+		s->v4l2dev->function = V4L2_FN_RADIO_CAP;
+		break;
+	case IVTV_DEC_STREAM_TYPE_MPG:
+		s->v4l2dev->function = V4L2_FN_MPEG_OUT;
+		break;
+	case IVTV_DEC_STREAM_TYPE_VBI:
+		s->v4l2dev->function = V4L2_FN_VBI_OUT;
+		break;
+	case IVTV_DEC_STREAM_TYPE_VOUT:
+		s->v4l2dev->function = V4L2_FN_VIDEO_OUT;
+		break;
+	case IVTV_DEC_STREAM_TYPE_YUV:
+		s->v4l2dev->function = V4L2_FN_YUV_OUT;
+		break;
+	default:
+		s->v4l2dev->function = V4L2_FN_UNDEFINED;
+		break;
+	}
 
 	return 0;
 }
diff -r 6aa6656852cb linux/drivers/media/video/ov511.c
--- a/linux/drivers/media/video/ov511.c	Wed Apr 16 13:13:15 2008 -0300
+++ b/linux/drivers/media/video/ov511.c	Wed Apr 16 17:53:13 2008 -0700
@@ -4674,6 +4674,7 @@ static struct video_device vdev_template
 	.owner =	THIS_MODULE,
 	.name =		"OV511 USB Camera",
 	.type =		VID_TYPE_CAPTURE,
+	.function =	V4L2_FN_VIDEO_CAP,
 	.fops =		&ov511_fops,
 	.release =	video_device_release,
 	.minor =	-1,


-- 
Kees Cook                                            @outflux.net

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-04-17  2:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-17  1:24 [PATCH 2/2] V4L: add "function" sysfs attribute to v4l devices Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox