diff mbox series

[2/2] media-ctl: Re-order setting format and routes

Message ID 20240117130805.939312-2-dan.scally@ideasonboard.com (mailing list archive)
State New
Headers show
Series [1/2] v4l2-ctl: Add --try-routing option | expand

Commit Message

Dan Scally Jan. 17, 2024, 1:08 p.m. UTC
Currently media-ctl attempts to set formats that are passed to it
with -V _before_ setting routes passed to it with -R. This is a
problem, because the formats that one wants may not be valid until
routing has been configured (for example, if the format is for a
route that is inactive by default).

Reorder things so that setting routes comes before setting formats.

Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>
---
 utils/media-ctl/media-ctl.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Laurent Pinchart Jan. 17, 2024, 1:22 p.m. UTC | #1
Hi Dan,

Thank you for the patch.

On Wed, Jan 17, 2024 at 01:08:05PM +0000, Daniel Scally wrote:
> Currently media-ctl attempts to set formats that are passed to it
> with -V _before_ setting routes passed to it with -R. This is a
> problem, because the formats that one wants may not be valid until
> routing has been configured (for example, if the format is for a
> route that is inactive by default).
> 
> Reorder things so that setting routes comes before setting formats.
> 
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>

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

> ---
>  utils/media-ctl/media-ctl.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c
> index 961d10c8..2081f111 100644
> --- a/utils/media-ctl/media-ctl.c
> +++ b/utils/media-ctl/media-ctl.c
> @@ -751,20 +751,20 @@ int main(int argc, char **argv)
>  		}
>  	}
>  
> -	if (media_opts.formats) {
> -		ret = v4l2_subdev_parse_setup_formats(media,
> -						      media_opts.formats);
> +	if (media_opts.routes) {
> +		ret = v4l2_subdev_parse_setup_routes(media, media_opts.routes);
>  		if (ret) {
> -			printf("Unable to setup formats: %s (%d)\n",
> +			printf("Unable to setup routes: %s (%d)\n",
>  			       strerror(-ret), -ret);
>  			goto out;
>  		}
>  	}
>  
> -	if (media_opts.routes) {
> -		ret = v4l2_subdev_parse_setup_routes(media, media_opts.routes);
> +	if (media_opts.formats) {
> +		ret = v4l2_subdev_parse_setup_formats(media,
> +						      media_opts.formats);
>  		if (ret) {
> -			printf("Unable to setup routes: %s (%d)\n",
> +			printf("Unable to setup formats: %s (%d)\n",
>  			       strerror(-ret), -ret);
>  			goto out;
>  		}
sakari.ailus@linux.intel.com Jan. 18, 2024, 10:53 a.m. UTC | #2
On Wed, Jan 17, 2024 at 01:08:05PM +0000, Daniel Scally wrote:
> Currently media-ctl attempts to set formats that are passed to it
> with -V _before_ setting routes passed to it with -R. This is a
> problem, because the formats that one wants may not be valid until
> routing has been configured (for example, if the format is for a
> route that is inactive by default).
> 
> Reorder things so that setting routes comes before setting formats.
> 
> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com>

Thanks!

Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
diff mbox series

Patch

diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c
index 961d10c8..2081f111 100644
--- a/utils/media-ctl/media-ctl.c
+++ b/utils/media-ctl/media-ctl.c
@@ -751,20 +751,20 @@  int main(int argc, char **argv)
 		}
 	}
 
-	if (media_opts.formats) {
-		ret = v4l2_subdev_parse_setup_formats(media,
-						      media_opts.formats);
+	if (media_opts.routes) {
+		ret = v4l2_subdev_parse_setup_routes(media, media_opts.routes);
 		if (ret) {
-			printf("Unable to setup formats: %s (%d)\n",
+			printf("Unable to setup routes: %s (%d)\n",
 			       strerror(-ret), -ret);
 			goto out;
 		}
 	}
 
-	if (media_opts.routes) {
-		ret = v4l2_subdev_parse_setup_routes(media, media_opts.routes);
+	if (media_opts.formats) {
+		ret = v4l2_subdev_parse_setup_formats(media,
+						      media_opts.formats);
 		if (ret) {
-			printf("Unable to setup routes: %s (%d)\n",
+			printf("Unable to setup formats: %s (%d)\n",
 			       strerror(-ret), -ret);
 			goto out;
 		}