[PATCH 2/2] tests: Check decoding of VIDIOC_G/S_TUNER's arg
Edgar Kaziahmedov
edos at linux.com
Sun Apr 23 01:53:48 UTC 2017
* tests/ioctl_v4l2.c (main): Add checks for VIDIOC_G/S_TUNER's arg.
Signed-off-by: Edgar Kaziahmedov <edos at linux.com>
---
tests/ioctl_v4l2.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/tests/ioctl_v4l2.c b/tests/ioctl_v4l2.c
index 81daf2e5..87676fc5 100644
--- a/tests/ioctl_v4l2.c
+++ b/tests/ioctl_v4l2.c
@@ -673,6 +673,43 @@ main(void )
", value=%d}) = -1 EBADF (%m)\n",
p_v4l2_control->id, p_v4l2_control->value);
+ /* VIDIOC_G_TUNER */
+ ioctl(-1, VIDIOC_G_TUNER, 0);
+ printf("ioctl(-1, VIDIOC_G_TUNER, NULL) = -1 EBADF (%m)\n");
+
+ struct v4l2_tuner *const p_v4l2_tuner =
+ page + size - sizeof(*p_v4l2_tuner);
+ ioctl(-1, VIDIOC_G_TUNER, p_v4l2_tuner);
+ printf("ioctl(-1, VIDIOC_G_TUNER, {index=%u})"
+ " = -1 EBADF (%m)\n", p_v4l2_tuner->index);
+
+ /* VIDIOC_S_TUNER */
+ ioctl(-1, VIDIOC_S_TUNER, 0);
+ printf("ioctl(-1, VIDIOC_S_TUNER, NULL) = -1 EBADF (%m)\n");
+
+ struct v4l2_tuner *const p_tuner =
+ tail_alloc(sizeof(*p_tuner));
+ p_tuner->index = 0x4fb6df39;
+ strcpy((char*)p_tuner->name, "cum tacent clamant");
+ p_tuner->type = V4L2_TUNER_RADIO;
+ p_tuner->capability = V4L2_TUNER_CAP_LOW;
+ p_tuner->rangelow = 0xa673bc29;
+ p_tuner->rangehigh = 0xbaf16d12;
+ p_tuner->rxsubchans = V4L2_TUNER_SUB_MONO;
+ p_tuner->audmode = V4L2_TUNER_MODE_MONO;
+ p_tuner->signal = 0x10bf92c8;
+ p_tuner->afc = 0x3bf7e18b;
+ ioctl(-1, VIDIOC_S_TUNER, p_tuner);
+ printf("ioctl(-1, VIDIOC_S_TUNER, {index=%u"
+ ", name=\"cum tacent clamant\""
+ ", type=V4L2_TUNER_RADIO, capability=V4L2_TUNER_CAP_LOW"
+ ", rangelow=%u, rangehigh=%u"
+ ", rxsubchans=V4L2_TUNER_SUB_MONO"
+ ", audmode=V4L2_TUNER_MODE_MONO, signal=%d, afc=%d"
+ "}) = -1 EBADF (%m)\n",
+ p_tuner->index, p_tuner->rangelow,
+ p_tuner->rangehigh, p_tuner->signal, p_tuner->afc);
+
/* VIDIOC_QUERYCTRL */
ioctl(-1, VIDIOC_QUERYCTRL, 0);
printf("ioctl(-1, VIDIOC_QUERYCTRL, NULL) = -1 EBADF (%m)\n");
--
2.11.0
More information about the Strace-devel
mailing list