From fa46b9ec30558c5c3680b167e7a4b4966c6e9e46 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Fri, 7 Oct 2011 18:38:08 +0300 Subject: Remove extra verbosity Remove extra verbosity by default; "-v" option brings back what used to be there. The error messages are now being printed by main.c with the possibly helpful error code attached. Signed-off-by: Sakari Ailus Acked-by: Laurent Pinchart --- src/main.c | 48 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 10 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 40ab13e..57bbc16 100644 --- a/src/main.c +++ b/src/main.c @@ -288,10 +288,16 @@ int main(int argc, char **argv) return EXIT_FAILURE; /* Open the media device and enumerate entities, pads and links. */ - media = media_open_debug(media_opts.devname, media_opts.verbose, - (void (*)(void *, ...))fprintf, stdout); - if (media == NULL) + if (media_opts.verbose) + media = media_open_debug( + media_opts.devname, + (void (*)(void *, ...))fprintf, stdout); + else + media = media_open(media_opts.devname); + if (media == NULL) { + printf("Failed to open %s\n", media_opts.devname); goto out; + } if (media_opts.entity) { struct media_entity *entity; @@ -326,15 +332,34 @@ int main(int argc, char **argv) } if (media_opts.reset) { - printf("Resetting all links to inactive\n"); - media_reset_links(media); + if (media_opts.verbose) + printf("Resetting all links to inactive\n"); + ret = media_reset_links(media); + if (ret) { + printf("Unable to reset links: %s (%d)\n", + strerror(-ret), -ret); + goto out; + } } - if (media_opts.links) - media_parse_setup_links(media, media_opts.links); + if (media_opts.links) { + ret = media_parse_setup_links(media, media_opts.links); + if (ret) { + printf("Unable to parse link: %s (%d)\n", + strerror(-ret), -ret); + goto out; + } + } - if (media_opts.formats) - v4l2_subdev_parse_setup_formats(media, media_opts.formats); + if (media_opts.formats) { + ret = v4l2_subdev_parse_setup_formats(media, + media_opts.formats); + if (ret) { + printf("Unable to parse format: %s (%d)\n", + strerror(-ret), -ret); + goto out; + } + } if (media_opts.interactive) { while (1) { @@ -348,7 +373,10 @@ int main(int argc, char **argv) if (buffer[0] == '\n') break; - media_parse_setup_link(media, buffer, &end); + ret = media_parse_setup_link(media, buffer, &end); + if (ret) + printf("Unable to parse link: %s (%d)\n", + strerror(-ret), -ret); } } -- cgit v1.2.3