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 support for printing band info to G_TUNER / G_MODULATOR 
code
Author:  Hans de Goede <[email protected]>
Date:    Sun May 27 10:33:21 2012 +0200

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

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

 utils/v4l2-ctl/v4l2-ctl.cpp |   57 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)

---

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

diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index be371ef..42a8dd5 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -46,6 +46,8 @@
 #include <string>
 #include <algorithm>
 
+#define ARRAY_SIZE(arr) ((int)(sizeof(arr) / sizeof((arr)[0])))
+
 /* Short option list
 
    Please keep in alphabetical order.
@@ -1505,6 +1507,49 @@ static std::string txsubchans2s(int txsubchans)
        return s;
 }
 
+static const char *band_names[] = {
+       "default",
+       "fm-eur_us",
+       "fm-japan",
+       "fm-russian",
+       "fm-weather",
+       "am-mw",
+};
+
+static const char *band2s(unsigned band)
+{
+       if (band >= ARRAY_SIZE(band_names))
+               return "Unknown";
+
+       return band_names[band];
+}
+
+static int s2band(const char *s) {
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(band_names); i++) {
+               if (!strcmp(s, band_names[i]))
+                       return i;
+       }
+
+       return -1;
+}
+
+static std::string tcap2bands(unsigned cap) {
+       std::string s;
+       int i;
+
+       for (i = 1; i < ARRAY_SIZE(band_names); i++) {
+               if (cap & (V4L2_TUNER_CAP_BAND_FM_EUROPE_US << (i - 1))) {
+                       if (s.length())
+                               s += " ";
+                       s += band_names[i];
+               }
+       }
+
+       return s;
+}
+
 static std::string tcap2s(unsigned cap)
 {
        std::string s;
@@ -3937,6 +3982,12 @@ int main(int argc, char **argv)
                        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_BANDS_MASK) {
+                               printf("\tAvailable bands      : %s\n",
+                                       tcap2bands(vt.capability).c_str());
+                               printf("\tCurrent band         : %s\n",
+                                       band2s(vt.band));
+                       }
                        if (vt.capability & V4L2_TUNER_CAP_LOW)
                                printf("\tFrequency range      : %.1f MHz - 
%.1f MHz\n",
                                     vt.rangelow / 16000.0, vt.rangehigh / 
16000.0);
@@ -3959,6 +4010,12 @@ int main(int argc, char **argv)
                        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_BANDS_MASK) {
+                               printf("\tAvailable bands      : %s\n",
+                                       tcap2bands(mt.capability).c_str());
+                               printf("\tCurrent band         : %s\n",
+                                       band2s(mt.band));
+                       }
                        if (mt.capability & V4L2_TUNER_CAP_LOW)
                                printf("\tFrequency range      : %.1f MHz - 
%.1f MHz\n",
                                     mt.rangelow / 16000.0, mt.rangehigh / 
16000.0);

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

Reply via email to