From patchwork Fri Jul 24 16:42:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 1377 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Fri, 24 Jul 2009 16:53:03 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Fri, 24 Jul 2009 13:56:54 -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 1MUO10-000357-7D; Fri, 24 Jul 2009 16:53:03 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753576AbZGXQwx (ORCPT + 1 other); Fri, 24 Jul 2009 12:52:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753579AbZGXQww (ORCPT ); Fri, 24 Jul 2009 12:52:52 -0400 Received: from smtp.nokia.com ([192.100.122.230]:51931 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753571AbZGXQwu (ORCPT ); Fri, 24 Jul 2009 12:52:50 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n6OGqYen025361; Fri, 24 Jul 2009 19:52:35 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 24 Jul 2009 19:52:40 +0300 Received: from vaebe101.NOE.Nokia.com ([10.160.244.11]) by vaebh104.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 24 Jul 2009 19:52:39 +0300 Received: from localhost.localdomain ([172.21.41.99]) by vaebe101.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 24 Jul 2009 19:52:39 +0300 From: Eduardo Valentin To: "ext Hans Verkuil" , "ext Mauro Carvalho Chehab" Cc: "ext Douglas Schilling Landgraf" , "Nurkkala Eero.An (EXT-Offcode/Oulu)" , "Aaltonen Matti.J (Nokia-D/Tampere)" , Linux-Media , Eduardo Valentin Subject: [PATCH 1/1] v4l2-ctl: Add G_MODULATOR before set/get frequency Date: Fri, 24 Jul 2009 19:42:12 +0300 Message-Id: <1248453732-1966-1-git-send-email-eduardo.valentin@nokia.com> X-Mailer: git-send-email 1.6.2.GIT X-OriginalArrivalTime: 24 Jul 2009 16:52:39.0571 (UTC) FILETIME=[27730630:01CA0C7F] X-Nokia-AV: Clean Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org As there can be modulator devices with get/set frequency callbacks, this patch adds support to them in v4l2-ctl utility. Signed-off-by: Eduardo Valentin --- v4l2-apps/util/v4l2-ctl.cpp | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diff --git a/v4l2-apps/util/v4l2-ctl.cpp b/v4l2-apps/util/v4l2-ctl.cpp index fc9e459..ff74177 100644 --- a/v4l2-apps/util/v4l2-ctl.cpp +++ b/v4l2-apps/util/v4l2-ctl.cpp @@ -1962,12 +1962,16 @@ int main(int argc, char **argv) if (options[OptSetFreq]) { double fac = 16; + struct v4l2_modulator mt; + memset(&mt, 0, sizeof(struct v4l2_modulator)); if (doioctl(fd, VIDIOC_G_TUNER, &tuner, "VIDIOC_G_TUNER") == 0) { fac = (tuner.capability & V4L2_TUNER_CAP_LOW) ? 16000 : 16; + vf.type = tuner.type; + } else if (doioctl(fd, VIDIOC_G_MODULATOR, &mt, "VIDIOC_G_MODULATOR") == 0) { + fac = (mt.capability & V4L2_TUNER_CAP_LOW) ? 16000 : 16; } vf.tuner = 0; - vf.type = tuner.type; vf.frequency = __u32(freq * fac); if (doioctl(fd, VIDIOC_S_FREQUENCY, &vf, "VIDIOC_S_FREQUENCY") == 0) @@ -2418,9 +2422,13 @@ set_vid_fmt_error: if (options[OptGetFreq]) { double fac = 16; + struct v4l2_modulator mt; + memset(&mt, 0, sizeof(struct v4l2_modulator)); if (doioctl(fd, VIDIOC_G_TUNER, &tuner, "VIDIOC_G_TUNER") == 0) { fac = (tuner.capability & V4L2_TUNER_CAP_LOW) ? 16000 : 16; + } else if (doioctl(fd, VIDIOC_G_MODULATOR, &mt, "VIDIOC_G_MODULATOR") == 0) { + fac = (mt.capability & V4L2_TUNER_CAP_LOW) ? 16000 : 16; } vf.tuner = 0; if (doioctl(fd, VIDIOC_G_FREQUENCY, &vf, "VIDIOC_G_FREQUENCY") == 0)