mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Németh Márton" <nm127@freemail.hu>
To: Laurent Pinchart <laurent.pinchart@skynet.be>,
	video4linux-list@redhat.com
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH]: uvcvideo: fill reserved fields with zero of VIDIOC_QUERYMENU
Date: Sat, 18 Apr 2009 16:59:20 +0200	[thread overview]
Message-ID: <49E9EAC8.9000706@freemail.hu> (raw)

When querying menu items with VIDIOC_QUERYMENU the reserved field
is not set to zero as required by V4L2 API revision 0.24 [1].
Add this fill.

The patch was tested with v4l-test 0.11 [2] with CNF7129 webcam found
on EeePC 901.

References:
[1] V4L2 API specification, revision 0.24
    http://v4l2spec.bytesex.org/spec/r13317.htm#V4L2-QUERYMENU

[2] v4l-test: Test environment for Video For Linux Two API
    http://v4l-test.sourceforge.net/

Signed-off-by: Márton Németh <nm127@freemail.hu>
---
--- linux-2.6.30-rc2/drivers/media/video/uvc/uvc_v4l2.c.orig	2009-04-17 18:31:29.000000000 +0200
+++ linux-2.6.30-rc2/drivers/media/video/uvc/uvc_v4l2.c	2009-04-18 16:43:20.000000000 +0200
@@ -46,6 +46,8 @@ static int uvc_v4l2_query_menu(struct uv
 	struct uvc_menu_info *menu_info;
 	struct uvc_control_mapping *mapping;
 	struct uvc_control *ctrl;
+	__u32 id;
+	__u32 index;

 	ctrl = uvc_find_control(video, query_menu->id, &mapping);
 	if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU)
@@ -54,6 +56,11 @@ static int uvc_v4l2_query_menu(struct uv
 	if (query_menu->index >= mapping->menu_count)
 		return -EINVAL;

+	id = query_menu->id;
+	index = query_menu->index;
+	memset(query_menu, 0, sizeof(*query_menu));
+	query_menu->id = id;
+	query_menu->index = index;
 	menu_info = &mapping->menu_info[query_menu->index];
 	strlcpy(query_menu->name, menu_info->name, sizeof query_menu->name);
 	return 0;

             reply	other threads:[~2009-04-18 15:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-18 14:59 Németh Márton [this message]
2009-04-20 17:59 ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49E9EAC8.9000706@freemail.hu \
    --to=nm127@freemail.hu \
    --cc=laurent.pinchart@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome