From patchwork Mon Jan 20 12:45:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 3512341 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C04669F2D6 for ; Mon, 20 Jan 2014 12:46:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A83B820108 for ; Mon, 20 Jan 2014 12:46:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 124812013D for ; Mon, 20 Jan 2014 12:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752484AbaATMqo (ORCPT ); Mon, 20 Jan 2014 07:46:44 -0500 Received: from smtp-vbr4.xs4all.nl ([194.109.24.24]:3605 "EHLO smtp-vbr4.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751891AbaATMql (ORCPT ); Mon, 20 Jan 2014 07:46:41 -0500 Received: from tschai.lan (173-38-208-170.cisco.com [173.38.208.170]) (authenticated bits=0) by smtp-vbr4.xs4all.nl (8.13.8/8.13.8) with ESMTP id s0KCkQAv076923; Mon, 20 Jan 2014 13:46:27 +0100 (CET) (envelope-from hverkuil@xs4all.nl) Received: from tschai.cisco.com (localhost [127.0.0.1]) by tschai.lan (Postfix) with ESMTPSA id 46D432A00A5; Mon, 20 Jan 2014 13:46:16 +0100 (CET) From: Hans Verkuil To: linux-media@vger.kernel.org Cc: m.chehab@samsung.com, laurent.pinchart@ideasonboard.com, t.stanislaws@samsung.com, Hans Verkuil Subject: [RFCv2 PATCH 04/21] videodev2.h: add initial support for complex controls. Date: Mon, 20 Jan 2014 13:45:57 +0100 Message-Id: <1390221974-28194-5-git-send-email-hverkuil@xs4all.nl> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1390221974-28194-1-git-send-email-hverkuil@xs4all.nl> References: <1390221974-28194-1-git-send-email-hverkuil@xs4all.nl> X-Virus-Scanned: by XS4ALL Virus Scanner Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil Complex controls are controls that can be used for compound and array types. This allows for more complex datastructures to be used with the control framework. Such controls always have the V4L2_CTRL_FLAG_HIDDEN flag set. Note that 'simple' controls can also set that flag. The existing V4L2_CTRL_FLAG_NEXT_CTRL flag will only enumerate controls that do not have the HIDDEN flag, so a new V4L2_CTRL_FLAG_NEXT_HIDDEN flag is added to enumerate hidden controls. Set both flags to enumerate any controls (hidden or not). Complex control types will start at V4L2_CTRL_COMPLEX_TYPES. In addition, any control that uses the new 'p' field or the existing 'string' field will have flag V4L2_CTRL_FLAG_IS_PTR set. While not strictly necessary, adding that flag makes life for applications a lot simpler. If the flag is not set, then the control value is set through the value or value64 fields of struct v4l2_ext_control, otherwise a pointer points to the value. Signed-off-by: Hans Verkuil Reviewed-by: Sylwester Nawrocki --- include/uapi/linux/videodev2.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 6ae7bbe..4d7782a 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1228,6 +1228,7 @@ struct v4l2_ext_control { __s32 value; __s64 value64; char *string; + void *p; }; } __attribute__ ((packed)); @@ -1252,7 +1253,10 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_CTRL_CLASS = 6, V4L2_CTRL_TYPE_STRING = 7, V4L2_CTRL_TYPE_BITMASK = 8, - V4L2_CTRL_TYPE_INTEGER_MENU = 9, + V4L2_CTRL_TYPE_INTEGER_MENU = 9, + + /* Complex types are >= 0x0100 */ + V4L2_CTRL_COMPLEX_TYPES = 0x0100, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ @@ -1288,9 +1292,12 @@ struct v4l2_querymenu { #define V4L2_CTRL_FLAG_SLIDER 0x0020 #define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 #define V4L2_CTRL_FLAG_VOLATILE 0x0080 +#define V4L2_CTRL_FLAG_HIDDEN 0x0100 +#define V4L2_CTRL_FLAG_IS_PTR 0x0200 -/* Query flag, to be ORed with the control ID */ +/* Query flags, to be ORed with the control ID */ #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 +#define V4L2_CTRL_FLAG_NEXT_HIDDEN 0x40000000 /* User-class control IDs defined by V4L2 */ #define V4L2_CID_MAX_CTRLS 1024