[PATCH 1/1] v4l2-ctl: Add G_MODULATOR before set/get frequency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <eduardo.valentin@xxxxxxxxx>
---
 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)
-- 
1.6.2.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux