This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: v4l2-ctl: Add a --tuner-index cmdline option
Author:  Hans de Goede <[email protected]>
Date:    Sat May 26 13:10:02 2012 +0200

This allows doing a g_tuner, s_tuner, g_modulator, s_modulator, g_frequency,
s_frequency or s_hw_freq_seek operation on a different tuner/modulator
then the one with index 0.

Signed-off-by: Hans de Goede <[email protected]>
(cherry picked from commit fd5c9af446848786962fc65aa694e29b2e367372)

Signed-off-by: Gregor Jasny <[email protected]>

 utils/v4l2-ctl/v4l2-ctl.cpp |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=1d62006f376241fc35f910ac82698ff5b8da58f7

diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index cfc280f..d3d6b66 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -173,6 +173,7 @@ enum Option {
        OptTryEncoderCmd,
        OptDecoderCmd,
        OptTryDecoderCmd,
+       OptTunerIndex,
        OptLast = 256
 };
 
@@ -343,6 +344,7 @@ static struct option long_options[] = {
        {"try-encoder-cmd", required_argument, 0, OptTryEncoderCmd},
        {"decoder-cmd", required_argument, 0, OptDecoderCmd},
        {"try-decoder-cmd", required_argument, 0, OptTryDecoderCmd},
+       {"tuner-index", required_argument, 0, OptTunerIndex},
        {0, 0, 0, 0}
 };
 
@@ -391,6 +393,7 @@ static void usage(void)
               "  -t, --set-tuner=<mode>\n"
               "                     set the audio mode of the tuner 
[VIDIOC_S_TUNER]\n"
               "                     Possible values: mono, stereo, lang2, 
lang1, bilingual\n"
+              "  --tuner-index=<idx> Use idx as tuner idx for tuner/modulator 
commands\n"
               "  --list-formats     display supported video formats 
[VIDIOC_ENUM_FMT]\n"
               "  --list-formats-mplane\n"
               "                     display supported video multi-planar 
formats [VIDIOC_ENUM_FMT]\n"
@@ -2213,6 +2216,7 @@ int main(int argc, char **argv)
        int i;
 
        int fd = -1;
+       int tuner_index = 0;
 
        /* bitfield for fmts */
        unsigned int set_fmts = 0;
@@ -2867,6 +2871,9 @@ int main(int argc, char **argv)
                                }
                        }
                        break;
+               case OptTunerIndex:
+                       tuner_index = strtoul(optarg, NULL, 0);
+                       break;
                case ':':
                        fprintf(stderr, "Option `%s' requires a value\n",
                                argv[optind]);
@@ -2992,21 +2999,23 @@ int main(int argc, char **argv)
 
                if (capabilities & V4L2_CAP_MODULATOR) {
                        vf.type = V4L2_TUNER_RADIO;
+                       modulator.index = tuner_index;
                        if (doioctl(fd, VIDIOC_G_MODULATOR, &modulator) == 0) {
                                fac = (modulator.capability & 
V4L2_TUNER_CAP_LOW) ? 16000 : 16;
                        }
                } else {
                        vf.type = V4L2_TUNER_ANALOG_TV;
+                       tuner.index = tuner_index;
                        if (doioctl(fd, VIDIOC_G_TUNER, &tuner) == 0) {
                                fac = (tuner.capability & V4L2_TUNER_CAP_LOW) ? 
16000 : 16;
                                vf.type = tuner.type;
                        }
                }
-               vf.tuner = 0;
+               vf.tuner = tuner_index;
                vf.frequency = __u32(freq * fac);
                if (doioctl(fd, VIDIOC_S_FREQUENCY, &vf) == 0)
