From patchwork Thu Jun 18 13:55:46 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 1243 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Thu, 18 Jun 2009 14:04:24 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Thu, 18 Jun 2009 11:06:04 -0300 (BRT) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1MHIE4-0000Uw-4y; Thu, 18 Jun 2009 14:04:24 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759972AbZFROEL (ORCPT + 1 other); Thu, 18 Jun 2009 10:04:11 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759658AbZFROEK (ORCPT ); Thu, 18 Jun 2009 10:04:10 -0400 Received: from smtp.nokia.com ([192.100.105.134]:37878 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759972AbZFROED (ORCPT ); Thu, 18 Jun 2009 10:04:03 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n5IE1Ybe017518; Thu, 18 Jun 2009 09:03:41 -0500 Received: from vaebh102.NOE.Nokia.com ([10.160.244.23]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Jun 2009 17:03:27 +0300 Received: from vaebe101.NOE.Nokia.com ([10.160.244.11]) by vaebh102.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Jun 2009 17:03:23 +0300 Received: from localhost.localdomain ([172.21.41.99]) by vaebe101.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 18 Jun 2009 17:03:23 +0300 From: Eduardo Valentin To: "ext Hans Verkuil" , "ext Mauro Carvalho Chehab" Cc: "Nurkkala Eero.An (EXT-Offcode/Oulu)" , "Aaltonen Matti.J (Nokia-D/Tampere)" , "ext Douglas Schilling Landgraf" , Linux-Media , Eduardo Valentin Subject: [PATCHv8 4/9] v4l2-ctl: Add support for FM TX controls Date: Thu, 18 Jun 2009 16:55:46 +0300 Message-Id: <1245333351-28157-5-git-send-email-eduardo.valentin@nokia.com> X-Mailer: git-send-email 1.6.2.GIT In-Reply-To: <1245333351-28157-4-git-send-email-eduardo.valentin@nokia.com> References: <1245333351-28157-1-git-send-email-eduardo.valentin@nokia.com> <1245333351-28157-2-git-send-email-eduardo.valentin@nokia.com> <1245333351-28157-3-git-send-email-eduardo.valentin@nokia.com> <1245333351-28157-4-git-send-email-eduardo.valentin@nokia.com> X-OriginalArrivalTime: 18 Jun 2009 14:03:23.0437 (UTC) FILETIME=[8B0CF5D0:01C9F01D] X-Nokia-AV: Clean Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch adds simple support for FM TX extended controls on v4l2-ctl utility. Signed-off-by: Eduardo Valentin --- v4l2-apps/util/v4l2-ctl.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/v4l2-apps/util/v4l2-ctl.cpp b/v4l2-apps/util/v4l2-ctl.cpp index 2c7290f..45a2310 100644 --- a/v4l2-apps/util/v4l2-ctl.cpp +++ b/v4l2-apps/util/v4l2-ctl.cpp @@ -148,6 +148,7 @@ typedef std::vector ctrl_list; static ctrl_list user_ctrls; static ctrl_list mpeg_ctrls; static ctrl_list camera_ctrls; +static ctrl_list fm_tx_ctrls; typedef std::map ctrl_strmap; static ctrl_strmap ctrl_str2id; @@ -2166,6 +2167,8 @@ set_vid_fmt_error: mpeg_ctrls.push_back(ctrl); else if (V4L2_CTRL_ID2CLASS(ctrl.id) == V4L2_CTRL_CLASS_CAMERA) camera_ctrls.push_back(ctrl); + else if (V4L2_CTRL_ID2CLASS(ctrl.id) == V4L2_CTRL_CLASS_FM_TX) + fm_tx_ctrls.push_back(ctrl); else user_ctrls.push_back(ctrl); } @@ -2212,6 +2215,22 @@ set_vid_fmt_error: } } } + if (fm_tx_ctrls.size()) { + ctrls.ctrl_class = V4L2_CTRL_CLASS_FM_TX; + ctrls.count = fm_tx_ctrls.size(); + ctrls.controls = &fm_tx_ctrls[0]; + if (doioctl(fd, VIDIOC_S_EXT_CTRLS, &ctrls, "VIDIOC_S_EXT_CTRLS")) { + if (ctrls.error_idx >= ctrls.count) { + fprintf(stderr, "Error setting FM Modulator controls: %s\n", + strerror(errno)); + } + else { + fprintf(stderr, "%s: %s\n", + ctrl_id2str[fm_tx_ctrls[ctrls.error_idx].id].c_str(), + strerror(errno)); + } + } + } } /* Get options */ @@ -2429,6 +2448,7 @@ set_vid_fmt_error: mpeg_ctrls.clear(); camera_ctrls.clear(); user_ctrls.clear(); + fm_tx_ctrls.clear(); for (ctrl_get_list::iterator iter = get_ctrls.begin(); iter != get_ctrls.end(); ++iter) { struct v4l2_ext_control ctrl = { 0 }; @@ -2443,6 +2463,8 @@ set_vid_fmt_error: mpeg_ctrls.push_back(ctrl); else if (V4L2_CTRL_ID2CLASS(ctrl.id) == V4L2_CTRL_CLASS_CAMERA) camera_ctrls.push_back(ctrl); + else if (V4L2_CTRL_ID2CLASS(ctrl.id) == V4L2_CTRL_CLASS_FM_TX) + fm_tx_ctrls.push_back(ctrl); else user_ctrls.push_back(ctrl); } @@ -2481,6 +2503,20 @@ set_vid_fmt_error: printf("%s: %d\n", ctrl_id2str[ctrl.id].c_str(), ctrl.value); } } + if (fm_tx_ctrls.size()) { + ctrls.ctrl_class = V4L2_CTRL_CLASS_FM_TX; + ctrls.count = fm_tx_ctrls.size(); + ctrls.controls = &fm_tx_ctrls[0]; + doioctl(fd, VIDIOC_G_EXT_CTRLS, &ctrls, "VIDIOC_G_EXT_CTRLS"); + for (unsigned i = 0; i < fm_tx_ctrls.size(); i++) { + struct v4l2_ext_control ctrl = fm_tx_ctrls[i]; + + if (ctrl_id2type[ctrl.id] == V4L2_CTRL_TYPE_STRING) + printf("%s: '%s'\n", ctrl_id2str[ctrl.id].c_str(), ctrl.string); + else + printf("%s: %d\n", ctrl_id2str[ctrl.id].c_str(), ctrl.value); + } + } } if (options[OptGetTuner]) {