utvfu(4) only has one frame size, either for PAL or NTSC. Therefore
authormglocker <mglocker@openbsd.org>
Sun, 28 Nov 2021 13:57:37 +0000 (13:57 +0000)
committermglocker <mglocker@openbsd.org>
Sun, 28 Nov 2021 13:57:37 +0000 (13:57 +0000)
return EINVAL after the first frame size has been returned in the
VIDIOC_ENUM_FRAMESIZES ioctl.

ok mpi@

sys/dev/usb/utvfu.c

index 8f89c30..eb65ff7 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: utvfu.c,v 1.13 2021/11/24 21:57:56 mglocker Exp $ */
+/*     $OpenBSD: utvfu.c,v 1.14 2021/11/28 13:57:37 mglocker Exp $ */
 /*
  * Copyright (c) 2013 Lubomir Rintel
  * Copyright (c) 2013 Federico Simoncelli
@@ -537,6 +537,10 @@ utvfu_enum_fsizes(void *v, struct v4l2_frmsizeenum *fsizes)
        if (fsizes->pixel_format != V4L2_PIX_FMT_YUYV)
                return (EINVAL);
 
+       /* The device only supports one frame size. */
+       if (fsizes->index >= 1)
+               return (EINVAL);
+
        fsizes->type = V4L2_FRMSIZE_TYPE_DISCRETE;
        fsizes->discrete.width = utvfu_norm_params[sc->sc_normi].cap_width;
        fsizes->discrete.height = utvfu_norm_params[sc->sc_normi].cap_height;