public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: linux-media@vger.kernel.org, sakari.ailus@linux.intel.com,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	niklas.soderlund+renesas@ragnatech.se,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	satish.nagireddy@getcruise.com
Subject: Re: [PATCH v4 8/8] v4l2-ctl: Check for Streams API support
Date: Mon, 24 Apr 2023 11:03:01 +0300	[thread overview]
Message-ID: <20230424080301.GH4926@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230421124428.393261-9-tomi.valkeinen@ideasonboard.com>

Hi Tomi,

Thank you for the patch.

On Fri, Apr 21, 2023 at 03:44:28PM +0300, Tomi Valkeinen wrote:
> Return an error if the user tries to use streams related features, but
> streams are not supported.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> ---
>  utils/v4l2-ctl/v4l2-ctl-subdev.cpp | 55 ++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
> 
> diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
> index 7ab64646..ec70b52b 100644
> --- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
> +++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
> @@ -569,6 +569,11 @@ void subdev_set(cv4l_fd &_fd)
>  	if (options[OptSetSubDevFormat] || options[OptTrySubDevFormat]) {
>  		struct v4l2_subdev_format fmt;
>  
> +		if (!_fd.has_streams_support() && set_fmt_stream) {
> +			printf("Streams API not supported.\n");
> +			return;
> +		}
> +
>  		memset(&fmt, 0, sizeof(fmt));
>  		fmt.pad = set_fmt_pad;
>  		fmt.stream = set_fmt_stream;
> @@ -617,6 +622,11 @@ void subdev_set(cv4l_fd &_fd)
>  	if (options[OptSetSubDevSelection] || options[OptTrySubDevSelection]) {
>  		struct v4l2_subdev_selection sel;
>  
> +		if (!_fd.has_streams_support() && vsel.stream) {
> +			printf("Streams API not supported.\n");
> +			return;
> +		}
> +
>  		memset(&sel, 0, sizeof(sel));
>  		sel.pad = vsel.pad;
>  		sel.stream = vsel.stream;
> @@ -649,6 +659,11 @@ void subdev_set(cv4l_fd &_fd)
>  	if (options[OptSetSubDevFPS]) {
>  		struct v4l2_subdev_frame_interval fival;
>  
> +		if (!_fd.has_streams_support() && set_fps_stream) {
> +			printf("Streams API not supported.\n");
> +			return;
> +		}
> +
>  		memset(&fival, 0, sizeof(fival));
>  		fival.pad = set_fps_pad;
>  		fival.stream = set_fps_stream;
> @@ -674,6 +689,11 @@ void subdev_set(cv4l_fd &_fd)
>  		}
>  	}
>  	if (options[OptSetRouting]) {
> +		if (!_fd.has_streams_support()) {
> +			printf("Streams API not supported.\n");
> +			return;
> +		}
> +
>  		if (doioctl(fd, VIDIOC_SUBDEV_S_ROUTING, &routing) == 0)
>  			printf("Routing set\n");
>  	}
> @@ -731,6 +751,11 @@ void subdev_get(cv4l_fd &_fd)
>  	if (options[OptGetSubDevFormat]) {
>  		struct v4l2_subdev_format fmt;
>  
> +		if (!_fd.has_streams_support() && get_fmt_stream) {
> +			printf("Streams API not supported.\n");
> +			return;
> +		}
> +
>  		memset(&fmt, 0, sizeof(fmt));
>  		fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>  		fmt.pad = get_fmt_pad;
> @@ -745,6 +770,11 @@ void subdev_get(cv4l_fd &_fd)
>  		struct v4l2_subdev_selection sel;
>  		unsigned idx = 0;
>  
> +		if (!_fd.has_streams_support() && get_sel_stream) {
> +			printf("Streams API not supported.\n");
> +			return;
> +		}
> +
>  		memset(&sel, 0, sizeof(sel));
>  		sel.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>  		sel.pad = get_sel_pad;
> @@ -767,6 +797,11 @@ void subdev_get(cv4l_fd &_fd)
>  	if (options[OptGetSubDevFPS]) {
>  		struct v4l2_subdev_frame_interval fival;
>  
> +		if (!_fd.has_streams_support() && get_fps_stream) {
> +			printf("Streams API not supported.\n");
> +			return;
> +		}
> +
>  		memset(&fival, 0, sizeof(fival));
>  		fival.pad = get_fps_pad;
>  		fival.stream = get_fps_stream;
> @@ -784,6 +819,11 @@ void subdev_get(cv4l_fd &_fd)
>  	}
>  
>  	if (options[OptGetRouting]) {
> +		if (!_fd.has_streams_support()) {
> +			printf("Streams API not supported.\n");
> +			return;
> +		}
> +
>  		memset(&routing, 0, sizeof(routing));
>  		memset(routes, 0, sizeof(routes[0]) * NUM_ROUTES_MAX);
>  		routing.which = V4L2_SUBDEV_FORMAT_ACTIVE;
> @@ -867,11 +907,21 @@ void subdev_list(cv4l_fd &_fd)
>  	int fd = _fd.g_fd();
>  
>  	if (options[OptListSubDevMBusCodes]) {
> +		if (!_fd.has_streams_support() && list_mbus_codes_stream) {
> +			printf("Streams API not supported.\n");
> +			return;
> +		}
> +
>  		printf("ioctl: VIDIOC_SUBDEV_ENUM_MBUS_CODE (pad=%u,stream=%u)\n",
>  		       list_mbus_codes_pad, list_mbus_codes_stream);
>  		print_mbus_codes(fd, list_mbus_codes_pad, list_mbus_codes_stream);
>  	}
>  	if (options[OptListSubDevFrameSizes]) {
> +		if (!_fd.has_streams_support() && frmsize.stream) {
> +			printf("Streams API not supported.\n");
> +			return;
> +		}
> +
>  		printf("ioctl: VIDIOC_SUBDEV_ENUM_FRAME_SIZE (pad=%u,stream=%u)\n",
>  		       frmsize.pad, frmsize.stream);
>  		frmsize.index = 0;
> @@ -882,6 +932,11 @@ void subdev_list(cv4l_fd &_fd)
>  		}
>  	}
>  	if (options[OptListSubDevFrameIntervals]) {
> +		if (!_fd.has_streams_support() && frmival.stream) {
> +			printf("Streams API not supported.\n");
> +			return;
> +		}
> +
>  		printf("ioctl: VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL (pad=%u,stream=%u)\n",
>  		       frmival.pad, frmival.stream);
>  		frmival.index = 0;

-- 
Regards,

Laurent Pinchart

      reply	other threads:[~2023-04-24  8:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-21 12:44 [PATCH v4 0/8] v4l-utils: Support multiplexed streams Tomi Valkeinen
2023-04-21 12:44 ` [PATCH v4 1/8] v4l2-ctl: Add routing and streams support Tomi Valkeinen
2023-04-24  7:04   ` Laurent Pinchart
2023-05-29  7:02     ` Tomi Valkeinen
2023-05-29  7:47       ` Laurent Pinchart
2023-04-21 12:44 ` [PATCH v4 2/8] media-ctl: Add support for routes and streams Tomi Valkeinen
2023-04-24  7:29   ` Laurent Pinchart
2023-05-29  7:34     ` Tomi Valkeinen
2023-05-29  7:49       ` Laurent Pinchart
2023-05-29  8:14         ` Tomi Valkeinen
2023-04-21 12:44 ` [PATCH v4 3/8] v4l2-ctl/compliance: Add routing and streams multiplexed streams Tomi Valkeinen
2023-04-21 12:44 ` [PATCH v4 4/8] v4l2-ctl/compliance: Add simple routing test Tomi Valkeinen
2023-04-24  8:04   ` Laurent Pinchart
2023-04-21 12:44 ` [PATCH v4 5/8] HACK: include/linux: Add client capabilities Tomi Valkeinen
2023-04-24  7:32   ` Laurent Pinchart
2023-05-25 14:05     ` Hans Verkuil
2023-05-26  8:19       ` Tomi Valkeinen
2023-04-21 12:44 ` [PATCH v4 6/8] media-ctl: Check for Streams API support Tomi Valkeinen
2023-04-24  7:54   ` Laurent Pinchart
2023-04-21 12:44 ` [PATCH v4 7/8] utils/common: Set V4L2_SUBDEV_CLIENT_CAP_STREAMS for subdevs Tomi Valkeinen
2023-04-24  8:01   ` Laurent Pinchart
2023-04-21 12:44 ` [PATCH v4 8/8] v4l2-ctl: Check for Streams API support Tomi Valkeinen
2023-04-24  8:03   ` Laurent Pinchart [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230424080301.GH4926@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=sakari.ailus@linux.intel.com \
    --cc=satish.nagireddy@getcruise.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox