All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Valentin <eduardo.valentin@nokia.com>
To: "ext Hans Verkuil" <hverkuil@xs4all.nl>,
	"ext Mauro Carvalho Chehab" <mchehab@infradead.org>
Cc: "Nurkkala Eero.An (EXT-Offcode/Oulu)"
	<ext-Eero.Nurkkala@nokia.com>,
	"Aaltonen Matti.J (Nokia-D/Tampere)" <matti.j.aaltonen@nokia.com>,
	"ext Douglas Schilling Landgraf" <dougsland@gmail.com>,
	Linux-Media <linux-media@vger.kernel.org>,
	Eduardo Valentin <eduardo.valentin@nokia.com>
Subject: [PATCHv8  4/9] v4l2-ctl: Add support for FM TX controls
Date: Thu, 18 Jun 2009 16:55:46 +0300	[thread overview]
Message-ID: <1245333351-28157-5-git-send-email-eduardo.valentin@nokia.com> (raw)
In-Reply-To: <1245333351-28157-4-git-send-email-eduardo.valentin@nokia.com>

This patch adds simple support for FM TX extended controls
on v4l2-ctl utility.

Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
---
 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<struct v4l2_ext_control> 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<std::string, unsigned> 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]) {
-- 
1.6.2.GIT


  reply	other threads:[~2009-06-18 14:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-18 13:55 [PATCHv8 0/9] FM Transmitter (si4713) and another changes Eduardo Valentin
2009-06-18 13:55 ` [PATCHv8 1/9] v4l2-subdev.h: Add g_modulator callbacks to subdev api Eduardo Valentin
2009-06-18 13:55   ` [PATCHv8 2/9] v4l2: video device: Add V4L2_CTRL_CLASS_FM_TX controls Eduardo Valentin
2009-06-18 13:55     ` [PATCHv8 3/9] v4l2: video device: Add FM_TX controls default configurations Eduardo Valentin
2009-06-18 13:55       ` Eduardo Valentin [this message]
2009-06-18 13:55         ` [PATCHv8 5/9] v4l2-spec: Add documentation description for FM TX extended control class Eduardo Valentin
2009-06-18 13:55           ` [PATCHv8 6/9] FMTx: si4713: Add files to add radio interface for si4713 Eduardo Valentin
2009-06-18 13:55             ` [PATCHv8 7/9] FMTx: si4713: Add files to handle si4713 i2c device Eduardo Valentin
2009-06-18 13:55               ` [PATCHv8 8/9] FMTx: si4713: Add Kconfig and Makefile entries Eduardo Valentin
2009-06-18 13:55                 ` [PATCHv8 9/9] FMTx: si4713: Add document file Eduardo Valentin
2009-06-20 13:27               ` [PATCHv8 7/9] FMTx: si4713: Add files to handle si4713 i2c device Hans Verkuil
2009-06-20 14:01                 ` Eduardo Valentin

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=1245333351-28157-5-git-send-email-eduardo.valentin@nokia.com \
    --to=eduardo.valentin@nokia.com \
    --cc=dougsland@gmail.com \
    --cc=ext-Eero.Nurkkala@nokia.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=matti.j.aaltonen@nokia.com \
    --cc=mchehab@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.