Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 657f2271 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[media] v4l: fix handling of v4l2_input.capabilities



The v4l core sets the v4l2_input.capabilities field based on the supplied
v4l2_ioctl_ops. However, several drivers do a memset or memcpy of the v4l2_input
struct, thus overwriting that field incorrectly.

Either remove the memset (which is already done by the v4l core), or add the
proper capabilities field in case of a memcpy.

The same is also true for v4l2_output, but that only affected the ivtv driver.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 3ea2b673
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ static struct v4l2_input inputs[4] = {
		.tuner		= 0, /* ignored */
		.std		= V4L2_STD_PAL_BG|V4L2_STD_NTSC_M,
		.status		= 0,
		.capabilities	= V4L2_IN_CAP_STD,
	}, {
		.index		= 1,
		.name		= "Television",
@@ -108,6 +109,7 @@ static struct v4l2_input inputs[4] = {
		.tuner		= 0,
		.std		= V4L2_STD_PAL_BG|V4L2_STD_NTSC_M,
		.status		= 0,
		.capabilities	= V4L2_IN_CAP_STD,
	}, {
		.index		= 2,
		.name		= "Video",
@@ -116,6 +118,7 @@ static struct v4l2_input inputs[4] = {
		.tuner		= 0,
		.std		= V4L2_STD_PAL_BG|V4L2_STD_NTSC_M,
		.status		= 0,
		.capabilities	= V4L2_IN_CAP_STD,
	}, {
		.index		= 3,
		.name		= "Y/C",
@@ -124,6 +127,7 @@ static struct v4l2_input inputs[4] = {
		.tuner		= 0,
		.std		= V4L2_STD_PAL_BG|V4L2_STD_NTSC_M,
		.status		= 0,
		.capabilities	= V4L2_IN_CAP_STD,
	}
};

+4 −2
Original line number Diff line number Diff line
@@ -1406,8 +1406,10 @@ static int budget_av_detach(struct saa7146_dev *dev)

#define KNC1_INPUTS 2
static struct v4l2_input knc1_inputs[KNC1_INPUTS] = {
	{0, "Composite", V4L2_INPUT_TYPE_TUNER, 1, 0, V4L2_STD_PAL_BG | V4L2_STD_NTSC_M, 0},
	{1, "S-Video", V4L2_INPUT_TYPE_CAMERA, 2, 0, V4L2_STD_PAL_BG | V4L2_STD_NTSC_M, 0},
	{ 0, "Composite", V4L2_INPUT_TYPE_TUNER, 1, 0,
		V4L2_STD_PAL_BG | V4L2_STD_NTSC_M, 0, V4L2_IN_CAP_STD },
	{ 1, "S-Video", V4L2_INPUT_TYPE_CAMERA, 2, 0,
		V4L2_STD_PAL_BG | V4L2_STD_NTSC_M, 0, V4L2_IN_CAP_STD },
};

static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i)
+0 −1
Original line number Diff line number Diff line
@@ -546,7 +546,6 @@ int cx18_get_input(struct cx18 *cx, u16 index, struct v4l2_input *input)
		"Component 1"
	};

	memset(input, 0, sizeof(*input));
	if (index >= cx->nof_inputs)
		return -EINVAL;
	input->index = index;
+0 −1
Original line number Diff line number Diff line
@@ -1126,7 +1126,6 @@ static int cx23885_enum_input(struct cx23885_dev *dev, struct v4l2_input *i)
	if (0 == INPUT(n)->type)
		return -EINVAL;

	memset(i, 0, sizeof(*i));
	i->index = n;
	i->type  = V4L2_INPUT_TYPE_CAMERA;
	strcpy(i->name, iname[INPUT(n)->type]);
+1 −0
Original line number Diff line number Diff line
@@ -1610,6 +1610,7 @@ et61x251_vidioc_enuminput(struct et61x251_device* cam, void __user * arg)
	memset(&i, 0, sizeof(i));
	strcpy(i.name, "Camera");
	i.type = V4L2_INPUT_TYPE_CAMERA;
	i.capabilities = V4L2_IN_CAP_STD;

	if (copy_to_user(arg, &i, sizeof(i)))
		return -EFAULT;
Loading