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-compliance: test frequency band enumeration. Author: Hans Verkuil <[email protected]> Date: Fri Aug 3 14:49:49 2012 +0200 Signed-off-by: Hans Verkuil <[email protected]> (cherry picked from commit 98e51d4f9bd0378b7ff3fd814b83358e22f70a70) Signed-off-by: Gregor Jasny <[email protected]> utils/v4l2-compliance/v4l2-compliance.cpp | 6 ++- utils/v4l2-compliance/v4l2-test-buffers.cpp | 6 ++- utils/v4l2-compliance/v4l2-test-input-output.cpp | 38 ++++++++++++++++++++- 3 files changed, 44 insertions(+), 6 deletions(-) --- http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=b975d2b9649d5e42b26a28aff6a566de61254b49 diff --git a/utils/v4l2-compliance/v4l2-compliance.cpp b/utils/v4l2-compliance/v4l2-compliance.cpp index 66f2edb..9f9bdd7 100644 --- a/utils/v4l2-compliance/v4l2-compliance.cpp +++ b/utils/v4l2-compliance/v4l2-compliance.cpp @@ -513,11 +513,13 @@ int main(int argc, char **argv) node.has_outputs = true; if (node.caps & (V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VBI_CAPTURE | V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE | - V4L2_CAP_VIDEO_M2M | V4L2_CAP_SLICED_VBI_CAPTURE)) + V4L2_CAP_VIDEO_M2M | V4L2_CAP_SLICED_VBI_CAPTURE | + V4L2_CAP_RDS_CAPTURE)) node.can_capture = true; if (node.caps & (V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_VBI_OUTPUT | V4L2_CAP_VIDEO_OUTPUT_MPLANE | V4L2_CAP_VIDEO_M2M_MPLANE | - V4L2_CAP_VIDEO_M2M | V4L2_CAP_SLICED_VBI_OUTPUT)) + V4L2_CAP_VIDEO_M2M | V4L2_CAP_SLICED_VBI_OUTPUT | + V4L2_CAP_RDS_OUTPUT)) node.can_output = true; /* Information Opts */ diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp index 10f5163..e31e2fe 100644 --- a/utils/v4l2-compliance/v4l2-test-buffers.cpp +++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp @@ -151,8 +151,10 @@ int testReadWrite(struct node *node) ret = read(node->fd, &buf, 1); else ret = write(node->fd, &buf, 1); + // Note: RDS can only return multiples of 3, so we accept + // both 0 and 1 as return code. if (can_rw) - fail_on_test(ret != 1); + fail_on_test(ret != 0 && ret != 1); else fail_on_test(ret < 0 && errno != EINVAL); if (!can_rw) @@ -165,7 +167,7 @@ int testReadWrite(struct node *node) ret = read(node->fd, &buf, 1); else ret = write(node->fd, &buf, 1); - fail_on_test(ret != 1); + fail_on_test(ret != 0 && ret != 1); reopen(node); return 0; } diff --git a/utils/v4l2-compliance/v4l2-test-input-output.cpp b/utils/v4l2-compliance/v4l2-test-input-output.cpp index 657f34b..67c9ee3 100644 --- a/utils/v4l2-compliance/v4l2-test-input-output.cpp +++ b/utils/v4l2-compliance/v4l2-test-input-output.cpp @@ -33,6 +33,38 @@ #define MAGIC 0x1eadbeef +static int checkEnumFreqBands(struct node *node, __u32 tuner, __u32 type, __u32 caps) +{ + unsigned i; + __u32 caps_union = 0; + + for (i = 0; ; i++) { + struct v4l2_frequency_band band; + int ret; + + memset(band.reserved, 0, sizeof(band.reserved)); + band.tuner = tuner; + band.type = type; + band.index = i; + ret = doioctl(node, VIDIOC_ENUM_FREQ_BANDS, &band); + if (ret == EINVAL && i) + return 0; + if (ret) + return fail("couldn't get freq band\n"); + caps_union |= band.capability; + if ((caps & V4L2_TUNER_CAP_LOW) != (band.capability & V4L2_TUNER_CAP_LOW)) + return fail("Inconsistent CAP_LOW usage\n"); + fail_on_test(band.rangehigh < band.rangelow); + fail_on_test(band.index != i); + fail_on_test(band.type != type); + fail_on_test(band.tuner != tuner); + fail_on_test((band.capability & V4L2_TUNER_CAP_FREQ_BANDS) == 0); + check_0(band.reserved, sizeof(band.reserved)); + } + fail_on_test(caps_union != caps); + return 0; +} + static int checkTuner(struct node *node, const struct v4l2_tuner &tuner, unsigned t, v4l2_std_id std) { @@ -58,6 +90,7 @@ static int checkTuner(struct node *node, const struct v4l2_tuner &tuner, return fail("did not expect to see V4L2_TUNER_CAP_LOW set for a tv tuner\n"); if (!tv && !(tuner.capability & V4L2_TUNER_CAP_LOW)) return fail("V4L2_TUNER_CAP_LOW was not set for a radio tuner\n"); + fail_on_test(!(tuner.capability & V4L2_TUNER_CAP_FREQ_BANDS)); if (tuner.rangelow >= tuner.rangehigh) return fail("rangelow >= rangehigh\n"); if (tuner.rangelow == 0 || tuner.rangehigh == 0xffffffff) @@ -112,7 +145,7 @@ static int checkTuner(struct node *node, const struct v4l2_tuner &tuner, if (!valid_modes[tun.audmode]) return fail("accepted invalid audmode %d\n", audmode); } - return 0; + return checkEnumFreqBands(node, tuner.index, tuner.type, tuner.capability); } int testTuner(struct node *node) @@ -483,6 +516,7 @@ static int checkModulator(struct node *node, const struct v4l2_modulator &mod, u if (mod.capability & (V4L2_TUNER_CAP_NORM | V4L2_TUNER_CAP_LANG1 | V4L2_TUNER_CAP_LANG2)) return fail("TV capabilities for radio modulator?\n"); + fail_on_test(!(mod.capability & V4L2_TUNER_CAP_FREQ_BANDS)); if (mod.rangelow >= mod.rangehigh) return fail("rangelow >= rangehigh\n"); if (mod.rangelow == 0 || mod.rangehigh == 0xffffffff) @@ -507,7 +541,7 @@ static int checkModulator(struct node *node, const struct v4l2_modulator &mod, u if ((mod.capability & V4L2_TUNER_CAP_RDS) && !(node->caps & V4L2_CAP_READWRITE)) return fail("V4L2_TUNER_CAP_RDS set, but not V4L2_CAP_READWRITE\n"); - return 0; + return checkEnumFreqBands(node, mod.index, V4L2_TUNER_RADIO, mod.capability); } int testModulator(struct node *node) _______________________________________________ linuxtv-commits mailing list [email protected] http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