-                       printf("Frequency set to %d (%f MHz)\n", vf.frequency,
-                                       vf.frequency / fac);
+                       printf("Frequency for tuner %d set to %d (%f MHz)\n",
+                              vf.tuner, vf.frequency, vf.frequency / fac);
        }
 
        if (options[OptSetStandard]) {
@@ -3107,6 +3116,7 @@ int main(int argc, char **argv)
                struct v4l2_tuner vt;
 
                memset(&vt, 0, sizeof(struct v4l2_tuner));
+               vt.index = tuner_index;
                if (doioctl(fd, VIDIOC_G_TUNER, &vt) == 0) {
                        vt.audmode = mode;
                        doioctl(fd, VIDIOC_S_TUNER, &vt);
@@ -3117,6 +3127,7 @@ int main(int argc, char **argv)
                struct v4l2_modulator mt;
 
                memset(&mt, 0, sizeof(struct v4l2_modulator));
+               mt.index = tuner_index;
                if (doioctl(fd, VIDIOC_G_MODULATOR, &mt) == 0) {
                        mt.txsubchans = txsubchans;
                        doioctl(fd, VIDIOC_S_MODULATOR, &mt);
@@ -3411,6 +3422,7 @@ int main(int argc, char **argv)
        }
        
        if (options[OptFreqSeek]) {
+               freq_seek.tuner = tuner_index;
                freq_seek.type = V4L2_TUNER_RADIO;
                doioctl(fd, VIDIOC_S_HW_FREQ_SEEK, &freq_seek);
        }
@@ -3604,19 +3616,21 @@ int main(int argc, char **argv)
 
                if (capabilities & V4L2_CAP_MODULATOR) {
                        vf.type = V4L2_TUNER_RADIO;
+                       modulator.index = tuner_index;
                        if (doioctl(fd, VIDIOC_G_MODULATOR, &modulator) == 0)
                                fac = (modulator.capability & 
V4L2_TUNER_CAP_LOW) ? 16000 : 16;
                } else {
                        vf.type = V4L2_TUNER_ANALOG_TV;
+                       tuner.index = tuner_index;
                        if (doioctl(fd, VIDIOC_G_TUNER, &tuner) == 0) {
                                fac = (tuner.capability & V4L2_TUNER_CAP_LOW) ? 
16000 : 16;
                                vf.type = tuner.type;
                        }
                }
-               vf.tuner = 0;
+               vf.tuner = tuner_index;
                if (doioctl(fd, VIDIOC_G_FREQUENCY, &vf) == 0)
-                       printf("Frequency: %d (%f MHz)\n", vf.frequency,
-                                       vf.frequency / fac);
+                       printf("Frequency for tuner %d: %d (%f MHz)\n",
+                              vf.tuner, vf.frequency, vf.frequency / fac);
        }
 
        if (options[OptGetStandard]) {
@@ -3793,8 +3807,9 @@ int main(int argc, char **argv)
                struct v4l2_tuner vt;
 
                memset(&vt, 0, sizeof(struct v4l2_tuner));
+               vt.index = tuner_index;
                if (doioctl(fd, VIDIOC_G_TUNER, &vt) == 0) {
-                       printf("Tuner:\n");
+                       printf("Tuner %d:\n", vt.index);
                        printf("\tName                 : %s\n", vt.name);
                        printf("\tCapabilities         : %s\n", 
tcap2s(vt.capability).c_str());
                        if (vt.capability & V4L2_TUNER_CAP_LOW)
@@ -3814,8 +3829,9 @@ int main(int argc, char **argv)
                struct v4l2_modulator mt;
 
                memset(&mt, 0, sizeof(struct v4l2_modulator));
+               modulator.index = tuner_index;
                if (doioctl(fd, VIDIOC_G_MODULATOR, &mt) == 0) {
-                       printf("Modulator:\n");
+                       printf("Modulator %d:\n", modulator.index);
                        printf("\tName                 : %s\n", mt.name);
                        printf("\tCapabilities         : %s\n", 
tcap2s(mt.capability).c_str());
                        if (mt.capability & V4L2_TUNER_CAP_LOW)

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to