[Pchdtv] [PATCH] cx88-atsc.c add VIDIOC_ENUMINPUT

Aran Cox spin667 at mchsi.com
Thu Mar 24 20:11:34 PST 2005


I couldn't get mythtv-0.17 to change channels properly, because it
wants to run VIDIOC_ENUMINPUT and cx88-atsc doesn't implement that.
If it can't ENUMINPUT, it never gets around to trying to change the
channel, it just records whatever you might have left it tuned to, if
anything.  I'm aware that there is a DVB driver and that I could have
used that.  Also, you might argue it's myth that should change, not
the driver but it was just too easy to add this ioctl.  Easier I
thought than modifying mythtv anyway.  

This patch is tiny, and applies against the pcHDTV-2.0 release or
what's in the freedesktop.org CVS repo.   However, I don't know
anything about linux driver writing or v4l really so I could have made
a mistake in this.

Anyway, I thought perhaps someone might find it useful.

Aran
-------------- next part --------------
--- pchdtv-drivers-working/cx88-atsc.c	2005-03-02 00:56:52.000000000 -0600
+++ pchdtv-drivers/cx88-atsc.c	2005-03-24 21:28:06.000000000 -0600
@@ -467,7 +467,22 @@
 	}
 	/* ------ input switching ---------- */
 	case VIDIOC_ENUMINPUT:
-		return -ENOIOCTLCMD;
+	{
+		static const char *inname = "Television";
+		struct v4l2_input *i = arg;
+		unsigned int n;
+
+		n = i->index;
+		if (n > 0)
+			return -EINVAL;
+		memset(i,0,sizeof(*i));
+		i->index = n;
+		strcpy(i->name,inname);
+		i->type = V4L2_INPUT_TYPE_TUNER;
+		for (n = 0; n < ARRAY_SIZE(dtvnorms); n++)
+			i->std |= dtvnorms[n].id;
+		return 0;
+	}
 	case VIDIOC_G_INPUT:
 	{
 		unsigned int *i = arg;


More information about the Pchdtv mailing list