tests/ioctl_v4l2.c: fix build on older systems
Fix build on systems without HAVE_DECL_V4L2_CTRL_TYPE_STRING or V4L2_CTRL_CLASS_CAMERA. * tests/ioctl_v4l2.c (main) [VIDIOC_S_EXT_CTRLS]: Disable part of the test if [!HAVE_DECL_V4L2_CTRL_TYPE_STRING]. Replace V4L2_CTRL_CLASS_CAMERA with V4L2_CTRL_CLASS_USER.
This commit is contained in:
@ -69,8 +69,6 @@ main(void )
|
||||
.pixelformat = magic
|
||||
#endif
|
||||
};
|
||||
unsigned int i;
|
||||
|
||||
|
||||
/* VIDIOC_QUERYCAP */
|
||||
ioctl(-1, VIDIOC_QUERYCAP, 0);
|
||||
@ -129,7 +127,7 @@ main(void )
|
||||
ioctl(-1, VIDIOC_TRY_FMT, 0);
|
||||
printf("ioctl(-1, VIDIOC_TRY_FMT, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
# if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
|
||||
#if HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE
|
||||
memset(p_format, -1, sizeof(*p_format));
|
||||
p_format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
p_format->fmt.pix_mp.width = 0xdad1beaf;
|
||||
@ -137,6 +135,7 @@ main(void )
|
||||
p_format->fmt.pix_mp.pixelformat = 0xdeadbeef;
|
||||
p_format->fmt.pix_mp.field = V4L2_FIELD_NONE;
|
||||
p_format->fmt.pix_mp.colorspace = V4L2_COLORSPACE_JPEG;
|
||||
unsigned int i;
|
||||
for (i = 0; i < ARRAY_SIZE(p_format->fmt.pix_mp.plane_fmt); ++i) {
|
||||
p_format->fmt.pix_mp.plane_fmt[i].sizeimage = 0xbadc0de0 | i;
|
||||
p_format->fmt.pix_mp.plane_fmt[i].bytesperline = 0xdadbeaf0 | i;
|
||||
@ -159,11 +158,11 @@ main(void )
|
||||
}
|
||||
printf("], num_planes=%u}}) = -1 EBADF (%m)\n",
|
||||
p_format->fmt.pix_mp.num_planes);
|
||||
# else
|
||||
#else
|
||||
ioctl(-1, VIDIOC_TRY_FMT, page);
|
||||
printf("ioctl(-1, VIDIOC_TRY_FMT, {type=%#x /* V4L2_BUF_TYPE_??? */})"
|
||||
" = -1 EBADF (%m)\n", magic);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* VIDIOC_REQBUFS */
|
||||
ioctl(-1, VIDIOC_REQBUFS, 0);
|
||||
@ -404,6 +403,7 @@ main(void )
|
||||
", count=%u, controls=%p}) = -1 EBADF (%m)\n",
|
||||
p_ext_controls->count, p_ext_controls->controls);
|
||||
|
||||
# if HAVE_DECL_V4L2_CTRL_TYPE_STRING
|
||||
p_ext_controls->count = 2;
|
||||
p_ext_controls->controls =
|
||||
tail_alloc(sizeof(*p_ext_controls->controls) * p_ext_controls->count);
|
||||
@ -442,17 +442,18 @@ main(void )
|
||||
p_ext_controls->controls[0].value,
|
||||
(long long) p_ext_controls->controls[0].value64,
|
||||
p_ext_controls->controls + 2);
|
||||
# endif /* HAVE_DECL_V4L2_CTRL_TYPE_STRING */
|
||||
|
||||
/* VIDIOC_TRY_EXT_CTRLS */
|
||||
ioctl(-1, VIDIOC_TRY_EXT_CTRLS, 0);
|
||||
printf("ioctl(-1, VIDIOC_TRY_EXT_CTRLS, NULL) = -1 EBADF (%m)\n");
|
||||
|
||||
p_ext_controls->ctrl_class = V4L2_CTRL_CLASS_CAMERA;
|
||||
p_ext_controls->ctrl_class = V4L2_CTRL_CLASS_USER;
|
||||
p_ext_controls->count = magic;
|
||||
p_ext_controls->controls = (void *) -2UL;
|
||||
ioctl(-1, VIDIOC_TRY_EXT_CTRLS, p_ext_controls);
|
||||
printf("ioctl(-1, VIDIOC_TRY_EXT_CTRLS"
|
||||
", {ctrl_class=V4L2_CTRL_CLASS_CAMERA, count=%u, controls=%p})"
|
||||
", {ctrl_class=V4L2_CTRL_CLASS_USER, count=%u, controls=%p})"
|
||||
" = -1 EBADF (%m)\n",
|
||||
p_ext_controls->count, p_ext_controls->controls);
|
||||
|
||||
@ -462,7 +463,7 @@ main(void )
|
||||
|
||||
ioctl(-1, VIDIOC_G_EXT_CTRLS, p_ext_controls);
|
||||
printf("ioctl(-1, VIDIOC_G_EXT_CTRLS"
|
||||
", {ctrl_class=V4L2_CTRL_CLASS_CAMERA, count=%u, controls=%p"
|
||||
", {ctrl_class=V4L2_CTRL_CLASS_USER, count=%u, controls=%p"
|
||||
", error_idx=%u}) = -1 EBADF (%m)\n",
|
||||
p_ext_controls->count, p_ext_controls->controls,
|
||||
p_ext_controls->error_idx);
|
||||
|
Reference in New Issue
Block a user